Commit | Line | Data |
fe14fcc3 |
1 | #!./perl |
2 | |
606932fe |
3 | if (! -x ($groups = '/usr/ucb/groups') && |
4 | ! -x ($groups = '/usr/bin/groups') && |
5 | ! -x ($groups = '/bin/groups') && |
6 | ! -x ($groups = '/usr/bin/id') && |
7 | ! -x ($groups = '/bin/id') && |
8 | ! -x ($groups = '/usr/xpg4/bin/id') |
eafe3453 |
9 | ) { |
fe14fcc3 |
10 | print "1..0\n"; |
11 | exit 0; |
12 | } |
13 | |
988174c1 |
14 | print "1..2\n"; |
15 | |
16 | $pwgid = $( + 0; |
17 | ($pwgnam) = getgrgid($pwgid); |
18 | @basegroup{$pwgid,$pwgnam} = (1,1); |
19 | |
20 | $seen{$pwgid}++; |
fe14fcc3 |
21 | |
22 | for (split(' ', $()) { |
23 | next if $seen{$_}++; |
6e21c824 |
24 | ($group) = getgrgid($_); |
25 | if (defined $group) { |
26 | push(@gr, $group); |
27 | } |
28 | else { |
29 | push(@gr, $_); |
30 | } |
fe14fcc3 |
31 | } |
988174c1 |
32 | |
72720e3c |
33 | if ($^O eq "uwin") { |
34 | $gr1 = join(' ', grep(!$did{$_}++, sort split(' ', join(' ', @gr)))); |
35 | } else { |
36 | $gr1 = join(' ', sort @gr); |
37 | } |
988174c1 |
38 | |
606932fe |
39 | $groups .= ' -Gn' if $groups =~ m:/id$:; |
40 | |
85fe63ca |
41 | $gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',`$groups`))); |
988174c1 |
42 | |
43 | if ($gr1 eq $gr2) { |
44 | print "ok 1\n"; |
45 | } |
46 | else { |
47 | print "#gr1 is <$gr1>\n"; |
48 | print "#gr2 is <$gr2>\n"; |
49 | print "not ok 1\n"; |
50 | } |
51 | |
52 | # multiple 0's indicate GROUPSTYPE is currently long but should be short |
53 | |
54 | if ($pwgid == 0 || $seen{0} < 2) { |
55 | print "ok 2\n"; |
56 | } |
57 | else { |
58 | print "not ok 2 (groupstype should be type short, not long)\n"; |
59 | } |