From: Benjamin Kaduk Date: Mon, 31 Aug 2020 00:37:19 +0000 (-0700) Subject: Import upstream patches for -fcommon support X-Git-Tag: debian/1.8.6-2~2 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3683e764252feb7bd47488ee34682acd11f0013f;p=packages%2Fo%2Fopenafs.git Import upstream patches for -fcommon support With gcc10 and llvm11 defaulting to -fcommon, we need to pull in fixes to ensure that any given symbol is defined in only one compilation unit. Change-Id: I29eee0be728dab2f82f98669828d351f156d5f65 --- diff --git a/debian/patches/0005-Avoid-duplicate-definitions-of-globals.patch b/debian/patches/0005-Avoid-duplicate-definitions-of-globals.patch new file mode 100644 index 000000000..ff29fda55 --- /dev/null +++ b/debian/patches/0005-Avoid-duplicate-definitions-of-globals.patch @@ -0,0 +1,350 @@ +From: Cheyenne Wills +Date: Fri, 22 May 2020 12:16:48 -0600 +Subject: Avoid duplicate definitions of globals + +GCC 10 changed a default flag from -fcommon to -fno-common. See +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678 for some background. + +The change in gcc 10 results in build link-time errors. For example: + ../../src/xstat/.libs/liboafs_xstat_cm.a(xstat_cm.o):(.bss+0x2050): + multiple definition of `numCollections'; + +Ensure that only one definition for global data objects exist and change +references to use "extern" as needed. + +To ensure that future changes do not introduce duplicated global +definitions, add the -fno-common flag to XCFLAGS when using the +configure --enable-checking setting. + +[cwills@sinenomine.net: Note for 1.8.x: renamed terminationEvent +to cm_terminationEvent/fs_terminationEvent instead of deleting it.] + +Reviewed-on: https://gerrit.openafs.org/14106 +Tested-by: BuildBot +Reviewed-by: Andrew Deason +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 0e2072ae386d4111bef161eb955964b649c31386) + +Change-Id: I54ca61d372cf763e4a28c0b0829ea361219f6203 +Reviewed-on: https://gerrit.openafs.org/14217 +Reviewed-by: Andrew Deason +Reviewed-by: Mark Vitale +Tested-by: BuildBot +Reviewed-by: Stephan Wiesand +(cherry picked from commit a2eec64374d6b754b29c509b554573cb6e53eb46) +--- + src/bucoord/main.c | 6 ++---- + src/butc/dbentries.c | 2 +- + src/butc/dump.c | 7 +++---- + src/butc/lwps.c | 2 +- + src/butc/tcmain.c | 2 +- + src/cf/osconf.m4 | 2 +- + src/fsprobe/fsprobe.h | 1 - + src/uss/uss_vol.c | 2 +- + src/viced/host.c | 2 ++ + src/viced/host.h | 2 +- + src/vol/fssync-server.c | 3 --- + src/vol/volume.c | 3 --- + src/xstat/xstat_cm.c | 7 +++---- + src/xstat/xstat_cm.h | 3 +-- + src/xstat/xstat_cm_test.c | 4 ++-- + src/xstat/xstat_fs.c | 7 +++---- + src/xstat/xstat_fs.h | 3 +-- + src/xstat/xstat_fs_test.c | 4 ++-- + 18 files changed, 25 insertions(+), 37 deletions(-) + +diff --git a/src/bucoord/main.c b/src/bucoord/main.c +index d2a5f36..a453cc9 100644 +--- a/src/bucoord/main.c ++++ b/src/bucoord/main.c +@@ -47,9 +47,9 @@ char tcell[64]; + /* + * Global configuration information for the Backup Coordinator. + */ +-struct bc_config *bc_globalConfig; /*Ptr to global BC configuration info */ ++extern struct bc_config *bc_globalConfig; /*Ptr to global BC configuration info */ + +-struct ubik_client *cstruct; /* Ptr to Ubik client structure */ ++extern struct ubik_client *cstruct; /* Ptr to Ubik client structure */ + time_t tokenExpires; /* The token's expiration time */ + + static const char *DefaultConfDir; /*Default backup config directory */ +@@ -162,8 +162,6 @@ bc_InitTextConfig(void) + udbClientTextP ctPtr; + int i; + +- extern struct bc_config *bc_globalConfig; +- + mkdir(DefaultConfDir, 777); /* temporary */ + + /* initialize the client text structures */ +diff --git a/src/butc/dbentries.c b/src/butc/dbentries.c +index 37b35d3..29ddcbd 100644 +--- a/src/butc/dbentries.c ++++ b/src/butc/dbentries.c +@@ -31,7 +31,7 @@ + #include "error_macros.h" + + dlqlinkT savedEntries; +-dlqlinkT entries_to_flush; ++static dlqlinkT entries_to_flush; + + int dbWatcherinprogress; + +diff --git a/src/butc/dump.c b/src/butc/dump.c +index 1f4eb9b..f8fc943 100644 +--- a/src/butc/dump.c ++++ b/src/butc/dump.c +@@ -42,8 +42,7 @@ extern int isafile; + extern int forcemultiple; + + extern struct ubik_client *cstruct; +-dlqlinkT savedEntries; +-dlqlinkT entries_to_flush; ++extern dlqlinkT savedEntries; + + extern afs_int32 groupId; + extern afs_int32 BufferSize; +@@ -61,8 +60,8 @@ extern char *xbsalGName; + extern char *globalButcLog; + #endif /*xbsa */ + +-afs_int32 dataSize; /* Size of data to read on each rx_Read() call */ +-afs_int32 tapeblocks; /* Number of 16K tape datablocks in buffer (!CONF_XBSA) */ ++extern afs_int32 dataSize; /* Size of data to read on each rx_Read() call */ ++extern afs_int32 tapeblocks; /* Number of 16K tape datablocks in buffer (!CONF_XBSA) */ + + /* TBD + * +diff --git a/src/butc/lwps.c b/src/butc/lwps.c +index d262991..aff5e9e 100644 +--- a/src/butc/lwps.c ++++ b/src/butc/lwps.c +@@ -51,7 +51,7 @@ extern int forcemultiple; + #endif + + /* XBSA Global Parameters */ +-afs_int32 xbsaType; ++extern afs_int32 xbsaType; + #ifdef xbsa + struct butx_transactionInfo butxInfo; + #endif +diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c +index e8a2093..a0298ad 100644 +--- a/src/butc/tcmain.c ++++ b/src/butc/tcmain.c +@@ -66,7 +66,7 @@ + #define TL_PREFIX "TL" + #define CFG_PREFIX "CFG" + +-struct ubik_client *cstruct; ++extern struct ubik_client *cstruct; + FILE *logIO, *ErrorlogIO, *centralLogIO, *lastLogIO; + char lFile[AFSDIR_PATH_MAX]; + char logFile[AFSDIR_PATH_MAX + 256]; +diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 +index 5f0d73f..e36152b 100644 +--- a/src/cf/osconf.m4 ++++ b/src/cf/osconf.m4 +@@ -672,7 +672,7 @@ if test "x$GCC" = "xyes"; then + XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Wpointer-arith" + fi + if test "x$enable_checking" != "xno"; then +- XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith" ++ XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith -fno-common" + if test "x$enable_checking" != "xall"; then + CFLAGS_NOERROR="-Wno-error" + CFLAGS_NOUNUSED="-Wno-unused" +diff --git a/src/fsprobe/fsprobe.h b/src/fsprobe/fsprobe.h +index 94083bf..3060371 100644 +--- a/src/fsprobe/fsprobe.h ++++ b/src/fsprobe/fsprobe.h +@@ -103,7 +103,6 @@ struct fsprobe_ProbeResults { + + extern int fsprobe_numServers; /*# servers connected */ + extern struct fsprobe_ConnectionInfo *fsprobe_ConnInfo; /*Ptr to connections */ +-extern int numCollections; /*Num data collections */ + extern struct fsprobe_ProbeResults fsprobe_Results; /*Latest probe results */ + + extern int fsprobe_Init(int, struct sockaddr_in *, int, int (*)(void), int ); +diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c +index c9c1394..b31a42a 100644 +--- a/src/uss/uss_vol.c ++++ b/src/uss/uss_vol.c +@@ -61,7 +61,7 @@ extern int line; + * will work and we can avoid nasty little core dumps. + */ + struct ubik_client *uconn_vldbP; /*Ubik connection struct */ +-struct ubik_client *cstruct; /*Required name for above */ ++extern struct ubik_client *cstruct; /*Required name for above */ + + /* + * ------------------------ Private globals ----------------------- +diff --git a/src/viced/host.c b/src/viced/host.c +index 36f9e88..e7657ca 100644 +--- a/src/viced/host.c ++++ b/src/viced/host.c +@@ -67,6 +67,8 @@ int hostCount = 0; /* number of hosts in hostList */ + int rxcon_ident_key; + int rxcon_client_key; + ++struct host *(hosttableptrs[h_MAXHOSTTABLES]); ++ + static struct rx_securityClass *sc = NULL; + static int h_quota_limit; + +diff --git a/src/viced/host.h b/src/viced/host.h +index fead948..272dcdb 100644 +--- a/src/viced/host.h ++++ b/src/viced/host.h +@@ -254,7 +254,7 @@ extern int h_RestoreState(void); + #define H_ENUMERATE_BAIL(flags) ((flags)|0x80000000) + #define H_ENUMERATE_ISSET_BAIL(flags) ((flags)&0x80000000) + +-struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */ ++extern struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */ + #define h_htoi(host) ((host)->index) /* index isn't zeroed, no need to lock */ + #define h_itoh(hostindex) (hosttableptrs[(hostindex)>>h_HTSHIFT]+((hostindex)&(h_HTSPERBLOCK-1))) + +diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c +index 2d7cd60..69d902f 100644 +--- a/src/vol/fssync-server.c ++++ b/src/vol/fssync-server.c +@@ -79,9 +79,6 @@ + #endif /* USE_UNIX_SOCKETS */ + + #ifdef FSSYNC_BUILD_SERVER +- +-int (*V_BreakVolumeCallbacks) (VolumeId volume); +- + #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that + * move = dump+restore can run on single server */ + #define MAXOFFLINEVOLUMES 128 /* This needs to be as big as the maximum +diff --git a/src/vol/volume.c b/src/vol/volume.c +index f1ff10a..3d9e47e 100644 +--- a/src/vol/volume.c ++++ b/src/vol/volume.c +@@ -124,9 +124,6 @@ pthread_cond_t vol_vinit_cond; + int vol_attach_threads = 1; + #endif /* AFS_PTHREAD_ENV */ + +-/* start-time configurable I/O parameters */ +-ih_init_params vol_io_params; +- + #ifdef AFS_DEMAND_ATTACH_FS + pthread_mutex_t vol_salvsync_mutex; + +diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c +index d8600c1..3f5bfc8 100644 +--- a/src/xstat/xstat_cm.c ++++ b/src/xstat/xstat_cm.c +@@ -32,9 +32,8 @@ + int xstat_cm_numServers; /*Num connected servers */ + struct xstat_cm_ConnectionInfo + *xstat_cm_ConnInfo; /*Ptr to connection array */ +-int numCollections; /*Number of data collections */ + struct xstat_cm_ProbeResults xstat_cm_Results; /*Latest probe results */ +-char terminationEvent; /*One-shot termination event */ ++char cm_terminationEvent; /*One-shot termination event */ + + afs_int32 xstat_cmData[AFSCB_MAX_XSTAT_LONGS]; /*Buffer for collected data */ + +@@ -315,8 +314,8 @@ xstat_cm_LWP(void *unused) + */ + if (xstat_cm_debug) + printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn, +- &terminationEvent); +- oneShotCode = LWP_SignalProcess(&terminationEvent); ++ &cm_terminationEvent); ++ oneShotCode = LWP_SignalProcess(&cm_terminationEvent); + if (oneShotCode) + fprintf(stderr, "[%s] Error %d from LWP_SignalProcess()", rn, + oneShotCode); +diff --git a/src/xstat/xstat_cm.h b/src/xstat/xstat_cm.h +index efbba53..569011c 100644 +--- a/src/xstat/xstat_cm.h ++++ b/src/xstat/xstat_cm.h +@@ -86,10 +86,9 @@ struct xstat_cm_ProbeResults { + extern int xstat_cm_numServers; /*# connected servers */ + extern struct xstat_cm_ConnectionInfo + *xstat_cm_ConnInfo; /*Ptr to connections */ +-extern int numCollections; /*Num data collections */ + extern struct xstat_cm_ProbeResults + xstat_cm_Results; /*Latest probe results */ +-extern char terminationEvent; /*One-shot termination event */ ++extern char cm_terminationEvent; /*One-shot termination event */ + + /* + * ------------------------ Exported functions ------------------------ +diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c +index b284237..7c5e568 100644 +--- a/src/xstat/xstat_cm_test.c ++++ b/src/xstat/xstat_cm_test.c +@@ -881,8 +881,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock) + */ + if (debugging_on) + printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT +- "\n", rn, &terminationEvent); +- waitCode = LWP_WaitProcess(&terminationEvent); ++ "\n", rn, &cm_terminationEvent); ++ waitCode = LWP_WaitProcess(&cm_terminationEvent); + if (debugging_on) + printf("[%s] Returned from LWP_WaitProcess()\n", rn); + if (waitCode) { +diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c +index 51dbe38..dff9304 100644 +--- a/src/xstat/xstat_fs.c ++++ b/src/xstat/xstat_fs.c +@@ -33,9 +33,8 @@ + int xstat_fs_numServers; /*Num connected servers */ + struct xstat_fs_ConnectionInfo + *xstat_fs_ConnInfo; /*Ptr to connection array */ +-int numCollections; /*Number of data collections */ + struct xstat_fs_ProbeResults xstat_fs_Results; /*Latest probe results */ +-char terminationEvent; /*One-shot termination event */ ++char fs_terminationEvent; /*One-shot termination event */ + + afs_int32 xstat_fsData[AFS_MAX_XSTAT_LONGS]; /*Buffer for collected data */ + +@@ -334,8 +333,8 @@ xstat_fs_LWP(void *unused) + */ + if (xstat_fs_debug) + printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn, +- &terminationEvent); +- oneShotCode = LWP_SignalProcess(&terminationEvent); ++ &fs_terminationEvent); ++ oneShotCode = LWP_SignalProcess(&fs_terminationEvent); + if (oneShotCode) + fprintf(stderr, "[%s] Error %d from LWP_SignalProcess()", rn, + oneShotCode); +diff --git a/src/xstat/xstat_fs.h b/src/xstat/xstat_fs.h +index 6e2b77b..a800ba6 100644 +--- a/src/xstat/xstat_fs.h ++++ b/src/xstat/xstat_fs.h +@@ -87,10 +87,9 @@ struct xstat_fs_ProbeResults { + extern int xstat_fs_numServers; /*# connected servers */ + extern struct xstat_fs_ConnectionInfo + *xstat_fs_ConnInfo; /*Ptr to connections */ +-extern int numCollections; /*Num data collections */ + extern struct xstat_fs_ProbeResults + xstat_fs_Results; /*Latest probe results */ +-extern char terminationEvent; /*One-shot termination event */ ++extern char fs_terminationEvent; /*One-shot termination event */ + + /* + * ------------------------ Exported functions ------------------------ +diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c +index 853c212..d58ecf0 100644 +--- a/src/xstat/xstat_fs_test.c ++++ b/src/xstat/xstat_fs_test.c +@@ -778,8 +778,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *dummy) + */ + if (debugging_on) + printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT "\n", rn, +- &terminationEvent); +- waitCode = LWP_WaitProcess(&terminationEvent); ++ &fs_terminationEvent); ++ waitCode = LWP_WaitProcess(&fs_terminationEvent); + if (debugging_on) + printf("[%s] Returned from LWP_WaitProcess()\n", rn); + if (waitCode) { diff --git a/debian/patches/0006-afsmonitor-remove-unused-LWP_WaitProcess.patch b/debian/patches/0006-afsmonitor-remove-unused-LWP_WaitProcess.patch new file mode 100644 index 000000000..c82b3ed8f --- /dev/null +++ b/debian/patches/0006-afsmonitor-remove-unused-LWP_WaitProcess.patch @@ -0,0 +1,74 @@ +From: Michael Meffie +Date: Mon, 9 Oct 2017 22:16:09 -0400 +Subject: afsmonitor: remove unused LWP_WaitProcess + +Remove the unimplemented once-only flag and the unused LWP_WaitProcess +call. + +Reviewed-on: https://gerrit.openafs.org/12745 +Tested-by: BuildBot +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 7c27365ea24aed5787f6fc03f30f6085c78ece51) + +Change-Id: I3b61f9fb4f45564304b0e35878d3535a10e31d02 +Reviewed-on: https://gerrit.openafs.org/14226 +Reviewed-by: Andrew Deason +Reviewed-by: Michael Meffie +Reviewed-by: Mark Vitale +Tested-by: BuildBot +Reviewed-by: Stephan Wiesand +(cherry picked from commit d5fc5283e91ea94a67df8364a5b8bf8970ffe934) +--- + src/afsmonitor/afsmonitor.c | 18 ------------------ + 1 file changed, 18 deletions(-) + +diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c +index e7b3030..a6a9e97 100644 +--- a/src/afsmonitor/afsmonitor.c ++++ b/src/afsmonitor/afsmonitor.c +@@ -56,7 +56,6 @@ int afsmon_debug = 0; /* debug info to file ? */ + FILE *debugFD; /* debugging file descriptor */ + static int afsmon_output = 0; /* output to file ? */ + static int afsmon_detOutput = 0; /* detailed output ? */ +-static int afsmon_onceOnly = 0; /* probe once only ? (not implemented) */ + int afsmon_probefreq; /* probe frequency */ + static int wpkg_to_use; /* graphics package to use */ + static char output_filename[80]; /* output filename */ +@@ -3794,8 +3793,6 @@ afsmon_execute(void) + } + + FSinitFlags = 0; +- if (afsmon_onceOnly) /* option not provided at this time */ +- FSinitFlags |= XSTAT_FS_INITFLAG_ONE_SHOT; + + if (afsmon_debug) { + fprintf(debugFD, "[ %s ] Calling xstat_fs_Init \n", rn); +@@ -3867,8 +3864,6 @@ afsmon_execute(void) + collIDs[num_cm_collections++] = AFSCB_XSTATSCOLL_FULL_PERF_INFO; + + CMinitFlags = 0; +- if (afsmon_onceOnly) /* once only ? */ +- CMinitFlags |= XSTAT_CM_INITFLAG_ONE_SHOT; + + if (afsmon_debug) { + fprintf(debugFD, "[ %s ] Calling xstat_cm_Init \n", rn); +@@ -3892,19 +3887,6 @@ afsmon_execute(void) + + + /* end of process cache manager entries */ +- /* if only one probe was required setup a waiting process for the +- * termination signal */ +- if (afsmon_onceOnly) { +- code = LWP_WaitProcess(&terminationEvent); +- if (code) { +- if (afsmon_debug) { +- fprintf(debugFD, "LWP_WaitProcess() returned error %d\n", +- code); +- fflush(debugFD); +- } +- afsmon_Exit(135); +- } +- } + + /* start the gtx input server */ + code = (intptr_t)gtx_InputServer(afsmon_win); diff --git a/debian/patches/series b/debian/patches/series index b98825eee..afa015325 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,5 @@ 0005-tests-skip-vos-tests-when-a-vlserver-is-already-runn.patch 0006-tests-do-not-resolve-addresses-in-vos-vl-test.patch 0007-Temporarily-disable-flaky-test.patch +0005-Avoid-duplicate-definitions-of-globals.patch +0006-afsmonitor-remove-unused-LWP_WaitProcess.patch