Skip to content

install: name the directory component that could not be created - #14772

Open
abendrothj wants to merge 1 commit into
uutils:mainfrom
abendrothj:fix/install-create-dir-error-component
Open

abendrothj wants to merge 1 commit into
uutils:mainfrom
abendrothj:fix/install-create-dir-error-component

Conversation

@abendrothj

@abendrothj abendrothj commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

install named the whole leading-directory path instead of the component that failed, and with -D gave no reason at all:

install -D f dangling/sub/f   cannot create directory 'dangling/sub'
install -d dangling/sub       cannot create directory 'dangling/sub': File exists
GNU, both cases               cannot create directory 'dangling': File exists

create_dir_all_safe now returns the failing prefix along with its error, and the ancestor search no longer stops at a path it can't stat (below a file, through a symlink loop, inside an unsearchable directory), so the step that fails names it. A name that exists but can't be descended into reports EEXIST when it doesn't resolve (ELOOP for a symlink loop) and ENOTDIR when it resolves to a non-directory, which is what GNU prints. When the parent of the failing component can't be searched at all, that parent is named instead - the difference between r--/x, which GNU reports as r--, and r-x/x, which it reports as r-x/x. The message string gained a place for the errno.

Checked on Linux against GNU 9.12: the messages match in 28 of 31 -D, -d and -D -t cases (main: 9), not counting GNU's curly quotes for -d. The three that differ also differ on main: trailing-slash targets (-D f regular/sub/, -D f dangling/sub/) and an existing parent without search permission (-D f r--/f).

Closes #14995

Copilot AI lite review requested due to automatic review settings September 21, 2026 06:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@abendrothj

Copy link
Copy Markdown
Contributor Author

Conflicts with #12715 in the two -d hunks. Whichever lands second resolves to with_umask(0, || create_dir_all_safe(&path_to_create, DEFAULT_MODE)) with show!(InstallError::CreateDirFailed(e.path, e.error)).

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/tail/follow-name is no longer failing!
Congrats! The gnu test tests/tail/pid-pipe is no longer failing!

Copilot AI review requested due to automatic review settings September 21, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI lite review requested due to automatic review settings October 1, 2026 01:16
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from e0c8f96 to f088cbd Compare October 1, 2026 01:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 High severity · 3 Medium severity

Open (4)

Copilot AI lite review requested due to automatic review settings October 1, 2026 02:02
@codspeed

codspeed Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 5.18%

1 warning, 1 note

⚠️ 120 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 4 improved benchmarks
❌ 3 regressed benchmarks
✅ 406 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation socket_addrs_direct[100000] 104.8 µs 131.4 µs -20.25%
❌ CPU Simulation hostname_ip_lookup[100000] 155.7 µs 184 µs -15.38%
❌ CPU Simulation split_number_chunks_round_robin 28.9 ms 32.8 ms -11.82%
⚡ CPU Simulation du_deep_tree[(100, 3)] 1.8 ms 1.7 ms +4.96%
⚡ CPU Simulation cksum_raw_output 34.2 ms 33.1 ms +3.36%
⚡ CPU Simulation cksum_crc 34.2 ms 33.1 ms +3.36%
⚡ CPU Simulation cksum_multiple_files 51.1 ms 49.5 ms +3.27%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing abendrothj:fix/install-create-dir-error-component (b4debb8) with main (293a724)2

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (e1b90fa) during the generation of this report, so 293a724 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

install -d still reports the full path for nested failures, and permission-sensitive naming cases lack regression coverage.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity

Open (3)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Report the failing path component for nested mkdir errors

src/​uu/​install/​src/​install.rs:517

install -d still passes the entire path_to_create as the error path, so a nested failure such as install -d dangling/sub (or regular/sub where regular is a file) will continue to report dangling/sub/regular/sub instead of the failing component. Keep the path-based mkdir behavior for write-only parents, but track the component that failed (or add a path-based helper that returns it) before constructing CreateDirFailed.

Comment thread src/uu/install/src/install.rs Resolved
Copilot AI lite review requested due to automatic review settings October 1, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical -t target-validation regression and a moderate safe-traversal issue remain unresolved.

Review effort: Lite
Findings: 2 High severity · 2 Medium severity

Open (4)
Previously missed (1)

In code that hasn't changed since last review

Low severity Add integration coverage for unsearchable parent error paths

src/​uucore/​src/​lib/​features/​safe_traversal.rs:630

The new blame branch is what implements the documented r--/x versus r-x/x distinction, but the added tests only cover a regular file, a dangling symlink, and the successful -d write-only case. Add an integration test for an unsearchable parent (and ideally the loop/read-only error cases described by the PR) so this error-path naming behavior cannot regress.

Comment thread src/uu/install/src/install.rs Resolved
Copilot AI lite review requested due to automatic review settings October 1, 2026 04:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tests/by-util/test_install.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

An outstanding documentation nit and mixed readiness signals warrant human review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Low severity Remove GNU test path reference from PR description

tests/​by-util/​test_install.rs:2891

The PR description references the GNU test path tests/install/basic-1. Please remove that path reference and summarize the observed behavior instead; this repository must not include references to GNU source/test paths.

@abendrothj

Copy link
Copy Markdown
Contributor Author

Rechecked against GNU 9.12 built from the release tarball (9.10 behaves the same): this branch matches GNU in 19 of 24 -D cases. The five that differ are trailing-slash targets (-D f regular/sub/, -D f dangling/sub/), an unreadable existing parent (-D f r--/f), and two -D -t cases that #14999 covers. None of them match on main either. I've corrected the description.

@abendrothj

Copy link
Copy Markdown
Contributor Author

Correction: with the current #12715 this is one hunk in directory(), and with_umask must not be nested there, since install already runs under it. Keep #12715's DirBuilder with DEFAULT_MODE and take this PR's error: show!(InstallError::CreateDirFailed(failed_create_dir_prefix(&path_to_create), e)), keeping the #[cfg(unix)]/#[cfg(not(unix))] split for failed.

Copilot AI lite review requested due to automatic review settings October 7, 2026 11:28
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 2c6213f to 1906102 Compare October 13, 2026 10:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 1906102 to 553bda6 Compare October 16, 2026 08:01
Copilot AI lite review requested due to automatic review settings October 16, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI lite review requested due to automatic review settings October 19, 2026 02:31
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 553bda6 to 4da868f Compare October 19, 2026 02:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@abendrothj
abendrothj marked this pull request as draft October 23, 2026 07:30
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch 2 times, most recently from 0d7846a to 10c11ec Compare November 7, 2026 06:33
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 10c11ec to 95a3792 Compare November 10, 2026 00:23
@abendrothj
abendrothj marked this pull request as ready for review November 10, 2026 00:23
Copilot AI lite review requested due to automatic review settings November 10, 2026 00:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues

Review effort: Lite

Comment thread tests/by-util/test_install.rs Resolved
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 95a3792 to 17f2b25 Compare November 10, 2026 00:51
Copilot AI lite review requested due to automatic review settings November 10, 2026 00:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tests/by-util/test_install.rs Resolved
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from 17f2b25 to d4c76e7 Compare November 11, 2026 02:07
Copilot AI lite review requested due to automatic review settings November 11, 2026 02:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/uu/install/locales/en-US.ftl Resolved
Comment thread tests/by-util/test_install.rs Resolved
-D and -d now name the first component that failed, with its errno,
as GNU does, and `install -D f file/f` says "cannot create directory".
@abendrothj
abendrothj force-pushed the fix/install-create-dir-error-component branch from d4c76e7 to b4debb8 Compare November 19, 2026 07:25
Copilot AI lite review requested due to automatic review settings November 19, 2026 07:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/uu/install/src/install.rs Resolved

This branch has not been deployed

No deployments
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: error names the whole leading path instead of the failing component

4 participants