Front page | perl.perl5.porters |
Postings from October 2008
[perl #60136] op/groups.t fails when real group name contains blanks
From:
perlbug-followup
Date:
October 26, 2008 16:06
Subject:
[perl #60136] op/groups.t fails when real group name contains blanks
Message ID:
rt-3.6.HEAD-29762-1225043304-646.60136-75-0@perl.org
# New Ticket Created by altblue@fits.ro
# Please include the string: [perl #60136]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60136 >
This is a bug report for perl from altblue@gmail.com,
generated with the help of perlbug 1.39 running under perl 5.11.0.
-----------------------------------------------------------------
[Please describe your issue here]
IMHO Perl version is irrelevant, same thing should happen
with any version, on any operating system that allows spaces
in group names.
Here is a test case and a possible workaround (at least it worked
for me on GNU/Linux):
root:~# echo 'foo bar:x:9999:altblue' >> /etc/groups
altblue:op$ diff -u groups.t groups.t.new
--- groups.t 2008-10-26 18:59:54.000000000 +0200
+++ groups.t.new 2008-10-26 19:13:17.000000000 +0200
@@ -119,7 +119,7 @@
$pwgid = $( + 0;
($pwgnam) = getgrgid($pwgid);
-$seen{$pwgid}++;
+#$seen{$pwgid}++;
print "# pwgid = $pwgid, pwgnam = $pwgnam\n";
@@ -150,7 +150,7 @@
} else {
@basegroup{$pwgid,$pwgnam} = (1,1);
}
-$gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',$groups)));
+$gr2 = join(' ', grep(!$gseen{$_}++, sort split(' ',$groups)));
my $ok1 = 0;
if ($gr1 eq $gr2 || ($gr1 eq '' && $gr2 eq $pwgid)) {
altblue:op$ perl -pi -e 's/^(\s*\@INC)/#$1/' groups.t groups.t.new
altblue:op$ id -gn
wheel
altblue:op$ perl groups.t
# groups = uid=333(altblue) gid=10(wheel) groups=10(wheel),500(ssh),9999(foo bar)
# groups=10(wheel),500(ssh),9999(foo bar)
# g0 = 10(wheel) 500(ssh) 9999(foo bar)
# g1 = wheel ssh foo bar
1..2
# pwgid = 10, pwgnam = wheel
# gr = foo bar ssh
ok 1
ok 2
altblue:op$ perl groups.t.new
# groups = uid=333(altblue) gid=10(wheel) groups=10(wheel),500(ssh),9999(foo bar)
# groups=10(wheel),500(ssh),9999(foo bar)
# g0 = 10(wheel) 500(ssh) 9999(foo bar)
# g1 = wheel ssh foo bar
1..2
# pwgid = 10, pwgnam = wheel
# gr = wheel foo bar ssh wheel
ok 1
ok 2
altblue:op$ newgrp 'foo bar'
altblue:op$ id -gn
foo bar
altblue:op$ perl groups.t
# groups = uid=333(altblue) gid=9999(foo bar) groups=10(wheel),500(ssh),9999(foo bar)
# groups=10(wheel),500(ssh),9999(foo bar)
# g0 = 10(wheel) 500(ssh) 9999(foo bar)
# g1 = wheel ssh foo bar
1..2
# pwgid = 9999, pwgnam = foo bar
# gr = ssh wheel
#gr1 is <ssh wheel>
#gr2 is <bar foo ssh wheel>
not ok 1
ok 2
altblue:op$ perl groups.t.new
# groups = uid=333(altblue) gid=9999(foo bar) groups=10(wheel),500(ssh),9999(foo bar)
# groups=10(wheel),500(ssh),9999(foo bar)
# g0 = 10(wheel) 500(ssh) 9999(foo bar)
# g1 = wheel ssh foo bar
1..2
# pwgid = 9999, pwgnam = foo bar
# gr = foo bar foo bar ssh wheel
ok 1
ok 2
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.11.0:
Configured by altblue at Sun Oct 26 18:52:19 EET 2008.
Summary of my perl5 (revision 5 version 11 subversion 0 patch 34595) configuration:
Platform:
osname=linux, osvers=2.6.18-8.1.14.el5, archname=x86_64-linux-ld
uname='linux cow.fits.ro 2.6.18-8.1.14.el5 #1 smp thu sep 27 19:05:32 edt 2007 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -march=core2 -mtune=core2 -mfpmath=sse -fexceptions -fasynchronous-unwind-tables -Wno-unused -Dcc=gcc -Dmyhostname=localhost -Dperladmin=none -Dprefix=/home/altblue -Dinstallprefix=/home/altblue -Dinstallbin=/home/altblue/bin -Dscriptdir=/home/altblue/bin -Dprivlib=/home/altblue/lib/perl -Darchlib=/home/altblue/lib/perl/x86_64-linux -Dman1dir=/home/altblue/share/man/man1 -Dman3dir=/home/altblue/share/man/man3 -Uusevendorprefix -Dsiteprefix=/home/altblue -Dsitebin=/home/altblue/bin -Dsitescript=/home/altblue/bin -Dsitelib=/home/altblue/lib/perl -Dsitearch=/home/altblue/lib/perl/x86_64-linux -Dsiteman1dir=/home/altblue/share/man/man1 -Dsiteman3dir=/home/altblue/share/man/man3 -Dman3ext=3pm -Darchname=x86_64-linux -Duseshrplib -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Duseperlio -Dinstallusrbinperl=n -Dpager=/usr/bin/le!
ss -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_endprotoent_r_proto -Ud_endservent_r_proto -Ud_sethostent_r_proto -Ud_setprotoent_r_proto -Ud_setservent_r_proto -Ubincompat5005 -Uversiononly -Uafs -Ud_csh -Uusesfio -Uusenm -Dnoextensions=NDBM_File -Ud_dosuid -Dusedevel -Duse64bitint -Duselongdouble -UDEBUGGING'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=define
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -march=core2 -mtune=core2 -mfpmath=sse -fexceptions -fasynchronous-unwind-tables -Wno-unused',
cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.1.2 20071124 (Red Hat 4.1.2-42)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
alignbytes=16, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/altblue/lib/perl/x86_64-linux/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -march=core2 -mtune=core2 -mfpmath=sse -fexceptions -fasynchronous-unwind-tables -Wno-unused -L/usr/local/lib'
Locally applied patches:
DEVEL
---
@INC for perl 5.11.0:
/home/altblue/lib/perl/x86_64-linux
/home/altblue/lib/perl
/home/altblue/lib/perl/x86_64-linux
/home/altblue/lib/perl
.
---
Environment for perl 5.11.0:
HOME=/home/altblue
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/altblue/bin:/usr/local/bin:/bin:/usr/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
-
[perl #60136] op/groups.t fails when real group name contains blanks
by perlbug-followup