Skip to content

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

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

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

Conversation

@abendrothj

@abendrothj abendrothj commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Based on #15124; only the last commit is new here.

On Linux, 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 with --from held for the change. A link whose target can't be stat'd is reported ("cannot dereference") and left alone, as with GNU 9.12. Tests: test_chown_from_judges_symlink_target_under_big_h, test_chown_dangling_symlink_under_big_h.

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 not alter performance

1 warning

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

✅ 104 untouched benchmarks
⏩ 371 skipped benchmarks1


Comparing abendrothj:chown-from-symlink-target (2375b5c) with main (bbef561)

Open in CodSpeed

Footnotes

  1. 371 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 3 times, most recently from 2b8bc49 to 8934ad8 Compare October 12, 2026 11:38
@sylvestre

Copy link
Copy Markdown
Contributor

sorry but it needs to be rebased

Comment thread src/uucore/src/lib/features/perms.rs Resolved
Comment thread tests/by-util/test_chown.rs Resolved
@abendrothj
abendrothj force-pushed the chown-from-symlink-target branch from 8934ad8 to 41e42e0 Compare November 7, 2026 06:33
The error itself stays on stderr, as in GNU. On Linux, files below a -R
operand now get the line too.
On Linux the file is held with O_PATH, rechecked and changed through
that descriptor, so a rename after the check no longer redirects it.
On Linux it was skipped without a message; it is now changed by name,
or held with O_PATH under --from. -R still leaves it alone, as in GNU.
--from and -v used the link's owner, not the target that is changed.
A link whose target cannot be stat'd is now reported and left alone.
@abendrothj
abendrothj force-pushed the chown-from-symlink-target branch from 41e42e0 to 2375b5c Compare November 8, 2026 23:26

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.

3 participants