Skip to content

chown, chgrp: judge --from on a symlink's target under -R -H - #15125

Draft
abendrothj wants to merge 3 commits into
uutils:mainfrom
abendrothj:chown-from-symlink-target
Draft

abendrothj wants to merge 3 commits into
uutils:mainfrom
abendrothj:chown-from-symlink-target

Conversation

@abendrothj

Copy link
Copy Markdown
Contributor

With -R -H, a symlink met in the tree was stat'd itself but the change went to the file it points to, so --from was judged on the link's owner, and -v reported the link's owner. GNU 9.12 judges and reports the target.

Under -R -H the target is now stat'd for --from and the report, and held for the change. A dangling link fails as before. Test: test_chown_from_judges_symlink_target_under_big_h.

Based on #15124.

Part of #15027

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

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

Merging this PR will degrade performance by 4.32%

⚠️ 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

⚡ 9 improved benchmarks
❌ 16 regressed benchmarks
✅ 374 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation split_lines 8.5 ms 11.1 ms -23.5%
❌ Simulation split_numeric_suffix 8.7 ms 11.4 ms -23.08%
❌ 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 five_38_bit_primes 1.5 s 1.7 s -13%
❌ Simulation sort_numeric_utf8_locale 36.1 ms 40.7 ms -11.41%
❌ Simulation merge_single_file_utf8_locale 119.3 ms 133.3 ms -10.5%
❌ 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_utf8_locale 237.9 ms 252 ms -5.6%
❌ Simulation merge_pre_sorted_files 238.7 ms 252.6 ms -5.51%
❌ Simulation tsort_linear_chain[1000000] 1.9 s 2 s -4.75%
❌ Simulation sort_german_de_locale 282.1 ms 295 ms -4.4%
❌ Simulation sort_case_sensitive[500000] 321 ms 334.9 ms -4.14%
❌ Simulation sort_spill_to_tmp_files_utf8_locale 321 ms 332.2 ms -3.35%
⚡ Simulation join_french_locale 26.7 ms 24 ms +11.09%
⚡ Simulation join_full_match 26.7 ms 24 ms +11.07%
⚡ Simulation join_partial_overlap 22.1 ms 20.4 ms +8.36%
⚡ Simulation three_39_bit_primes 901.6 ms 833.5 ms +8.17%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

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


Comparing abendrothj:chown-from-symlink-target (2b8bc49) 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. ↩

@abendrothj
abendrothj marked this pull request as draft October 7, 2026 00:20
@abendrothj
abendrothj force-pushed the chown-from-symlink-target branch 2 times, most recently from e512400 to 2b8bc49 Compare October 7, 2026 08:02
--from was checked on a stat of the name and the change was then made
by name, so a rename landing in between changed a file that never had
the required owner.

On Linux, hold the file open with O_PATH, check that it is the one that
was stat'd and still passes --from, and change it through that
descriptor with fchownat(AT_EMPTY_PATH). This covers operands and -R
entries. A file found replaced is left alone; as with GNU, that fails
without a message, and -v reports the change that was not made.
On Linux, a directory operand was changed through a descriptor opened
for reading, and when that open failed it was skipped without a
message. Change it by name then, or through an O_PATH descriptor with
--from, as for any other file. Under -R it is still left alone and the
failure to read it reported, as with GNU.
Under -R -H, a symlink met in the tree was stat'd itself, while the
change went to the file it points to. --from was judged on, and -v
reported, the link's owner. Use the target's, as GNU does.
@abendrothj
abendrothj force-pushed the chown-from-symlink-target branch from 2b8bc49 to 8934ad8 Compare October 12, 2026 11:38

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.

2 participants