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