File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -369,8 +369,10 @@ mod test {
369
369
fn canonicalization ( ) {
370
370
assert_eq ! ( canonicalize( "/" ) . unwrap( ) , Path :: new( "/" ) ) ;
371
371
assert ! ( canonicalize( "" ) . is_err( ) ) ;
372
- if cfg ! ( any( target_os = "linux" , target_os = "macos" ) ) {
373
- // this test REQUIRES /usr/bin/unxz to be a symlink for /usr/bin/xz
372
+ if cfg ! ( any( target_os = "linux" ) ) {
373
+ // this test REQUIRES /usr/bin/unxz to be a symlink for /usr/bin/xz or /usr/bin/busybox
374
+ assert ! ( Path :: new( "/bin" ) . is_symlink( ) ) ;
375
+ assert ! ( Path :: new( "/usr/bin/unxz" ) . is_symlink( ) ) ;
374
376
assert_eq ! (
375
377
canonicalize( "/usr/bin/unxz" ) . unwrap( ) ,
376
378
Path :: new( "/usr/bin/unxz" )
@@ -381,7 +383,8 @@ mod test {
381
383
Path :: new( "/usr/bin/unxz" )
382
384
) ;
383
385
} else if cfg ! ( target_os = "freebsd" ) {
384
- // this test REQUIRES /usr/bin/pkill to be a symlink for /usr/bin/pgrep
386
+ // this test REQUIRES /usr/bin/pkill to be a symlink
387
+ assert ! ( Path :: new( "/usr/bin/pkill" ) . is_symlink( ) ) ;
385
388
assert_eq ! (
386
389
canonicalize( "/usr/bin/pkill" ) . unwrap( ) ,
387
390
Path :: new( "/usr/bin/pkill" )
Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( not( feature = "sudoedit" ) , allow( dead_code) ) ]
2
+ use std:: collections:: HashSet ;
2
3
use std:: ffi:: { CStr , CString } ;
3
4
use std:: fs:: { DirBuilder , File , Metadata , OpenOptions } ;
4
5
use std:: io:: { self , Error , ErrorKind } ;
@@ -50,10 +51,7 @@ pub(crate) fn sudo_call<T>(
50
51
if cfg ! ( test)
51
52
&& target_user. uid == cur_user_id
52
53
&& target_group. gid == cur_group_id
53
- && target_groups
54
- . iter ( )
55
- . filter ( |x| * * x != target_group. gid )
56
- . eq ( cur_groups. iter ( ) . filter ( |x| * * x != cur_group_id) )
54
+ && target_groups. iter ( ) . collect :: < HashSet < _ > > ( ) == cur_groups. iter ( ) . collect :: < HashSet < _ > > ( )
57
55
{
58
56
// we are not actually switching users, simply run the closure
59
57
// (this would also be safe in production mode, but it is a needless check)
You can’t perform that action at this time.
0 commit comments