Repository navigation
chown, chgrp: decide --from on the file that is changed - #15029
abendrothj wants to merge 1 commit into
Conversation
Merging this PR will not alter performance1 warning, 1 note
Comparing Footnotes
|
00aa3e0 to
16019c2
Compare
16019c2 to
0f5b338
Compare
|
this is too large, can we make it smaller? |
0f5b338 to
85bad6f
Compare
|
Split it up. This PR now only has the core change, three files, +247/-32: on Linux, with --from, the operand and each -R entry are held open with O_PATH, checked to be the file that was stat'd and to still pass --from, and changed through that descriptor with |
85bad6f to
99e69ec
Compare
99e69ec to
4b43201
Compare
|
@sylvestre since I split this up on Oct 6, it's only the |
--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.
4b43201 to
63b9cf2
Compare
There was a problem hiding this comment.
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.
|
Binary size comparison: |
--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, a non-directory operand and every -R entry are now held open with O_PATH when --from is given, checked to be the file that was stat'd and to still pass --from, and changed through that descriptor with
fchownat(AT_EMPTY_PATH). A file found replaced is left alone and counts as a failure, which only -v reports, as GNU 9.12 does for operands and under -L/-H. Under -R -P, GNU 9.12 changes the replacement by name; this leaves it alone too, so here it exits 1 where GNU exits 0. Without --from nothing changes.Unreadable directory operands, -R -H symlink targets, -R -v failure lines, -h with -H/-L, the descriptor walk on other platforms and holding the file without O_PATH are in follow-ups: #15124, #15125, #15126, #15127, #15128, #15129.
Part of #15027