From owner-freebsd-questions@FreeBSD.ORG Thu Jul 15 17:26:20 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 906D3106566B for ; Thu, 15 Jul 2010 17:26:20 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 3865B8FC0A for ; Thu, 15 Jul 2010 17:26:19 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o6FHQGIL099232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 15 Jul 2010 12:26:16 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o6FHQGcP035485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 15 Jul 2010 12:26:16 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o6FHQFZS035484; Thu, 15 Jul 2010 12:26:15 -0500 (CDT) (envelope-from dan) Date: Thu, 15 Jul 2010 12:26:15 -0500 From: Dan Nelson To: Jens Rehsack Message-ID: <20100715172615.GC5485@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 8.1-PRERELEASE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Thu, 15 Jul 2010 12:26:16 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: 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, 15 Jul 2010 17:26:20 -0000 In the last episode (Jul 15), Jens Rehsack said: > Hi all, > > I detected an issue with getpwent on my FreeBSD test box: > > perl -MData::Dumper -e 'my @e = getpwent(); print Dumper(\@e); endpwent(); @e = getpwent(); print Dumper(\@e); endpwent(); @e = getpwent(); print Dumper(\@e); endpwent();' > $VAR1 = [ 'root', '', 0, 0, 0, '', 'Charlie &', '/root', '/bin/csh', 0 ]; > $VAR1 = [ 'toor', '*', 0, 0, 0, '', 'Bourne-again Superuser', '/root', '', 0 ]; > $VAR1 = [ 'daemon', '*', 1, 1, 0, '', 'Owner of many system processes', '/root', '/usr/sbin/nologin', 0 ]; > > I'm using FreeBSD waldorf.muppets.liwing.de 7.3-PRERELEASE FreeBSD 7.3-PRERELEASE #0: Fri Mar 12 11:31:18 UTC 2010 root@waldorf.muppets.liwing.de:/usr/obj/usr/src/sys/WALDORF amd64 The above output looks perfect, and should match the top three lines in your /etc/passwd files. > The correct output should be (taken from a NetBSD system): > perl -MData::Dumper -e 'my @e = getpwent(); print Dumper(\@e); endpwent(); @e = getpwent(); print Dumper(\@e); endpwent(); @e = getpwent(); print Dumper(\@e); endpwent();' > $VAR1 = [ 'root', '*', 0, 0, 0, '', 'Charlie &', '/root', '/bin/ksh', 0 ]; > $VAR1 = [ 'root', '*', 0, 0, 0, '', 'Charlie &', '/root', '/bin/ksh', 0 ]; > $VAR1 = [ 'root', '*', 0, 0, 0, '', 'Charlie &', '/root', '/bin/ksh', 0 ]; This output looks wrong, unless NetBSD has three identical root lines at the top of its passwd file. > Taking a look to > http://www.cpantesters.org/distro/D/DBD-Sys.html#DBD-Sys-0.01, this > issue is not limited to FreeBSD 7.3 - it occures on FreeBSD 7.2 and > 8.0, too. I see a bunch of failed FreeBSD test lines, but I don't see anything relating to getpwent or getreant in the test failure output. Just lines like "Parse errors: Bad plan. You planned 16 tests but ran 12" -- Dan Nelson dnelson@allantgroup.com