File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ use uucore::display::Quotable;
2525use uucore:: entries:: { grp2gid, usr2uid} ;
2626use uucore:: error:: { FromIo , UError , UResult , UUsageError } ;
2727use uucore:: fs:: dir_strip_dot_for_creation;
28- use uucore:: mode:: get_umask;
2928use uucore:: perms:: { Verbosity , VerbosityLevel , wrap_chown} ;
3029use uucore:: process:: { getegid, geteuid} ;
3130#[ cfg( feature = "selinux" ) ]
@@ -339,7 +338,7 @@ fn behavior(matches: &ArgMatches) -> UResult<Behavior> {
339338
340339 let specified_mode: Option < u32 > = if matches. contains_id ( OPT_MODE ) {
341340 let x = matches. get_one :: < String > ( OPT_MODE ) . ok_or ( 1 ) ?;
342- Some ( mode:: parse ( x, considering_dir, get_umask ( ) ) . map_err ( |err| {
341+ Some ( mode:: parse ( x, considering_dir, 0 ) . map_err ( |err| {
343342 show_error ! (
344343 "{}" ,
345344 translate!( "install-error-invalid-mode" , "error" => err)
Original file line number Diff line number Diff line change @@ -243,6 +243,29 @@ fn test_install_mode_symbolic() {
243243 assert_eq ! ( 0o100_003_u32 , PermissionsExt :: mode( & permissions) ) ;
244244}
245245
246+ #[ test]
247+ fn test_install_mode_symbolic_ignore_umask ( ) {
248+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
249+ let dir = "target_dir" ;
250+ let file = "source_file" ;
251+ let mode_arg = "--mode=+w" ;
252+
253+ at. touch ( file) ;
254+ at. mkdir ( dir) ;
255+ ucmd. arg ( file)
256+ . arg ( dir)
257+ . arg ( mode_arg)
258+ . umask ( 0o022 )
259+ . succeeds ( )
260+ . no_stderr ( ) ;
261+
262+ let dest_file = & format ! ( "{dir}/{file}" ) ;
263+ assert ! ( at. file_exists( file) ) ;
264+ assert ! ( at. file_exists( dest_file) ) ;
265+ let permissions = at. metadata ( dest_file) . permissions ( ) ;
266+ assert_eq ! ( 0o100_222_u32 , PermissionsExt :: mode( & permissions) ) ;
267+ }
268+
246269#[ test]
247270fn test_install_mode_failing ( ) {
248271 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
You can’t perform that action at this time.
0 commit comments