Repository navigation
chown, chgrp: keep -h separate from -H/-L traversal - #15127
Draft
abendrothj wants to merge 6 commits into
Draft
abendrothj wants to merge 6 commits into
abendrothj wants to merge 6 commits into
Conversation
abendrothj
marked this pull request as draft
October 7, 2026 00:21
abendrothj
force-pushed
the
chown-h-with-dereference
branch
from
October 7, 2026 02:27
84a606f to
4a5f167
Compare
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
abendrothj
force-pushed
the
chown-h-with-dereference
branch
2 times, most recently
from
October 12, 2026 11:38
5409d04 to
98a54f0
Compare
abendrothj
force-pushed
the
chown-h-with-dereference
branch
2 times, most recently
from
November 7, 2026 07:21
58cd990 to
2b552a4
Compare
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.
A dangling link under -H or -L, or an unreadable -R operand, got no "failed to change" line from -v.
-R -H/-L -h now descend through a symlinked operand, and -R -L -h changes the links in the tree rather than their targets, as in GNU.
abendrothj
force-pushed
the
chown-h-with-dereference
branch
from
November 8, 2026 23:26
2b552a4 to
9944c37
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #15126; only the last commit is new here.
With -h, -H and -L were also used to decide whether to change links, so
-RHh/-RLhdidn't descend through the operand link, and-RLhchanged link targets instead of the links.Traversal now follows -H/-L, and whether a link or its target is changed follows -h. When a link is changed, an owner or group that wasn't given stays unchanged instead of being copied from the target. A symlink operand is now judged for --from and reported by -v by its target, and so is one met in the tree under -L. As with GNU 9.12, a link that can't be followed fails with "cannot access", a link to a directory that can't be read is left alone, and a dangling link is judged and changed as itself. The -v text still differs from GNU as on main (unrequested IDs printed, operand before descendants).
Tests:
test_chown_h_judges_symlink_operand_on_its_target,test_chown_big_l_with_h_judges_from_on_link_target,test_chown_h_changes_symlink_operand_itself,test_chown_h_keeps_unchanged_group_of_symlink_operand,test_chown_h_changes_dangling_symlink_operand,test_chown_h_fails_on_symlink_loop_operand,test_chown_h_leaves_link_to_unreadable_dir,test_chown_big_l_with_h_changes_symlinks_in_tree.Closes #15116