1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-14 19:16:17 +00:00

mkdir: do not change mode of existing directories

This commit is contained in:
Samuel Tardieu 2024-09-07 19:30:02 +02:00 committed by Ben Wiederhake
parent b89a6255a9
commit d627952fc8
2 changed files with 33 additions and 7 deletions

View file

@ -129,6 +129,27 @@ fn test_mkdir_parent_mode_check_existing_parent() {
);
}
#[cfg(not(windows))]
#[test]
fn test_mkdir_parent_mode_skip_existing_last_component_chmod() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("a");
at.mkdir("a/b");
at.set_mode("a/b", 0);
let default_umask: mode_t = 0o160;
ucmd.arg("-p")
.arg("a/b")
.umask(default_umask)
.succeeds()
.no_stderr()
.no_stdout();
assert_eq!(at.metadata("a/b").permissions().mode() as mode_t, 0o40000);
}
#[test]
fn test_mkdir_dup_file() {
let scene = TestScenario::new(util_name!());