build: clean up some more generated files Commit c1d39153da00d5525b2f7874b2d214a7f1b1bb86 added a cc-wrapper script to help generate CTF data for all objects, which is generated by configure. Remove it in the distclean target so we don't leave a stray file hanging around. Commit 48ce41a447c354b8a20b769e4aa5b502ba5bcc09 added a pkgbuild.sh script, to be used to build packages for newer versions of macOS, supplementing the buildpkg.sh that was previously used. Clean it up in distclean as well (buildpkg.sh was already listed). Also clean up AFS_component_version_number.c in libuafs/Makefile.common.in. These issues were detected while resolving https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1048470 . Change-Id: I0fea00924a998ee316d48cf76103ea9871a34c6b Reviewed-on: https://gerrit.openafs.org/15605 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
BUILD: Ensure that make clean actually cleans all products After a build, running make clean leaves the following objects: src/dir/test/dtest.o src/libuafs/libuafs.a src/libuafs/*.o src/roken/*.o Add a few rules to the various Makefiles to ensure that we clean up those files as well. Change-Id: I4fb3346b68aa9e20164952d9461c39664020ef7f Reviewed-on: https://gerrit.openafs.org/15119 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
DARWIN: Declare/include functions before using them Every function should be explicitly declared before it can be called. Since -Wimplicit-function-declaration is usually a warning and not an error, calling undeclared functions does not prevent us from building the code. However, apple-clang 12 makes this an error by default, prohibiting the build of the current version on macOS 11 (Big Sur). To fix this problem, declare functions before calling them. Also, include mach/thread_act.h into afs_call.c so the declaration of thread_terminate() can be found on macOS. Last, given that the third argument of PIOCTL() (if UKERNEL is defined) is a pointer, cast it to 'long'. Doing so, we can avoid another inhibited warning. Notice that this PIOCTL definition is scoped to a single file (src/auth/ktc.c). Change-Id: I6d796c10ea4dd81b13ae5feb9f42608aa445560d Reviewed-on: https://gerrit.openafs.org/14744 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
UKERNEL: Build linktest with COMMON_CFLAGS Currently, 'linktest' in libuafs is built with a weird custom rule that specifies several various CFLAGS and LDFLAGS, etc. One side-effect of this is that linktest is built without specifying -O, even if optimization is otherwise enabled. Normally nobody would care about the optimization of linktest, since it's never supposed to be run, but this can cause an error when building with -D_FORTIFY_SOURCE=1 on some systems (such as RHEL7): In file included from /usr/include/sys/types.h:25:0, from /.../src/config/afsconfig.h:1485, from /.../src/libuafs/linktest.c:15: /usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ cc1: all warnings being treated as errors make[3]: *** [linktest] Error 1 For now, to fix this just include $(COMMON_CFLAGS) in the flags we give for linktest, so $(OPTMZ) also gets pulled in, and building linktest gets a little closer to a normal compilation step. Change-Id: I3362dcfe8407825ab88854ae59da4188ed16be9d Reviewed-on: https://gerrit.openafs.org/14324 Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Do not build shared-only libs for --disable-shared Commit 0f1e54c4 (Pass -shared when linking some shared libraries) changed some of our linking rules to pass -shared to libtool when linking. When building with the --disable-shared configure option, this causes those linker rules to fail, since shared libraries are disabled. Before commit 0f1e54c4, we could build with --disable-shared successfully. To allow us to build again with --disable-shared, just don't build the relevant shared-only libraries at all, when shared libraries are disabled. To accomplish this, introduce a new substitution variable, SHARED_ONLY, which allows certain lines in Makefiles to become commented-out when shared libraries are disabled. Update all of the shared-only libraries to be built conditionally based on this variable. Except for libuafs.la, which appears to be not referenced by anything. Just remove the rules for that instead. Change-Id: I82084a08d2f9c12ca438bd7b1626e1376159c975 Reviewed-on: https://gerrit.openafs.org/13927 Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Pass -shared when linking some shared libraries Currently, we use $(LT_LDLIB_shlib) to build most of our shared libraries. This invokes libtool, passing our various flags like PTH_LDFLAGS and PTH_CFLAGS (since all of our shared-library code is for pthreads). Notably, we do NOT pass the -shared flag; the -shared flag tells libtool to only build a shared library, and to not also build a static library (on systems where libtool supports building shared and static libraries simultaneously). Because of this, our LT_LDLIB_shlib invocations build both, which is reasonably correct for our per-module convenience libraries (that end up getting linked statically into the binaries that we install), but is not entirely correct for the public libraries that we install. Specifically, for ABI compatibility purposes, we must provide both shared and static libraries of the public libraries that we install, and since libtool on AIX does not build (or install) a static library at all with --mode-link unless -static is passed, we have separate rules to build the shared and static libraries for final installation. This can cause install errors with parallel make (on non-AIX systems), and possibly other errors, when we go to install the relevant library into TOP_LIBDIR. For example, in src/kopenafs, we have the following rules: ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX}: libkopenafs.la ${LT_INSTALL_DATA} libkopenafs.la ${TOP_LIBDIR}/libkopenafs.la ${RM} ${TOP_LIBDIR}/libkopenafs.la ${TOP_LIBDIR}/libkopenafs.a: libkopenafs.a ${INSTALL_DATA} libkopenafs.a $@ The rule to install libkopenafs.so will invoke libtool to do the install, which will install libkopenafs.so, libkopenafs.so.X.Y, and libkopenafs.a (from .libs/libkopenafs.a, not the libkopenafs.a we built separately). If we are running the rule to install libkopenafs.a in parallel, it may fail with an error like so: /usr/bin/install -c -m 644 libkopenafs.a /home/buildbot/openafs/fedora26-x86_64/build/lib/libkopenafs.a /usr/bin/install: cannot create regular file '/home/buildbot/openafs/fedora26-x86_64/build/lib/libkopenafs.a': File exists make[3]: *** [Makefile:35: /home/buildbot/openafs/fedora26-x86_64/build/lib/libkopenafs.a] Error 1 Even without that error, this confusion means that the libkopenafs.a installed into TOP_LIBDIR may be the one from src/kopenafs/libkopenafs.a, or the one from libtool's src/kopenafs/.libs/libkopenafs.a; it depends on what order the rules are run. If those libraries are different, that could potentially cause all sorts of other problems. To avoid this, we can pass -shared to libtool when building our shared libraries. We used to pass -shared when building shared libraries, since -shared is almost always one our SHLIB_LDFLAGS set in src/osconf.m4. However, ever since commit 2c3a517e (Retire Makefile.shared), SHD_CFLAGS, SHD_LDFLAGS, and SHD_CCRULE have all been unused, and SHD_LDFLAGS was the only place where we used SHLIB_LDFLAGS. As a result, we never use SHLIB_LDFLAGS anywhere, and so we never pass -shared to anything. However, we cannot pass -shared to libtool when building all of our shared libraries, since we do need the static library for our per-module convenience libraries. For example, liboafs_rx.la has no separately-built static library (librx.a is for LWP, liboafs_rx.{so,a} is for pthreads), but liboafs_rx needs to be linked statically into all of our command-line tools. So to fix this, introduce a new linking rule, called LT_LDLIB_shlib_only, which causes the given library to be built only as a shared library (by giving -shared to libtool), and not as a static library. Update the build rules to use this new linking rule for the libraries that need it, and leave the others alone. Since the only use of LT_LDLIB_shlib_missing is also used for a public library (afshcrypto), also pass -shared in that rule. Also remove SHD_* and SHLIB_LDFLAGS variables, since they are unused. Change-Id: Ia9e040afa3819f1ff70d050a400fecb9624bb9ba Reviewed-on: https://gerrit.openafs.org/13786 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
fsint: remove dead code The last references to these objects were removed with commit 3828c257ae33306bbdd3c6db9381601fe5b1b110 "dead-code-and-prototyes-20060214". A few mentions of CBS and BBS are left in the documentation as historical references: - doc/man-pages/pod1/rxgen.pod - src/kauth/AuthServer.mss Change-Id: Ia24eef7bb1509ff10d11de5c51e688e27f69417a Reviewed-on: https://gerrit.openafs.org/13324 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
libuafs: Stop clobbering CFLAGS Currently, in the libuafs MakefileProto for every platform, CFLAGS is set to a bunch of flags, ignoring any CFLAGS set by the 'make' command-line provided by the user. Since most of the rest of the tree honors CFLAGS, it is confusing and can cause errors when src/libuafs ignore the user-set CFLAGS. One example of this breaking the build is when building RHEL RPMs for certain sub-architectures of the current machine. If you try to 'rpmbuild --target=i686' on 32-bit x86 RHEL 5, we will build with -march=i686 in the CFLAGS, which will be used to build most objects and is used in our configure tests. As a result, our configure tests will say that gcc atomic intrinsics are available. But when we go to build libuafs objects, we will not have -march=i686 in our CFLAGS, which causes (on RHEL 5) gcc to default to building for i386, which does not have gcc atomic intrinsics available. This causes build errors like this: libuafs.a(rx.o): In function `rx_atomic_test_and_clear_bit': [...]/BUILD/openafs-1.8.0/src/rx/rx_atomic.h:462: undefined reference to `__sync_fetch_and_and_4' To fix this, change the libuafs MakefileProtos to not set CFLAGS directly; instead, set them in a new variable UAFS_CFLAGS. Makefile.common then pulls those flags into MODULE_CFLAGS, which is used in our *_CCRULE build rules. While we are here, also move the common set of CFLAGS set by each platform's MakefileProto into Makefile.common. Now, each MakefileProto only needs to set CFLAGS that are specific to that platform, which ends up being very few (since most platforms were using the exact same set of CFLAGS). Relevant issue identified and analyzed by mbarbosa@sinenomine.net. Change-Id: I1bd21a6e7669137be3e5edee86227fd37f841d62 Reviewed-on: https://gerrit.openafs.org/13262 Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
libuafs: remove stale afs_nfsdisp.lo rule afs_nfsdisp.lo is not used, so we do not need a build rule for it. Change-Id: I4ca53a4823b0ccd5bfd769867f6766bd05ea4ceb Reviewed-on: https://gerrit.openafs.org/12802 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Make libuafs safe for parallel make In src/libuafs, "make" with a large number of jobs (e.g., "make -j16") can fail because some of the LT_objs depend on make_h_tree having been called already. Make "h" (the libuafs header subdirectory) a dependency of all of LT_objs. Change-Id: Ie005dbb1f1b0a794c703147062615808a45956dc Reviewed-on: http://gerrit.openafs.org/12079 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Finish deorbiting libjuafs.a Change I2074d5bc26e326db36b16e055431818ef1c69210 removed the separate compilation/link of a libjuafs.a (since it was functionally identical to the libuafs.a already being built), but retained a libjuafs.a in TOP_LIBDIR for use by src/JAVA/libjafs/. This commit adjusts src/JAVA/libjafs to refer to libuafs.a directly, and removes references to libjuafs.a which are no longer relevant. Change-Id: I0d02ea9e4be773ac50a04925c45e5f243650e21a Reviewed-on: http://gerrit.openafs.org/11526 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: D Brashear <shadow@your-file-system.com>
Build libuafs with libtool Use the standard program for building PIC and non-PIC object files, instead of rolling our own. This allows us to pull the build rules into the Makefile.common, leaving just compiler flags and similar in the MakefileProtos. This does change the build flags being used to compile these files somewhat -- the old CRULE1 and CRULEPIC used CC instead of CCOBJ or MT_CC, and did not pass MT_CFLAGS, but it should be safe to move to the standard compiler invocations. We can also eliminate the libuafs-specific 'OPTF' variable which expands to OPTMZ almost everywhere. Rename our COMMON_INCLUDE to MODULE_INCLUDE so it's picked up properly by the standard build rules; this will let us remove ${TOP_OBJDIR}/src/config and ${TOP_INCDIR} once the rest of the build rules in this Makefile are converted to use libtool, as those include directories are already added by COMMON_INCL in Makefile.config. As a side effect, we get rid of the LIBUAFS make variable -- all sites were defining it to libuafs.a anyway, so we can just hardcode it. We can also build a shared libuafs.la "for free". Don't install it anywhere just yet, though. Change-Id: I2bda2f40bbd0aa808c24e074d2d7bcd329f6b77e Reviewed-on: http://gerrit.openafs.org/11472 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: D Brashear <shadow@your-file-system.com>
Deorbit separate JUAFS build Since 80943970b8cfcdf3fc630b25804aebaea228bd73, when the web enhancements were enabled universally, there has no longer been a functional difference between the UAFS and JUAFS builds. Their object files are compiled using the same compilation rule, and the list of object files differed only by rx_kmutex.o (which is devoid of content) and xdr_int32.o (which is preumably an oversight). Save the extra build time by just reinstalling libuafs.a as libjuafs.a to preserve the existing interfaces. Additionally, drop the LIBJUAFS make variable -- all definitions set it to libjuafs.a. Similarly, the LIBJUAFS_FLAGS variable was unused and can be removed. Change-Id: I2074d5bc26e326db36b16e055431818ef1c69210 Reviewed-on: http://gerrit.openafs.org/11471 Reviewed-by: D Brashear <shadow@your-file-system.com> Tested-by: D Brashear <shadow@your-file-system.com>
Deorbit the netscape plugin Netscape hasn't been a thing since 2008. We would only try to build it if someone manually ran 'webinstall' in src/libuafs, and there is no documentation telling anyone to do so. It's dead, Jim. Change-Id: I7486ca33da7ff19f23f0d9f54f5fb4e7e3232540 Reviewed-on: http://gerrit.openafs.org/11470 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: D Brashear <shadow@your-file-system.com> Tested-by: D Brashear <shadow@your-file-system.com>
Remove kauth from libuafs Remove the uafs_klog() apis from afs_usrops. Nothing uses it except the obsolete afsweb stuff that isn't built anymore. Stop linking in all kauth and pts components. Also remove some other objects from libauth, rxkad, and com_err, that were only present as dependencies of kauth and pts components Change-Id: Idf83b3dd1098e874d90244fe72609666b13216a4 Reviewed-on: http://gerrit.openafs.org/9887 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Pretty make output for tsalvaged, lib[u]afs Change-Id: I852f862c029cad60dc7871ab22367fb266314244 Reviewed-on: http://gerrit.openafs.org/8108 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
libuafs: use the pic version of opr for perluafs perluafs is a shared library, therefore we need to use the PIC version of the opr library (just like any of the other libraries that have two flavors and get linked with perluafs). Change-Id: I597f4f40010524d94341d343d3f54648a139f760 Reviewed-on: http://gerrit.openafs.org/8131 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
auth: Relocate NetRestrict support functions Pull the NetRestrict and NetInfo support functions out of libutil, and into libauth. This starts to concentrate all of our configuration file parsing functions into the same place. It also gets rid of a circular dependency. NetRestrict parsing relies on functions from rx, so with this in libutil, we had the dependency chain util->rx->util Change-Id: I250d4d8264da8db61f603a06d1b7fdab44384cd3 Reviewed-on: http://gerrit.openafs.org/8027 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
auth: local realms configuration Add krb.conf and krb.excl support to the auth cell configuration library. Provide a function to determine if the user is local to the cell. Provide a function to set the local realms during application initialization. These changes are intended to replace the functions afs_krb_get_lrealm and afs_is_foreign_ticket_name. Change-Id: Iba57e9ffc2c958f3a4565a9352ce172189276ce9 Reviewed-on: http://gerrit.openafs.org/5744 Reviewed-by: Derrick Brashear <shadow@dementix.org> Tested-by: BuildBot <buildbot@rampaginggeek.com>
rx: Hide struct rx_peer from the rest of the tree The peer structure is an internal RX structure, so it shouldn't be contained in public header files, or used by non-rx modules. Hide the structure definition in rx_peer.h, and convert the rx_HostOf and rx_PortOf accessors from macros into functions. This will also help with adding support for non-IPv4 addresses to RX. Change-Id: I790fa3193bfa629a2872fc5395d0146e76a2de9e Reviewed-on: http://gerrit.openafs.org/7002 Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com> Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>