File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ sub Test {
5151 my %basegroup = basegroups( $pwgid , $pwgnam );
5252 my @extracted_supplementary_groups = remove_basegroup( \ %basegroup , \ @extracted_groups );
5353
54- plan 2 ;
54+ plan 3 ;
5555
5656
5757 # Test: The supplementary groups in $( should match the
@@ -121,6 +121,26 @@ sub Test {
121121 $gid_count -> {0 } //= 0;
122122 ok 0 == $pwgid || $gid_count -> {0 } < 2, " groupstype should be type short, not long" ;
123123
124+ SKIP: {
125+ # try to add a group as supplementary group
126+ my $root_uid = 0;
127+ skip " uid!=0" , 1 if $< != $root_uid and $> != $root_uid ;
128+ my @groups = split ' ' , $) ;
129+ my @sup_group ;
130+ setgrent ;
131+ while (my @ent = getgrent ) {
132+ next if grep { $_ == $ent [2] } @groups ;
133+ @sup_group = @ent ;
134+ last ;
135+ }
136+ endgrent ;
137+ skip " No group found we could add as a supplementary group" , 1
138+ if (!@sup_group );
139+ $) = " $) @sup_group [2]" ;
140+ my $ok = grep { $_ == $sup_group [2] } split ' ' , $) ;
141+ ok $ok , " Group `$sup_group [0]' added as supplementary group" ;
142+ }
143+
124144 return ;
125145}
126146
You can’t perform that action at this time.
0 commit comments