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 degrade performance by 22.03%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | three_39_bit_primes |
583.2 ms | 846.7 ms | -31.12% |
| ❌ | Simulation | five_38_bit_primes |
1.6 s | 1.8 s | -11.75% |
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-by-fd (4b43201) with main (6292c03)
Footnotes
-
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. ↩
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
--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.
99e69ec to
4b43201
Compare
--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