From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127799 invoked by alias); 6 Sep 2017 02:01:59 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 127788 invoked by uid 89); 6 Sep 2017 02:01:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 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=reader X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH 1/9] posix: Sync glob with gnulib [BZ #1062] To: Adhemerval Zanella , libc-alpha@sourceware.org References: <1504643122-14874-1-git-send-email-adhemerval.zanella@linaro.org> <1504643122-14874-2-git-send-email-adhemerval.zanella@linaro.org> From: Paul Eggert Message-ID: Date: Wed, 06 Sep 2017 02:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1504643122-14874-2-git-send-email-adhemerval.zanella@linaro.org> Content-Type: multipart/mixed; boundary="------------2F583CBAF324AE387AEFFC57" X-SW-Source: 2017-09/txt/msg00224.txt.bz2 This is a multi-part message in MIME format. --------------2F583CBAF324AE387AEFFC57 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 1008 Adhemerval Zanella wrote: > +/* Any distinct values will do here. > + Undef any existing macros out of the way. */ > +#ifndef DT_UNKNOWN > +# define DT_UNKNOWN 0 > +#endif > +#ifndef DT_DIR > +# define DT_DIR 1 > +#endif > +#ifndef DT_LNK > +# define DT_LNK 2 > +#endif The comment here does not match the code, as nothing is being undeffed. Ins= tead=20 of this change, how about the following? #if !defined _LIBC && !defined HAVE_STRUCT_DIRENT_D_TYPE /* Any distinct values will do here. Undef any existing macros out of the way. */ # undef DT_UNKNOWN # undef DT_DIR # undef DT_LNK # define DT_UNKNOWN 0 # define DT_DIR 1 # define DT_LNK 2 #endif This makes it more clear to the casual reader that this code is for use onl= y=20 outside glibc. Also, it's more robust for hopefully only-hypothetical non-g= libc=20 platforms that define some DT_ symbols but not others, because it guarantee= s=20 their uniqueness in that case. I installed the attached patch into Gnulib, = along=20 these lines. --------------2F583CBAF324AE387AEFFC57 Content-Type: text/x-patch; name="0001-glob-fix-for-use-in-glibc.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-glob-fix-for-use-in-glibc.patch" Content-length: 1382 =46rom e73addd2704d4eb68b126210f5b41b428d5d4956 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 5 Sep 2017 18:58:50 -0700 Subject: [PATCH] glob: fix for use in glibc Problem reported by Adhemerval Zanella in: https://sourceware.org/ml/libc-alpha/2017-09/msg00213.html * lib/glob.c (DT_UNKNOWN, DT_DIR, DT_LINK): Do not redefine if _LIBC. --- ChangeLog | 8 ++++++++ lib/glob.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 351495b..61e3e8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-09-05 Paul Eggert + + glob: fix for use in glibc + Problem reported by Adhemerval Zanella in: + https://sourceware.org/ml/libc-alpha/2017-09/msg00213.html + * lib/glob.c (DT_UNKNOWN, DT_DIR, DT_LINK): + Do not redefine if _LIBC. + 2017-09-02 Paul Eggert =20 glob: fix bugs with long login names diff --git a/lib/glob.c b/lib/glob.c index 8eb2b97..ddab535 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -80,7 +80,7 @@ static const char *next_brace_sub (const char *begin, int= flags) __THROWNL; =20 typedef uint_fast8_t dirent_type; =20 -#ifndef HAVE_STRUCT_DIRENT_D_TYPE +#if !defined _LIBC && !defined HAVE_STRUCT_DIRENT_D_TYPE /* Any distinct values will do here. Undef any existing macros out of the way. */ # undef DT_UNKNOWN --=20 2.7.4 --------------2F583CBAF324AE387AEFFC57--