Front page | perl.perl5.porters |
Postings from May 2010
Problem with t/op/groups.t
Thread Next
From:
Rainer Tammer
Date:
May 12, 2010 01:02
Subject:
Problem with t/op/groups.t
Message ID:
4BEA6086.5010402@tammer.net
Hello,
there is a problem with the groups.t test on AIX (maint-5.12 / bleed).
On AIX groups.t thinks that "id -Gd" is correct, but it is not.
# id:
uid=0(root) gid=0(system)
groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
# id -a:
usage: id [user]
id -G [-n] [user]
id -g [-nl | -nr] [user]
id -u [-nl | -nr] [user]
# id -Gn
system bin sys security cron audit lp
On Linux man id says:
NAME
id - print real and effective UIDs and GIDs
SYNOPSIS
id [OPTION]... [USERNAME]
DESCRIPTION
Print information for USERNAME, or the current user.
-a ignore, for compatibility with other versions
Is there a problem if we change the groups.t to first use id and the id -a ?
sub _system_groups {
my $cmd;
my $str;
# prefer 'id' over 'groups' (is this ever wrong anywhere?)
# and 'id -a' over 'id -Gn' (the former is good about spaces in
group names)
$cmd = 'id 2>/dev/null';
$str = `$cmd`;
if ( $str && $str =~ /groups=/ ) {
# $str is of the form:
# uid=39957(gsar) gid=22(users)
groups=33536,39181,22(users),0(root),1067(dev)
# AIX: uid=0(root) gid=0(system)
groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
# Linux may also have a context= field
return ( $cmd, $str );
}
$cmd = 'id -a 2>/dev/null';
$str = `$cmd`;
if ( $str && $str =~ /groups=/ ) {
# $str is of the form:
# uid=39957(gsar) gid=22(users)
groups=33536,39181,22(users),0(root),1067(dev)
# FreeBSD since 6.2 has a fake id -a:
# uid=1001(tobez) gid=20(staff) groups=20(staff), 0(wheel),
68(dialer)
#
# Linux may also have a context= field
return ( $cmd, $str );
}
...
Bye
Rainer
Thread Next
-
Problem with t/op/groups.t
by Rainer Tammer