Skip to content

install: ancestor directories respect process umask instead of using fixed 0755 (diverges from GNU) #12714

Description

@abendrothj

Description

When install -D or install -d creates ancestor directories, the process umask still applies to them. GNU install creates ancestor directories at exactly 0755 whatever the caller's umask is.

Impact

Ancestor modes when creating a/b as a non-root user on Linux (uutils main at 2b85f6f, GNU 9.12 built from source):

umask GNU -D and -d uutils install -D f a/b/f uutils install -d a/b (ancestor a)
0022 0755 0755 0755
0002 0755 0755 0775
0027 0755 0750 0750
0077 0755 0700 0700
0111 0755 a is 0644, then cannot create directory 'a/b' a is 0666, then cannot create directory 'a/b': Permission denied

-D starts its ancestors from 0755 and -d from 0777, and the umask is then applied to both. Under umask 0002 (the trigger for #11363) -D happens to give 0755, so that report came from a broken test, but -d diverges there too.

Affected code

  • src/uu/install/src/install.rs: both code paths (directory() line ~498 and standard() line ~687) create ancestor directories without zeroing umask first
  • src/uucore/src/lib/features/safe_traversal.rs: create_dir_all_safe documents that "the actual mode will be modified by the process umask"

Fix

Zero the process umask early in install's uumain (unix only). uucore::mode already uses rustix::process::umask internally for get_umask(); a zero_umask() helper can be exported from there.

Related: #11363, PR #12713

Activity

  1. added a commit that references this issue on Jul 4, 2026
    b5b5e97
  2. added a commit that references this issue on Aug 17, 2026
    28fd25f
  3. abendrothj commented on Oct 1, 2026

    @abendrothj
    ContributorAuthor

    Rechecked against GNU 9.12 built from the release tarball: GNU gives 0755 at every umask in the table. The uutils column was off for -d, which starts from 0777 so 0002 diverges too, and for 0111, where both modes fail outright. I've split the table and replaced the section describing GNU's internals with the observed behavior.

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