Repository navigation
fix install test error with user with umask other than 0022 - #12713
zhw2101024 wants to merge 1 commit into
Conversation
|
GNU testsuite comparison: |
|
Thanks for digging into this and opening a fix! While looking at this issue more closely, it turns out there's also an underlying implementation bug: GNU |
Excellent work, I'll close this issue and the related PR then. |
…xact 0755 GNU install calls umask(0) early in main() so that ancestor directories created by -D/-d always get exactly DEFAULT_MODE (0755) regardless of the caller's umask. Our implementation passed DEFAULT_MODE to mkdirat / fs::create_dir_all without zeroing umask first, so restrictive umasks (e.g. 0027, 0077, 0111) produced wrong ancestor modes. Changes: - Add zero_umask() to uucore::mode using the existing rustix dependency - Call it at the top of install's uumain (unix only) - Fix the -d code path to use DirBuilder::mode(DEFAULT_MODE) instead of fs::create_dir_all, which defaults to 0777 and would create 0777 ancestors with umask now zeroed - Replace the broken probe-based assertions in two tests with direct assert_eq!(0o40_755) checks, matching the GNU-guaranteed value Fixes uutils#12714 Related: uutils#11363, uutils#12713
…xact 0755 GNU install calls umask(0) early in main() so that ancestor directories created by -D/-d always get exactly DEFAULT_MODE (0755) regardless of the caller's umask. Our implementation passed DEFAULT_MODE to mkdirat / fs::create_dir_all without zeroing umask first, so restrictive umasks (e.g. 0027, 0077, 0111) produced wrong ancestor modes. Changes: - Add zero_umask() to uucore::mode using the existing rustix dependency - Call it at the top of install's uumain (unix only) - Fix the -d code path to use DirBuilder::mode(DEFAULT_MODE) instead of fs::create_dir_all, which defaults to 0777 and would create 0777 ancestors with umask now zeroed - Replace the broken probe-based assertions in two tests with direct assert_eq!(0o40_755) checks, matching the GNU-guaranteed value Fixes uutils#12714 Related: uutils#11363, uutils#12713
Fixes #11363