Skip to content

fix install test error with user with umask other than 0022 - #12713

Closed
zhw2101024 wants to merge 1 commit into
uutils:mainfrom
zhw2101024:fix_install_test_with_umask_not_0022
Closed

zhw2101024 wants to merge 1 commit into
uutils:mainfrom
zhw2101024:fix_install_test_with_umask_not_0022

Conversation

@zhw2101024

Copy link
Copy Markdown
Contributor

Fixes #11363

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.

@abendrothj

Copy link
Copy Markdown
Contributor

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 install calls umask(0) at startup so ancestor directories always land at exactly 0755, but uutils doesn't, meaning restrictive umasks like 0027 or 0111 produce wrong ancestor modes beyond just the test failure you caught. Filed that as #12714 and opened #12715 to fix both the implementation and replace the probe-based assertions with the correct assert_eq!(0o40_755) checks. Hopefully useful context!

@zhw2101024

Copy link
Copy Markdown
Contributor Author

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 install calls umask(0) at startup so ancestor directories always land at exactly 0755, but uutils doesn't, meaning restrictive umasks like 0027 or 0111 produce wrong ancestor modes beyond just the test failure you caught. Filed that as #12714 and opened #12715 to fix both the implementation and replace the probe-based assertions with the correct assert_eq!(0o40_755) checks. Hopefully useful context!

Excellent work, I'll close this issue and the related PR then.

@zhw2101024 zhw2101024 closed this Jun 8, 2026
@zhw2101024
zhw2101024 deleted the fix_install_test_with_umask_not_0022 branch June 8, 2026 05:38
abendrothj added a commit to abendrothj/coreutils that referenced this pull request Jul 4, 2026
…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
abendrothj added a commit to abendrothj/coreutils that referenced this pull request Aug 17, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install: ancestors_mode_directories_with_file test fails with user with umask other than 022

2 participants