Skip to content

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

Closed

Description

@zhw2101024

After commit 0c41299 from PR #10140 , the test_install_ancestors_mode_directories_with_file test don't pass on my local environment.
Maybe related to the system I'm using, which is built from the LFS book, or related to the btrfs file system containing my local uutils repository.
EDIT:
This issue seems related with the default umask of my user, which is 002 by default.
The test assumes the directory created by install --mode=200 -D have the same permission with mkdir, but it's not true with the GNU install command.

Activity

  1. changed the title [-]install: regression after[/-] [+]install: regression after the commit to prevent symlink race condition[/+] on Mar 17, 2026
  2. zhw2101024 commented on Mar 18, 2026

    @zhw2101024
    ContributorAuthor

    I can confirm that the test passes when running with the root user, but fails when running with a regular user.

  3. zhw2101024 commented on May 26, 2026

    @zhw2101024
    ContributorAuthor

    While the PR #11505 has been merged, the test still fails when running with user other than root.

  4. changed the title [-]install: regression after the commit to prevent symlink race condition[/-] [+]install: ancestors_mode_directories_with_file test fails with user with umask other than 022[/+] on Jun 8, 2026
  5. abendrothj commented on Sep 21, 2026

    @abendrothj
    Contributor

    Sorry for the long silence here.

    You were right. GNU creates the parent directories for -d and -D at exactly 0755, independent of the umask — the manual states it for -d ("Parent directories are created with mode u=rwx,go=rx (755), regardless of the -m option or the current umask"), and I verified it against GNU 9.12, the version pinned in util/fetch-gnu.sh, at umasks 022, 027, 077, 002 and 111.

    We were passing 0755 to mkdir(2), so the kernel still subtracted the umask: ancestors came out 0700 under 077 and 0750 under 027. The test hid that because it compared the ancestors against a probe directory created with mkdir(2) at 0777, which also lands on 0755 under the usual 022 but on 0775 under your 002. Running as root passes for the same accidental reason, not because the mode was right.

    #12715 clears the umask around the ancestor creation and drops the probe. The tests now run under umask 077 and assert 0755 on the ancestors, with --mode applying only to the target, so this stays fixed for people whose umask isn't 022.

  6. lsahn-gh commented on Oct 24, 2026

    @lsahn-gh

    Anyway, the test must be fixed to use a fixed value: 755, no matter what umask is.
    Compare the default permission with a directory made by mkdir is obviously not a good idea. because mkdir is affected by umask whereas -D should be against that.

    PR for that, #15710.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions