From patchwork Tue Sep 26 18:10:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 23161 Received: (qmail 6171 invoked by alias); 26 Sep 2017 18:10:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6160 invoked by uid 89); 26 Sep 2017 18:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=predates, ships, H*RU:sk:zimbra., Hx-spam-relays-external:sk:zimbra. X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH v2 1/2] posix: Add compat glob symbol to not follow dangling symbols To: Adhemerval Zanella , Andreas Schwab Cc: Gnulib bugs , libc-alpha@sourceware.org, bug-make@gnu.org References: <1505745774-29303-1-git-send-email-adhemerval.zanella@linaro.org> <40122a83-2f5f-3d3c-9665-d680e5141cf9@cs.ucla.edu> <834f27ab-310d-c976-207e-683509a5eac1@linaro.org> <93fa2661-dcc1-860d-2f91-d5f528786620@linaro.org> <85e6792f-756b-0077-afb6-96f42c8840a0@cs.ucla.edu> <70a013de-f280-1f28-a11d-24edaa69c0d1@linaro.org> <5670d897-2b84-6a7d-5aa8-cb0045195f05@linaro.org> From: Paul Eggert Message-ID: <8d0ee88e-9c0d-1fa3-e010-cdc95efc2f64@cs.ucla.edu> Date: Tue, 26 Sep 2017 11:10:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <5670d897-2b84-6a7d-5aa8-cb0045195f05@linaro.org> On 09/26/2017 10:24 AM, Adhemerval Zanella wrote: > I see other possible issues that would > need to be fixed as well: > > * FLEXIBLE_ARRAY_MEMBER definition for !__LIBC. > * __glob_pattern_type duplicated prototype. > * __set_errno and mempcpy definition. Thanks for reporting the duplicated prototype; that is a portability issue that I fixed in Gnulib by applying the attached patch to Gnulib master. Gnulib glob.c already handles FLEXIBLE_ARRAY_MEMBER, __set_errno, and mempcpy automatically, because its 'glob' module has the modules 'flexmember', 'libc-config', and 'mempcpy' as prerequisites, and these supply the necessary definitions. You can test Gnulib glob.c's portabililty by running this shell command in Gnulib's top directory: ./gnulib-tool --create-testdir --dir foo glob and then by copying the newly-created 'foo' directory to the platform of your choice and running './configure; make check' there. Gnu Make does not use Gnulib. Instead, it ships an old version of glob.c, which it took directly from glibc in 1999; this all predates Gnulib. If GNU Make ever updates to a more-modern glob.c I suggest that it use the Gnulib glob module, along with that module's prerequisites. I could help do that, if the GNU Make maintainer wants to go that route. [I'll CC: this to bug-make to give its maintainer a heads-up about this libc-alpha discussion, which can be followed from here: https://sourceware.org/ml/libc-alpha/2017-09/msg00972.html ] > I could build gnumake with forced internal glob implementation > (make_cv_sys_gnu_glob=no) with the patch following patch. Looking > gnulib I am not sure if the correct way to use mempcpy for !_LIBC. Sorry, but I'm confused by that patch (quoted below). It is a patch to glibc, so at first I assumed that you applied it to a copy of the glibc source, built a new glibc with it, and then used the newly-built glibc to configure and build GNU Make 4.2.1.  But that assumption cannot be right, since the patch modifies only code that is unused when building glibc. And one cannot simply copy current or patched glibc posix/glob.c into make's lib/glob.c, as (among other things) glibc's posix/glob.c includes when compiled outside of glibc, and GNU Make does not have that include file. So how did you use this patch? > diff --git a/posix/glob.c b/posix/glob.c > index 98122dac88..31e3aba4dd 100644 > --- a/posix/glob.c > +++ b/posix/glob.c > @@ -65,11 +65,15 @@ > # define __stat64(fname, buf) stat (fname, buf) > # define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag) > # define struct_stat64 struct stat > -# ifndef __MVS__ > -# define __alloca alloca > -# endif > +# define __alloca alloca > # define __readdir readdir > +# define FLEXIBLE_ARRAY_MEMBER 0 > # define COMPILE_GLOB64 > +static inline void * > +mempcpy (void *dest, const void *src, size_t n) > +{ > + return memcpy (dest, src, n) + n; > +} > #endif /* _LIBC */ > > #include > @@ -230,8 +234,6 @@ glob_use_alloca (size_t alloca_used, size_t len) > static int glob_in_dir (const char *pattern, const char *directory, > int flags, int (*errfunc) (const char *, int), > glob_t *pglob, size_t alloca_used); > -extern int __glob_pattern_type (const char *pattern, int quote) > - attribute_hidden; > > static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL; > static int collated_compare (const void *, const void *) __THROWNL; > > From 3869eefa5b430ec8b23e71b5f150c6a7d8aacb50 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 26 Sep 2017 11:02:26 -0700 Subject: [PATCH] glob: remove bogus extern decl * lib/glob.c (__glob_pattern_type): Remove now-spurious extern declaration. Problem reported by Adhemerval Zanella in: https://sourceware.org/ml/libc-alpha/2017-09/msg00972.html --- ChangeLog | 7 +++++++ lib/glob.c | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4585cf12b..440b90686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-09-26 Paul Eggert + + glob: remove bogus extern decl + * lib/glob.c (__glob_pattern_type): Remove now-spurious + extern declaration. Problem reported by Adhemerval Zanella in: + https://sourceware.org/ml/libc-alpha/2017-09/msg00972.html + 2017-09-25 Paul Eggert uniname/uniname-tests: integer overflow fix diff --git a/lib/glob.c b/lib/glob.c index 2a5e6642e..9d677d982 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -205,9 +205,6 @@ glob_use_alloca (size_t alloca_used, size_t len) static int glob_in_dir (const char *pattern, const char *directory, int flags, int (*errfunc) (const char *, int), glob_t *pglob, size_t alloca_used); -extern int __glob_pattern_type (const char *pattern, int quote) - attribute_hidden; - static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL; static int collated_compare (const void *, const void *) __THROWNL; -- 2.13.5