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