Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.91k stars 542 forks source link

/op/groups.t bug #5570

Closed p5pRT closed 19 years ago

p5pRT commented 22 years ago

Migrated from rt.perl.org#9565 (status was 'resolved')

Searchable as RT9565$

p5pRT commented 22 years ago

From davet@fysh.org

Created by davet@fysh.org

Running Debian woody.

When running as root (I know I shouldn't) op/groups.t fails\, everything else passes. When run as a non-root user it passes.

(apparently this is why it fails) # gr = gdm gdm gdm admins utmp shadow audio cdrom uucp bin

However\, root only appears to be in group gdm once.

gdm​:x​:65534​:root

entire test output​:

# ./op/groups.t # groups = uid=0(root) gid=0(root) # groups=0(root)\,2(bin)\,10(uucp)\,24(cdrom)\,29(audio)\,42(shadow)\,43(utmp)\,1000(admins)\,65534(gdm)\,65534(gdm)\,65534(gdm) # groups=0(root)\,2(bin)\,10(uucp)\,24(cdrom)\,29(audio)\,42(shadow)\,43(utmp)\,1000(admins)\,65534(gdm)\,65534(gdm)\,65534(gdm) # g0 = 0(root) 2(bin) 10(uucp) 24(cdrom) 29(audio) 42(shadow) 43(utmp) # 1000(admins) 65534(gdm) 65534(gdm) 65534(gdm) # g1 = root bin uucp cdrom audio shadow utmp admins gdm gdm gdm 1..2 # pwgid = 0\, pwgnam = root # gr = gdm gdm gdm admins utmp shadow audio cdrom uucp bin #gr1 is \ #gr2 is \ not ok 1 ok 2

Perl Info ``` Flags: category=core severity=low Site configuration information for perl v5.8.0: Configured by davet at Thu Jun 13 10:59:57 BST 2002. Summary of my perl5 (revision 5.0 version 8 subversion 0 patch 17211) configuration: Platform: osname=linux, osvers=2.4.16, archname=i686-linux-thread-multi uname='linux client2 2.4.16 #10 mon dec 31 05:35:55 gmt 2001 i686 unknown ' config_args='-des -Dprefix=/usr/local/bleedperl -Dusethreads -Doptimize=-g -Dusedevel' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: DEVEL17205 @INC for perl v5.8.0: /usr/local/bleedperl/lib/5.8.0/i686-linux-thread-multi /usr/local/bleedperl/lib/5.8.0 /usr/local/bleedperl/lib/site_perl/5.8.0/i686-linux-thread-multi /usr/local/bleedperl/lib/site_perl/5.8.0 /usr/local/bleedperl/lib/site_perl . Environment for perl v5.8.0: HOME=/nethome/davet LANG=C LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/bin/:/nethome/davet/bin:/usr/local/sbin:/sbin:/usr/sbin PERL_BADLANG (unset) SHELL=/bin/bash ----- End forwarded message ----- -- dave thorn | davet@fysh.org ```
p5pRT commented 21 years ago

From jhpb@hekimian.com

Created by jhpb@hekimian.com

The regression test fails with​:

  t/op/grep............................ok   t/op/groups..........................FAILED at test 1   t/op/gv..............................ok

Here is more detailed output from t/op/groups​:

  # ./perl op/groups.t   # groups = uid=0(root) gid=0(root) groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin)   # groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin)   # g0 = 0(root) 1(bin) 2(daemon) 3(sys) 4(adm) 6(disk) 10(wheel) 2015(releases) 1(bin)   # g1 = root bin daemon sys adm disk wheel releases bin   1..2   # pwgid = 0\, pwgnam = root   # gr = bin releases wheel disk adm sys daemon bin   #gr1 is \   #gr2 is \   not ok 1   ok 2

I think the problem may be due to a duplicate entry in our NIS /etc/group map. We have two groups with ID 1\, but with different names. One of the names is "bin".

Perl Info ``` Flags: category=core severity=medium Site configuration information for perl v5.8.0: Configured by root at Fri Mar 7 11:51:08 EST 2003. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.3-6smp, archname=i686-linux-thread-multi uname='linux lnxsrv2 2.4.3-6smp #1 smp wed may 16 04:29:16 edt 2001 i686 unknown ' config_args='-de -Dcf_email=jbuehler@hekimian.com -Dmydomain=.hekimian.com -Dprefix=/usr/local/perl-5.8.0 -Dusethreads -Uusemymalloc -Uinstallusrbinperl -Ui_db -Ui_gdbm -Ui_dbm -Ui_ndbm' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-85)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: @INC for perl v5.8.0: /usr/local/perl-5.8.0/lib/5.8.0/i686-linux-thread-multi /usr/local/perl-5.8.0/lib/5.8.0 /usr/local/perl-5.8.0/lib/site_perl/5.8.0/i686-linux-thread-multi /usr/local/perl-5.8.0/lib/site_perl/5.8.0 /usr/local/perl-5.8.0/lib/site_perl . Environment for perl v5.8.0: HOME=/home/jhpb LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/bin:/usr/bin:/usr/X386/bin:/usr/bin/X11:/usr/sbin:/sbin:/opt/SUNWspro/bin:/usr/bsd:/usr/ucb:/etc:.:/home/jhpb/bin:/home/jhpb/bin/shared:/usr/local/share/bin:/usr/local/bin:/usr/local/bin/shared:/home/ddts/bin:/usr/informix/bin:/usr/afs/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/afsws/bin:/usr/local/bin:/usr/bin/X11:/opt/lrom/bin PERL_BADLANG (unset) SHELL=/bin/ksh ```
p5pRT commented 20 years ago

From yaberger@ca.ibm.com

Hi\,

I'm trying to compile Perl 5.8.3 on AIX 4.3.3. I've getting a test failed. I've some doubt that it's because we're running we DCE but I wasn't getting this test failed in Perl 5.8.2. I've tried to make install but it doesn't either word.

Here is what I've done​:

yaberge2@​info1 ==> ./configure.gnu -Dprefix=/dfs/system/prod/aix/rs_aix433/bin/perl/5.8.3/

yaberge2@​info1 ==> make

yaberge2@​info1 ==> make test

t/op/groups..........................FAILED at test 1

Failed 1 test script out of 792\, 99.87% okay.

yaberge2@​info1 ==> ./perl t/op/groups.t # groups = bromont yaberge2 users/ya projects projects projects projects projects acct-adm subsys/d subsys/d subsys/d subsys/d subsys/d subsys/d 1..2 # pwgid = 0\, pwgnam = system # gr = subsys/d subsys/d subsys/d subsys/d subsys/d subsys/d acct-adm projects projects projects projects projects users/ya yaberge2 bromont #gr1 is \<acct-adm bromont projects projects projects projects projects subsys/d subsys/d subsys/d subsys/d subsys/d subsys/d users/ya yaberge2> #gr2 is \<acct-adm bromont projects subsys/d users/ya yaberge2> not ok 1 ok 2

yaberge2@​info1 ==> make install

Couldn't copy Debug.pm to /dfs/system/prod/aix/rs_aix433/bin/perl/5.8.3/lib/5.8.3/aix/B/Debug.pm​: A file or directory in the path name does not exist. Couldn't chmod 444 /dfs/system/prod/aix/rs_aix433/bin/perl/5.8.3/lib/5.8.3/aix/B/Debug.pm​: A file or directory in the path name does not exist. Can't locate Carp/Heavy.pm in @​INC (@​INC contains​: lib) at lib/Carp.pm line 178. make​: 1254-004 The error code from the last command is 2.

Stop. make​: 1254-004 The error code from the last command is 2.

Stop.

yaberge2@​info1 ==> myconfig Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration​:   Platform​:   osname=aix\, osvers=4.3.3.0\, archname=aix   uname='aix info1 3 4 00058b8f4c00 '   config_args='-ds -e -Dprefix=/dfs/system/prod/aix/rs_aix433/bin/perl/5.8.3/'   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef   use64bitint=undef use64bitall=undef uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='cc'\, ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -q32 -D_LARGE_FILES -qlonglong'\,   optimize=' '\,   cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN'   ccversion='3.6.6.0'\, gccversion=''\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=4321   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=8   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='ld'\, ldflags =' -brtl -L/usr/local/lib -b32'   libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib   libs=-lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lc -lbsd   perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lc -lbsd   libc=/lib/libc.a\, so=a\, useshrplib=false\, libperl=libperl.a   gnulibc_version=''   Dynamic Linking​:   dlsrc=dl_aix.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags=' -bE​:/dfs/system/prod/aix/rs_aix433/bin/perl/5.8.3/lib/5.8.3/aix/CORE/perl.exp'   cccdlflags=' '\, lddlflags=' -bhalt​:4 -bM​:SRE -bI​:$(PERL_INC)/perl.exp -bE​:$(BASEEXT).exp -bnoentry -lc -L/usr/local/lib'

Yannick Bergeron yaberger@​ca.ibm.com Poste 7711

p5pRT commented 19 years ago

From @smpeters

[jhpb@​hekimian.com - Fri Mar 07 11​:03​:22 2003]​:

This is a bug report for perl from jhpb@​hekimian.com\, generated with the help of perlbug 1.34 running under perl v5.8.0.

----------------------------------------------------------------- [Please enter your report here]

The regression test fails with​:

t/op/grep\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.ok
t/op/groups\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.FAILED at test 1
t/op/gv\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.ok

Here is more detailed output from t/op/groups​:

\# \./perl op/groups\.t
\# groups = uid=0\(root\) gid=0\(root\)

groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin) #

groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin) # g0 = 0(root) 1(bin) 2(daemon) 3(sys) 4(adm) 6(disk) 10(wheel) 2015(releases) 1(bin) # g1 = root bin daemon sys adm disk wheel releases bin 1..2 # pwgid = 0\, pwgnam = root # gr = bin releases wheel disk adm sys daemon bin #gr1 is \ #gr2 is \ not ok 1 ok 2

I think the problem may be due to a duplicate entry in our NIS /etc/group map. We have two groups with ID 1\, but with different names. One of the names is "bin".

I was able to reproduce this bug\, although\, only while root. Anyways\, the test does make poor assumptions about the correctness of the data in /etc/group. Patch forthcoming.

p5pRT commented 19 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 19 years ago

From @smpeters

[stmpeters - Tue Jul 05 13​:19​:42 2005]​:

[jhpb@​hekimian.com - Fri Mar 07 11​:03​:22 2003]​:

This is a bug report for perl from jhpb@​hekimian.com\, generated with the help of perlbug 1.34 running under perl v5.8.0.

----------------------------------------------------------------- [Please enter your report here]

The regression test fails with​:

t/op/grep\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.ok
t/op/groups\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.FAILED at test 1
t/op/gv\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.ok

Here is more detailed output from t/op/groups​:

\# \./perl op/groups\.t
\# groups = uid=0\(root\) gid=0\(root\)

groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin)

\#

groups=0(root)\,1(bin)\,2(daemon)\,3(sys)\,4(adm)\,6(disk)\,10(wheel)\,2015(releases)\,1(bin)

\# g0 = 0\(root\) 1\(bin\) 2\(daemon\) 3\(sys\) 4\(adm\) 6\(disk\) 10\(wheel\)

2015(releases) 1(bin) # g1 = root bin daemon sys adm disk wheel releases bin 1..2 # pwgid = 0\, pwgnam = root # gr = bin releases wheel disk adm sys daemon bin #gr1 is \ #gr2 is \ not ok 1 ok 2

I think the problem may be due to a duplicate entry in our NIS /etc/group map. We have two groups with ID 1\, but with different names. One of the names is "bin".

I was able to reproduce this bug\, although\, only while root. Anyways\, the test does make poor assumptions about the correctness of the data in /etc/group. Patch forthcoming.

The problem here is that users can have duplicate group numbers or names in /etc/group. The attached patch will uniquely sort the group names for comparisons.

Inline Patch ```diff --- t/op/groups.t.old 2005-01-21 09:52:53.000000000 -0600 +++ t/op/groups.t 2005-07-13 08:26:49.000000000 -0500 @@ -137,7 +137,9 @@ # Or anybody else who can have spaces in group names. $gr1 = join(' ', grep(!$did{$_}++, sort split(' ', join(' ', ```

@gr)))); } else { - $gr1 = join(' '\, sort @​gr); + # Don't assume that there aren't duplicate groups + my %seen; + $gr1 = join(' '\, sort grep defined $_ && !$seen{$_}++\, @​gr); }

p5pRT commented 19 years ago

From @tux

On Wed\, 13 Jul 2005 06​:51​:45 -0700\, "Steve Peters via RT" \perlbug\-followup@&#8203;perl\.org wrote​:

The problem here is that users can have duplicate group numbers or names in /etc/group. The attached patch will uniquely sort the group names for comparisons.

I applied the patch with small changes\, in patch #25140

%seen was already used for another purpose %did was used in the line above\, but it was not declared I also changed some whitespace issues (stripped from patch below)

Change 25140 by merijn@​merijn-pc09 on 2005/07/13 17​:22​:07

  Subject​: [perl #9565] [PATCH] /op/groups.t bug   From​: "Steve Peters via RT" \perlbug\-followup@&#8203;perl\.org   Date​: Wed\, 13 Jul 2005 06​:51​:45 -0700   Message-ID​: \rt\-3\.0\.11\-9565\-117185\.14\.6331240065229@&#8203;perl\.org

Affected files ...

... //depot/perl/t/op/groups.t#31 edit

Differences ...

==== //depot/perl/t/op/groups.t#31 (xtext) ==== @​@​ -129\,15 +129\,17 @​@​ print "# gr = @​gr\n";

+my %did; if ($^O =~ /^(?​:uwin|cygwin|interix|solaris)$/) {   # Or anybody else who can have spaces in group names.   $gr1 = join(' '\, grep(!$did{$_}++\, sort split(' '\, join(' '\, @​gr)))); } else { - $gr1 = join(' '\, sort @​gr); + # Don't assume that there aren't duplicate groups + $gr1 = join(' '\, sort grep defined $_ && !$did{$_}++\, @​gr); }

if ($Config{myuname} =~ /^cygwin_nt/i) { # basegroup on CYGWIN_NT has id = 0. -->8---

-- H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using Perl 5.6.2\, 5.8.0\, 5.8.5\, & 5.9.2 on HP-UX 10.20\, 11.00 & 11.11\, AIX 4.3 & 5.2\, SuSE 9.2 & 9.3\, and Cygwin. http​://www.cmve.net/~merijn Smoking perl​: http​://www.test-smoke.org\, perl QA​: http​://qa.perl.org reports to​: smokers-reports@​perl.org\, perl-qa@​perl.org

p5pRT commented 19 years ago

@smpeters - Status changed from 'open' to 'resolved'