From owner-freebsd-questions@FreeBSD.ORG Fri Jul 16 19:20:55 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 5FE3A1065785; Fri, 16 Jul 2010 19:20:55 +0000 (UTC) (envelope-from rehsack@googlemail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id ACE8E8FC15; Fri, 16 Jul 2010 19:20:54 +0000 (UTC) Received: by bwz12 with SMTP id 12so1534267bwz.13 for ; Fri, 16 Jul 2010 12:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=ydGxz9hpOg8g3JMXPQJnRj9Zbfi6gFYWz/i3Y2J6weI=; b=ikXIcy9KN3ZAZrJ6Fw6Myed2sDUjT+6b4+fzgtkKN+DmMe+t3kiIdwyqu1BCV5wp6d oi6lZE3KDjZYggUGPhhmPpQS+3chnvA+wCzT2xSMyHfj3YavPviUtGBp8DJF75eB1d+u +F7OryYlY0k1kHMdYAgp9CwRgEyPggqIQZcC8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=JBMVvPKgw5dKFoDM6tcLfpcdinEV5yMnxXL0jBLU5a1GKTK8sXTL2sMLqnyyPu86HT 9r9OSdtBM8xDUDAH3QCGiHzyMtrSa2uPGuxJqaa//Ks0tlokugZJYnu2kd09UT8QtygA 9zFTol3e2Juneb8rTGFYndH7NvF9xPZ0+kTaY= Received: by 10.204.98.148 with SMTP id q20mr1273106bkn.24.1279308053204; Fri, 16 Jul 2010 12:20:53 -0700 (PDT) Received: from waldorf.muppets.liwing.de (p4FF86EBD.dip.t-dialin.net [79.248.110.189]) by mx.google.com with ESMTPS id y27sm12184013bkw.14.2010.07.16.12.20.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 12:20:51 -0700 (PDT) Message-ID: <4C40B105.2040804@netbsd.org> Date: Fri, 16 Jul 2010 19:20:37 +0000 From: Jens Rehsack User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100409 Thunderbird/3.0.4 MIME-Version: 1.0 To: Dan Nelson 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> In-Reply-To: <20100716181316.GH5485@dan.emsphone.com> Content-Type: multipart/mixed; boundary="------------020100060709090703070908" 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: Fri, 16 Jul 2010 19:20:55 -0000 This is a multi-part message in MIME format. --------------020100060709090703070908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 07/16/10 18:13, Dan Nelson wrote: > 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? A simple >>> "/usr/bin/getent group" doesn't return dupes for me. Oddly 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 that >>> easy to read). >> >> Not really a one-liner: >> perl -MData::Dumper -e 'setgrent; my %dupchk; while( my ( $name, $grpass, >> $gid, $members ) = 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/groups and > my LDAP source, but that's expected. The dups I got are not duplicate: $ less /var/yp/group # $FreeBSD: src/etc/group,v 1.19.2.3 2002/06/30 17:57:17 des Exp $ # wheel:*:0:root,trevor staff:*:20:root win32::1001:melanie,sarah os2::1002: dos::1003: unix::1004: music::1005:melanie,sarah gamers::1006: devel::1007:trevor wwwdevel::15000:wwwglobal,trevor All the rest (see attachment) are from /etc/group. Jens --------------020100060709090703070908 Content-Type: text/plain; name="dup-grp.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dup-grp.txt" $VAR1 = [ 'wheel', '*', 0, 'root trevor mel' ]; $VAR1 = [ 'daemon', '*', 1, '' ]; $VAR1 = [ 'kmem', '*', 2, '' ]; $VAR1 = [ 'sys', '*', 3, '' ]; $VAR1 = [ 'tty', '*', 4, '' ]; $VAR1 = [ 'operator', '*', 5, 'root' ]; $VAR1 = [ 'mail', '*', 6, '' ]; $VAR1 = [ 'bin', '*', 7, '' ]; $VAR1 = [ 'news', '*', 8, '' ]; $VAR1 = [ 'man', '*', 9, '' ]; $VAR1 = [ 'games', '*', 13, '' ]; $VAR1 = [ 'ftp', '*', 14, '' ]; $VAR1 = [ 'staff', '*', 20, '' ]; $VAR1 = [ 'sshd', '*', 22, '' ]; $VAR1 = [ 'smmsp', '*', 25, '' ]; $VAR1 = [ 'mailnull', '*', 26, '' ]; $VAR1 = [ 'guest', '*', 31, '' ]; $VAR1 = [ 'bind', '*', 53, '' ]; $VAR1 = [ 'proxy', '*', 62, '' ]; $VAR1 = [ 'authpf', '*', 63, '' ]; $VAR1 = [ '_pflogd', '*', 64, '' ]; $VAR1 = [ '_dhcp', '*', 65, '' ]; $VAR1 = [ 'uucp', '*', 66, '' ]; $VAR1 = [ 'dialer', '*', 68, '' ]; $VAR1 = [ 'network', '*', 69, '' ]; $VAR1 = [ 'audit', '*', 77, '' ]; $VAR1 = [ 'www', '*', 80, '' ]; $VAR1 = [ 'oper', '*', 200, 'root trevor pgsql' ]; $VAR1 = [ 'nogroup', '*', 65533, '' ]; $VAR1 = [ 'nobody', '*', 65534, '' ]; $VAR1 = [ 'messagebus', '*', 556, '' ]; $VAR1 = [ 'polkit', '*', 559, '' ]; $VAR1 = [ 'haldaemon', '*', 560, '' ]; $VAR1 = [ 'avahi', '*', 558, '' ]; $VAR1 = [ 'gdm', '*', 92, '' ]; $VAR1 = [ 'pgsql', '*', 70, '' ]; smmsp is returned more than once (No 2 comes here) $VAR1 = [ 'smmsp', '*', 25, '' ]; guest is returned more than once (No 2 comes here) $VAR1 = [ 'guest', '*', 31, '' ]; authpf is returned more than once (No 2 comes here) $VAR1 = [ 'authpf', '*', 63, '' ]; $VAR1 = [ 'devel', '', 1007, 'trevor' ]; tty is returned more than once (No 2 comes here) $VAR1 = [ 'tty', '*', 4, '' ]; bin is returned more than once (No 2 comes here) $VAR1 = [ 'bin', '*', 7, '' ]; dialer is returned more than once (No 2 comes here) $VAR1 = [ 'dialer', '*', 68, '' ]; $VAR1 = [ 'music', '', 1005, 'trevor melanie sarah' ]; $VAR1 = [ 'ldap', '*', 389, '' ]; kmem is returned more than once (No 2 comes here) $VAR1 = [ 'kmem', '*', 2, '' ]; ftp is returned more than once (No 2 comes here) $VAR1 = [ 'ftp', '*', 14, '' ]; sshd is returned more than once (No 2 comes here) $VAR1 = [ 'sshd', '*', 22, '' ]; proxy is returned more than once (No 2 comes here) $VAR1 = [ 'proxy', '*', 62, '' ]; network is returned more than once (No 2 comes here) $VAR1 = [ 'network', '*', 69, '' ]; nogroup is returned more than once (No 2 comes here) $VAR1 = [ 'nogroup', '*', 65533, '' ]; $VAR1 = [ 'palm', '', 1000, 'trevor' ]; $VAR1 = [ 'mrtg', '*', 279, '' ]; mail is returned more than once (No 2 comes here) $VAR1 = [ 'mail', '*', 6, '' ]; _pflogd is returned more than once (No 2 comes here) $VAR1 = [ '_pflogd', '*', 64, '' ]; nobody is returned more than once (No 2 comes here) $VAR1 = [ 'nobody', '*', 65534, '' ]; $VAR1 = [ 'dhcpd', '*', 900, '' ]; $VAR1 = [ 'win32', '', 1001, 'melanie sarah' ]; daemon is returned more than once (No 2 comes here) $VAR1 = [ 'daemon', '*', 1, '' ]; operator is returned more than once (No 2 comes here) $VAR1 = [ 'operator', '*', 5, 'root' ]; man is returned more than once (No 2 comes here) $VAR1 = [ 'man', '*', 9, '' ]; staff is returned more than once (No 2 comes here) $VAR1 = [ 'staff', '*', 20, 'root' ]; $VAR1 = [ 'os2', '', 1002, '' ]; $VAR1 = [ 'unix', '', 1004, '' ]; wheel is returned more than once (No 2 comes here) $VAR1 = [ 'wheel', '*', 0, 'root trevor mel' ]; news is returned more than once (No 2 comes here) $VAR1 = [ 'news', '*', 8, '' ]; games is returned more than once (No 2 comes here) $VAR1 = [ 'games', '*', 13, '' ]; bind is returned more than once (No 2 comes here) $VAR1 = [ 'bind', '*', 53, '' ]; uucp is returned more than once (No 2 comes here) $VAR1 = [ 'uucp', '*', 66, '' ]; www is returned more than once (No 2 comes here) $VAR1 = [ 'www', '*', 80, '' ]; $VAR1 = [ 'wwwdevel', '', 15000, 'wwwglobal trevor' ]; mailnull is returned more than once (No 2 comes here) $VAR1 = [ 'mailnull', '*', 26, '' ]; _dhcp is returned more than once (No 2 comes here) $VAR1 = [ '_dhcp', '*', 65, '' ]; $VAR1 = [ 'squid', '*', 100, '' ]; $VAR1 = [ 'dos', '', 1003, '' ]; $VAR1 = [ 'cyrus', '*', 60, '' ]; sys is returned more than once (No 2 comes here) $VAR1 = [ 'sys', '*', 3, '' ]; audit is returned more than once (No 2 comes here) $VAR1 = [ 'audit', '*', 77, '' ]; $VAR1 = [ 'pulse-rt', '*', 557, '' ]; $VAR1 = [ 'pulse', '*', 563, '' ]; $VAR1 = [ 'pulse-access', '*', 564, '' ]; --------------020100060709090703070908--