mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
tests/chmod: don't make assumptions about umask
`test_chmod_many_options` relied on user's umask not denying read access for anyone. 022, which is the default umask for many, indeed allows read access for everyone. I'm using 027, which disallows read for everyone but owner and group. This made tests fail. Now tests set and reset umask, ensuring checks are run in a reliable, predictable environment.
This commit is contained in:
parent
797281936c
commit
60f6f61ac9
1 changed files with 6 additions and 0 deletions
|
@ -117,10 +117,16 @@ fn test_chmod_ugo_copy() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chmod_many_options() {
|
fn test_chmod_many_options() {
|
||||||
|
let original_umask = unsafe {
|
||||||
|
umask(0)
|
||||||
|
};
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"-r,a+w", TEST_FILE}, before: 0o444, after: 0o222},
|
TestCase{args: vec!{"-r,a+w", TEST_FILE}, before: 0o444, after: 0o222},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
|
unsafe {
|
||||||
|
umask(original_umask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue