Skip to content

Commit

Permalink
mkdir: correctly set umask so that tests fail without the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhs0506 committed May 22, 2023
1 parent 9e8575d commit 33ac653
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/by-util/test_mkdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn test_mkdir_dup_dir_parent() {
fn test_mkdir_parent_mode() {
let (at, mut ucmd) = at_and_ucmd!();

let default_umask: mode_t = 0o022;
let default_umask: mode_t = 0o160;
let original_umask = unsafe { umask(default_umask) };

ucmd.arg("-p").arg("a/b").succeeds().no_stderr().no_stdout();
Expand Down Expand Up @@ -104,11 +104,11 @@ fn test_mkdir_parent_mode() {
fn test_mkdir_parent_mode_check_existing_parent() {
let (at, mut ucmd) = at_and_ucmd!();

let default_umask: mode_t = 0o022;
let original_umask = unsafe { umask(default_umask) };

at.mkdir("a");

let default_umask: mode_t = 0o160;
let original_umask = unsafe { umask(default_umask) };

ucmd.arg("-p")
.arg("a/b/c")
.succeeds()
Expand All @@ -119,7 +119,7 @@ fn test_mkdir_parent_mode_check_existing_parent() {
// parent dirs that already exist do not get their permissions modified
assert_eq!(
at.metadata("a").permissions().mode() as mode_t,
(!default_umask & 0o777) + 0o40000
(!original_umask & 0o777) + 0o40000
);
assert!(at.dir_exists("a/b"));
assert_eq!(
Expand Down

0 comments on commit 33ac653

Please sign in to comment.