From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7814) id C88F4385781A; Sat, 28 Aug 2021 00:43:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C88F4385781A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Fangrui Song To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] Fix multiple definitions of __nss_*_database (bug 22918) X-Act-Checkin: glibc X-Git-Author: Andreas Schwab X-Git-Refname: refs/heads/google/grte/v5-2.27/master X-Git-Oldrev: 9a219419689b444a0af5d29b5917a5f239f8d6aa X-Git-Newrev: bc7cdeb7f017178e927d6d6ed5374b63758acadf Message-Id: <20210828004350.C88F4385781A@sourceware.org> Date: Sat, 28 Aug 2021 00:43:50 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2021 00:43:50 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bc7cdeb7f017178e927d6d6ed5374b63758acadf commit bc7cdeb7f017178e927d6d6ed5374b63758acadf Author: Andreas Schwab Date: Fri Mar 2 23:07:14 2018 +0100 Fix multiple definitions of __nss_*_database (bug 22918) (cherry picked from commit eaf6753f8aac33a36deb98c1031d1bad7b593d2d) Diff: --- ChangeLog | 10 ++++++++++ NEWS | 1 + nscd/gai.c | 3 +++ nss/nsswitch.c | 2 +- nss/nsswitch.h | 8 ++++---- posix/tst-rfc3484-2.c | 1 + posix/tst-rfc3484-3.c | 1 + posix/tst-rfc3484.c | 1 + 8 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index baff9fa479..8585b90d0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-03-03 Andreas Schwab + + [BZ #22918] + * nss/nsswitch.h (DEFINE_DATABASE): Don't define __nss_*_database. + * nss/nsswitch.c (DEFINE_DATABASE): Define __nss_*_database here. + * nscd/gai.c (__nss_hosts_database): Readd definition. + * posix/tst-rfc3484.c (__nss_hosts_database): Likewise. + * posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise. + * posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise. + 2018-03-01 DJ Delorie [BZ #22342] diff --git a/NEWS b/NEWS index ad425f2c37..d0dfacd264 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ The following bugs are resolved with this release: [22807] PTRACE_* constants missing for powerpc [22818] posix/tst-glob_lstat_compat failure on alpha [22827] RISC-V ELF64 parser mis-reads flag in ldconfig + [22918] multiple common of `__nss_shadow_database' [22919] sparc32: backtrace yields infinite backtrace with makecontext [22926] FTBFS on powerpcspe diff --git a/nscd/gai.c b/nscd/gai.c index d081747797..576fd0045b 100644 --- a/nscd/gai.c +++ b/nscd/gai.c @@ -45,3 +45,6 @@ #ifdef HAVE_LIBIDN # include #endif + +/* Some variables normally defined in libc. */ +service_user *__nss_hosts_database attribute_hidden; diff --git a/nss/nsswitch.c b/nss/nsswitch.c index d5e655974f..b0f0c11a3e 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database, /* Declare external database variables. */ #define DEFINE_DATABASE(name) \ - extern service_user *__nss_##name##_database attribute_hidden; \ + service_user *__nss_##name##_database attribute_hidden; \ weak_extern (__nss_##name##_database) #include "databases.def" #undef DEFINE_DATABASE diff --git a/nss/nsswitch.h b/nss/nsswitch.h index eccb535ef5..63573b9ebc 100644 --- a/nss/nsswitch.h +++ b/nss/nsswitch.h @@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots) #define MAX_NR_ADDRS 48 /* Prototypes for __nss_*_lookup2 functions. */ -#define DEFINE_DATABASE(arg) \ - service_user *__nss_##arg##_database attribute_hidden; \ - int __nss_##arg##_lookup2 (service_user **, const char *, \ - const char *, void **); \ +#define DEFINE_DATABASE(arg) \ + extern service_user *__nss_##arg##_database attribute_hidden; \ + int __nss_##arg##_lookup2 (service_user **, const char *, \ + const char *, void **); \ libc_hidden_proto (__nss_##arg##_lookup2) #include "databases.def" #undef DEFINE_DATABASE diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c index f509534ca9..8c64ac59ff 100644 --- a/posix/tst-rfc3484-2.c +++ b/posix/tst-rfc3484-2.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c index ae44087a10..1c61aaf844 100644 --- a/posix/tst-rfc3484-3.c +++ b/posix/tst-rfc3484-3.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c index 7f191abbbc..8f45848e44 100644 --- a/posix/tst-rfc3484.c +++ b/posix/tst-rfc3484.c @@ -58,6 +58,7 @@ _res_hconf_init (void) #undef USE_NSCD #include "../sysdeps/posix/getaddrinfo.c" +service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */