Skip to content

uucore: share replace_link's atomic replace - #15122

Open
abendrothj wants to merge 2 commits into
uutils:mainfrom
abendrothj:uucore-replace-entry-at
Open

abendrothj wants to merge 2 commits into
uutils:mainfrom
abendrothj:uucore-replace-entry-at

Conversation

@abendrothj

@abendrothj abendrothj commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

replace_link creates a temporary link and renames it over the target. That part moves into DirAnchor, a directory held open where the platform allows, whose replace_existing_entry_at creates the entry through a callback relative to the directory. ln and mv's cross-device move use it next (#15524, #13334).

The parent is now opened search-only (O_PATH on Linux and Android, O_SEARCH on macOS, FreeBSD, NetBSD and illumos), so ln -f/-sf, cp -lf/-sf and mv's cross-device symlink replace an entry in a directory with write and search but no read permission, as with GNU 9.12, instead of failing with EACCES. Without either flag (OpenBSD, Hurd) the directory is still used by path. Running out of temporary names reports a translated error. Tests: test_cp_symlink_force_in_write_search_only_dir, test_symlink_overwrite_force_in_write_search_only_dir, test_hard_link_overwrite_force_in_write_search_only_dir, and a unit test.

Closes #15112

Copilot AI balanced review requested due to automatic review settings October 6, 2026 07:27

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 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.

@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 8.58%

2 warnings, 1 note

⚠️ 123 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 with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

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

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 380 untouched benchmarks
⏩ 92 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation mv_force_overwrite 128.1 ms 156.7 ms -18.24%
❌ CPU Simulation ls_recursive_wide_tree[(10000, 1000)] 66.8 ms 75 ms -10.89%
⚡ CPU Simulation du_wide_tree[(5000, 500)] 15.9 ms 15.2 ms +4.89%

Tip

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


Comparing abendrothj:uucore-replace-entry-at (04efb4f) with main (bbef561)2

Open in CodSpeed

Footnotes

  1. 92 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 (89bd968) during the generation of this report, so bbef561 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@abendrothj
abendrothj force-pushed the uucore-replace-entry-at branch from c7045d6 to b872c65 Compare October 7, 2026 00:54
Copilot AI balanced review requested due to automatic review settings October 7, 2026 00:54

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 uucore-replace-entry-at branch from b872c65 to 5d10e9b Compare October 7, 2026 08:21
Copilot AI balanced review requested due to automatic review settings October 7, 2026 08:21

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 uucore-replace-entry-at branch from 5d10e9b to f5b87ae Compare October 12, 2026 10:05
Copilot AI balanced review requested due to automatic review settings October 12, 2026 10:05

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.

@xtqqczze

Copy link
Copy Markdown
Collaborator

@abendrothj please rebase for a clean history

Comment thread src/uucore/Cargo.toml Resolved
Comment thread src/uucore/src/lib/features/fs.rs Resolved
Comment thread tests/by-util/test_ln.rs Resolved
@abendrothj
abendrothj force-pushed the uucore-replace-entry-at branch from f5b87ae to 8c7924c Compare October 20, 2026 00:27
Copilot AI balanced review requested due to automatic review settings October 20, 2026 00:27

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

Copy link
Copy Markdown
Contributor Author

Rebased onto main and squashed into one commit.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 06:44
@abendrothj
abendrothj force-pushed the uucore-replace-entry-at branch from 8c7924c to 94af8e7 Compare October 22, 2026 06: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.

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.

@sylvestre
sylvestre force-pushed the uucore-replace-entry-at branch from 94af8e7 to 4d02b5c Compare October 25, 2026 08:29
Copilot AI balanced review requested due to automatic review settings October 25, 2026 08:29

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 insufficient remaining quota.

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.

@sylvestre
sylvestre force-pushed the uucore-replace-entry-at branch from 4d02b5c to 70f203b Compare November 5, 2026 08:20
Copilot AI balanced review requested due to automatic review settings November 5, 2026 08:20

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 insufficient remaining quota. Try requesting a review at a lower effort level.

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 force-pushed the uucore-replace-entry-at branch from 70f203b to 4919ab8 Compare November 7, 2026 06:33
Copilot AI balanced review requested due to automatic review settings November 7, 2026 06:33

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 insufficient remaining quota. Try requesting a review at a lower effort level.

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

Copy link
Copy Markdown
Contributor Author

It's two commits again: the unreadable-directory fix, then moving the atomic replace into DirAnchor for ln and mv.

For ln -f/-sf, cp -lf/-sf and mv's cross-device symlink. Without O_PATH
or O_SEARCH (OpenBSD, Hurd) it falls back to the directory's path.
ln and mv's cross-device move use it next. The no-unique-temp-name
error is now translated.
@sylvestre
sylvestre force-pushed the uucore-replace-entry-at branch from 4919ab8 to 04efb4f Compare November 8, 2026 15:48
Copilot AI balanced review requested due to automatic review settings November 8, 2026 15:48

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 insufficient remaining quota. Try requesting a review at a lower effort level.

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.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.31 MB (+64 KB, +0.04%)

Significant per-binary changes:
  printenv     1.09 MB ->    1.15 MB  (+60 KB, +5.36%)

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/env/printenv is no longer failing!

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.

ln, cp: replacing an entry in a write-only directory fails with EACCES

4 participants