From owner-freebsd-questions@FreeBSD.ORG Thu Jul 22 05:59:47 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 453F0106564A; Thu, 22 Jul 2010 05:59:47 +0000 (UTC) (envelope-from rehsack@googlemail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 97F9A8FC17; Thu, 22 Jul 2010 05:59:46 +0000 (UTC) Received: by fxm13 with SMTP id 13so4459865fxm.13 for ; Wed, 21 Jul 2010 22:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=eJdt/Tb4woElxzEk3qZ//SgKdVc9lkt5xRxywe3aht0=; b=HgB0yZIObkWxoeC7HOE3rVKRGWFQi4Xoc4JsrM29KjFkl9fdITnSypyvFL6yWnRS/Z 06fHMspMC8sZbdtB+5YbKwpr6yKbPAxRilukqm1xzEYci+V0HLkqjWeY5CxASd/MrREU mdiSvrqZ62YyjsRKY6WzAtOsNpBIIkkaeY4ps= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=mXxJ++5aTl4q1ARgmOt2qT3xfcazrgsHlqE4Qb+Y5wQXORGNi/OrZjJpaNj8FcbRWc xUcZwPq40h9dd3aIgUCAotaQOAZVVA9umzt4kJ1ESAbH+bvB2wsdikqk3Sf6YfDEL0JI hGJIIbliU1WtGd0UQQENoH0znWjRctIq63qDY= MIME-Version: 1.0 Received: by 10.239.164.211 with SMTP id u19mr112931hbd.103.1279778385246; Wed, 21 Jul 2010 22:59:45 -0700 (PDT) Received: by 10.239.190.132 with HTTP; Wed, 21 Jul 2010 22:59:45 -0700 (PDT) In-Reply-To: <20100721200002.GA85432@dan.emsphone.com> References: <20100715172615.GC5485@dan.emsphone.com> <86tyo0qd19.fsf@chateau.d.if> <20100716043056.GF5485@dan.emsphone.com> <20100716150719.GG5485@dan.emsphone.com> <4C408744.3030409@netbsd.org> <20100716181316.GH5485@dan.emsphone.com> <4C470615.8030608@netbsd.org> <20100721200002.GA85432@dan.emsphone.com> Date: Thu, 22 Jul 2010 07:59:45 +0200 Message-ID: From: Jens Rehsack To: Dan Nelson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Ashish SHUKLA , freebsd-questions@freebsd.org Subject: Re: getpwent bug? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2010 05:59:47 -0000 2010/7/21 Dan Nelson : > In the last episode (Jul 21), Jens Rehsack said: >> On 07/16/10 18:13, Dan Nelson wrote: >> >> Hi Dan, >> >> > In the last episode (Jul 16), Jens Rehsack said: >> >> On 07/16/10 15:07, Dan Nelson wrote: >> >>> In the last episode (Jul 16), Jens Rehsack said: >> >>>> Could you please take a look to my other mail (getgrent related) - = there >> >>>> seems another bug ... >> >>> >> >>> Do you have another one-liner that will reproduce it? =A0A simple >> >>> "/usr/bin/getent group" doesn't return dupes for me. =A0Oddly enough= , the >> >>> *grent code doesn't use an internal counter, so the bug you found in >> >>> endpwent doesn't exist in endgrent (afaik; the nsswitch code isn't t= hat >> >>> easy to read). >> >> >> >> Not really a one-liner: >> >> perl -MData::Dumper -e 'setgrent; my %dupchk; while( my ( $name, >> >> $grpass, $gid, $members ) =3D getgrent() ) { print "$name is returned >> >> more than once (No $dupchk{$name} comes here)\n" if( $dupchk{$name}++ >> >> ); print Dumper( [ $name, $grpass, $gid, $members ] ) };' >> >> >> >> setgrent() doesn't work here. >> > >> > I ran that and got dupes for group entries that exist both in /etc/gro= ups and >> > my LDAP source, but that's expected. >> >> You can see here >> http://www.cpantesters.org/cpan/report/f5100ac6-9418-11df-9ebc-c4a68065c= 34d >> the typical error picture. FreeBSD is the only system, where this error >> occurs. > > I don't know how to read perl's test output; what part of that report > failed, and how do you know it was due to getgrent returning duplicate > values? Because I know the error picture - I've seen it on my FreeBSD box first. I probably should add some diag() output for failing tests ... > BTW - I ran your one-liner above on a SLES 10.2 Linux box and a Solaris 1= 0u7 > box, and got duplicate entries where groups existed in both /etc/groups a= nd > LDAP, just like on FreeBSD. =A0I think you may be relying on behaviour th= at > getgrent doesn't guarantee on any OS. But the duplicated entries I get are not duplicated in the source. I sent y= ou my /var/yp/groups file and the output of my one-liner. I have no LDAP setup to try out, but in this case my workaround could be a = good idea. Best regards, Jens