Skip to content

uucore: add DirFd::open_anchor for write-only directories - #15120

Closed
abendrothj wants to merge 1 commit into
uutils:mainfrom
abendrothj:uucore-dirfd-open-anchor
Closed

abendrothj wants to merge 1 commit into
uutils:mainfrom
abendrothj:uucore-dirfd-open-anchor

Conversation

@abendrothj

@abendrothj abendrothj commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Creating entries relative to a directory descriptor fails with EACCES when the directory has write and search permission but no read, because DirFd::open opens it for reading. install -D hits this for leading directories, and ln/cp/mv when replacing entries.

DirFd::open_anchor opens the directory readable and on EACCES retries with O_PATH (Linux, Android) or O_SEARCH (Apple targets, FreeBSD, NetBSD, illumos, Solaris), which is enough for the *at calls. The targets get has_o_path/has_o_search cfg aliases in uucore's build script. If the retry fails, its own error is returned.

Used by #14779 and #15122.

Part of #14778

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.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)

@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 4.8%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
❌ 15 regressed benchmarks
✅ 381 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation five_38_bit_primes 1.5 s 1.8 s -17.84%
❌ Simulation true_consecutive_calls 294.7 ns 350.2 ns -15.86%
❌ Simulation false_consecutive_calls 294.7 ns 350.2 ns -15.86%
❌ Simulation check_sorted_utf8_locale 422.9 ms 492.2 ms -14.09%
❌ Simulation sort_numeric_utf8_locale 36.1 ms 40.7 ms -11.41%
❌ Simulation merge_single_file_utf8_locale 119.3 ms 133.4 ms -10.57%
❌ Simulation tsort_complex_dag[50000] 87.6 ms 97.2 ms -9.79%
❌ Simulation tsort_tree_dag[(10, 3)] 36.5 ms 39.4 ms -7.34%
❌ Simulation tsort_wide_dag[100000] 157.6 ms 167 ms -5.64%
❌ Simulation merge_pre_sorted_files 238.7 ms 252.8 ms -5.59%
❌ Simulation merge_pre_sorted_files_utf8_locale 237.9 ms 251.9 ms -5.54%
❌ Simulation tsort_linear_chain[1000000] 1.9 s 2 s -4.75%
❌ Simulation sort_german_de_locale 282.1 ms 295.1 ms -4.41%
❌ Simulation sort_case_sensitive[500000] 321 ms 334.9 ms -4.15%
❌ Simulation sort_spill_to_tmp_files_utf8_locale 321 ms 332.1 ms -3.34%
⚡ Simulation three_39_bit_primes 901.6 ms 578.3 ms +55.9%
⚡ Simulation sort_dictionary_order[500000] 2.1 s 1.9 s +7.02%
⚡ Simulation rm_recursive_tree 14.4 ms 13.7 ms +5.28%

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-dirfd-open-anchor (028b336) with main (fe26d56)

Open in CodSpeed

Footnotes

  1. 54 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. ↩

Open a directory readable, and on EACCES retry with O_PATH or O_SEARCH,
which anchor *at calls without read access. The targets with either flag
are named by the has_o_path and has_o_search cfg aliases. If the retry
fails, its own error is returned.
@abendrothj
abendrothj force-pushed the uucore-dirfd-open-anchor branch from 991db22 to 028b336 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

Copy link
Copy Markdown
Contributor Author

Landed on main with #14779, so closing.

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.

2 participants