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