From patchwork Fri Jul 21 23:17:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 21726 Received: (qmail 9477 invoked by alias); 21 Jul 2017 23:17:52 -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 9031 invoked by uid 89); 21 Jul 2017 23:17:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:74.125.83.68, H*RU:74.125.83.68, 15pm, 15PM X-HELO: mail-pg0-f68.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kBU+yd3uVIAUKMNro5l1uufYY1mxYxhPPIJMX+xahFo=; b=FRI7tHcO4qqu2nd5alXBZDXTVZenof4NB3QbwrsJpa5ccliEmxxaqFYHGaIVPdfOwC BDrX3Njy8iXfcbuomEO+4jCNc5cxIP4T7WDfFE41a8t7rMTiCbR3GXGCZmkEIdKo2+KT x8XkigXQIq1RPF7OgFWI3bkoNw32SEr1rZySlH0lOHjBPUcMVr4Gu1cM1xsuvdTXaOnx 9f9u0HF+ofRqvsz6hwBaAMD2mBi4HqSxDpWkq/xxs3q8YmevxMBgp4n2/JVkMhhhh5SB 84NftBng59cQNqIHH6F8T1j1SedDGv9JrMhDjL9wYUK1aygYudSP5PVIMq9/a1uBaVkk 1vEQ== X-Gm-Message-State: AIVw112bjo80QU9mCxPIGHIcV0mEJ+Gsd+/IcmVoUpFv8cLvciJhlJQ8 ykPdmUqFh+NIOw== X-Received: by 10.98.61.93 with SMTP id k90mr9084124pfa.174.1500679069253; Fri, 21 Jul 2017 16:17:49 -0700 (PDT) Date: Fri, 21 Jul 2017 16:17:47 -0700 From: "H.J. Lu" To: sellcey@cavium.com, DJ Delorie , GNU C Library Subject: Re: [Patch] Fix nss/nss_test1.c compile with latest GCC Message-ID: <20170721231747.GA19787@gmail.com> References: <1500656090.28549.42.camel@cavium.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) On Fri, Jul 21, 2017 at 04:02:15PM -0700, H.J. Lu wrote: > On Fri, Jul 21, 2017 at 9:54 AM, Steve Ellcey wrote: > > On Wed, 2017-07-19 at 19:13 -0400, DJ Delorie wrote: > >> Steve Ellcey writes: > >> > > >> > I think this is due to new error checking added to GCC and in this > >> > case I think that GCC is correct in its error. We should > >> > be using the default_pwd_data in this expression and not pwd_data. > >> Correct, although no existing tests actually use that data, so the > >> bug > >> (and the fix) do not affect test results. > >> > >> > > >> > This patch fixes the proglem, OK for checkin? > >> I was going to check in the same patch... but my rawhide gcc didn't > >> give > >> a warning so I haddn't yet confirmed it. > >> > >> So LGTM :-) > >> > >> Thanks! > > > > Since there haven't seen any objections to this I am going to go ahead > > and check it in. > > > > On Fedora 26, this caused: > > [hjl@gnu-tools-1 build-x86_64-linux]$ nss/tst-nss-test5 > [1] passwd entry 30.name30 had uid 300 > [1] passwd entry 30.name30 had pw_name "name300" (expected "name30") > passwd 300.name300 (*) : 100, *, *, * > > passwd 30.name30 (*) : 100, *, *, * > > [2] passwd pw_name for 200.name200 was (null) > passwd 200.(null) (*) : 100, *, *, * > > passwd 200.name200 (*) : 100, *, *, * > > [3] passwd pw_name for 60.(null) was name60 > passwd 60.name60 (*) : 100, *, *, * > > passwd 60.(null) (*) : 100, *, *, * > > [4] passwd entry 20000.name20000 had gid 200 (expected 100) > passwd 20000.name20000 (*) : 200, *, *, * > > passwd 20000.name20000 (*) : 100, *, *, * > > [5] passwd entry 2.name2 had gid 2 (expected 100) > [5] passwd entry 2.name2 had pw_passwd "x" (expected "*") > [5] passwd entry 2.name2 had pw_gecos "y" (expected "*") > [5] passwd entry 2.name2 had pw_dir "z" (expected "*") > passwd 2.name2 (x) : 2, y, z, * > > passwd 2.name2 (*) : 100, *, *, * > > FAIL: [?] passwd entry 30.name30 unexpected > FAIL: Found 10 errors, expected 9 > [hjl@gnu-tools-1 build-x86_64-linux]$ Remove default_pwd_data fixes the problem for me and all nss tests passed. Is it really needed? H.J. diff --git a/nss/nss_test1.c b/nss/nss_test1.c index 86bbc2c548..47ac21001e 100644 --- a/nss/nss_test1.c +++ b/nss/nss_test1.c @@ -43,25 +43,8 @@ #include "nss_test.h" /* -------------------------------------------------- */ -/* Default Data. */ - -static struct passwd default_pwd_data[] = - { -#define PWD(u) \ - { .pw_name = (char *) "name" #u, .pw_passwd = (char *) "*", .pw_uid = u, \ - .pw_gid = 100, .pw_gecos = (char *) "*", .pw_dir = (char *) "*", \ - .pw_shell = (char *) "*" } - PWD (30), - PWD (100), - PWD (200), - PWD (60), - PWD (20000) - }; -#define default_npwd_data \ - (sizeof (default_pwd_data) / sizeof (default_pwd_data[0])) - -static struct passwd *pwd_data = default_pwd_data; -static int npwd_data = default_npwd_data; +static struct passwd *pwd_data = NULL; +static int npwd_data = 0; static struct group *grp_data = NULL; static int ngrp_data = 0;