From 60f6f61ac99b8f2a6bf5911cc02cb534e71eb019 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Sun, 18 Dec 2016 15:35:30 +0300 Subject: [PATCH] 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. --- tests/test_chmod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_chmod.rs b/tests/test_chmod.rs index b7f0e8e8c..0695b541e 100644 --- a/tests/test_chmod.rs +++ b/tests/test_chmod.rs @@ -117,10 +117,16 @@ fn test_chmod_ugo_copy() { #[test] fn test_chmod_many_options() { + let original_umask = unsafe { + umask(0) + }; let tests = vec!{ TestCase{args: vec!{"-r,a+w", TEST_FILE}, before: 0o444, after: 0o222}, }; run_tests(tests); + unsafe { + umask(original_umask); + } } #[test]