Repository navigation
cp: create removed destinations exclusively - #15330
abendrothj wants to merge 1 commit into
Conversation
Merging this PR will degrade performance by 3.15%3 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
8270ad8 to
be468b3
Compare
be468b3 to
9d7881e
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.
|
sorry but it needs to be rebased |
9d7881e to
0078890
Compare
0078890 to
fda8bd0
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
|
Rebased, thanks! I also tightened the description while I was at it. |
fda8bd0 to
abcb48f
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
cp and mv's cross-device copy create a removed or missing destination with O_EXCL, as GNU does; on macOS streamed ones are created 0600.
abcb48f to
cd03ce5
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
Closes #15329
When the destination was missing, or cp had just removed it (
--remove-destination,-fon a read-only file,--backupof a symlink), cp created the new file withoutO_EXCL: anything that appeared at that name in between was opened, and a symlink was followed.cp now creates the file exclusively in those cases and fails if something is there, with GNU 9.12's messages; a destination overwritten in place is opened as before. uucore's
create_dest_restrictivetakesExistingDest::{Truncate, Refuse}instead ofnofollow. Its onlynofollowcaller, mv's cross-device fallback, now creates exclusively too. On macOS a streamed destination is now created at 0600, as on Linux.The new test holds cp between the removal and the create with a FIFO source, and fails without the change on Linux and macOS.
util/check-safe-traversal.shchecks that--remove-destinationcreates a regular file withO_EXCL, and that mv's create uses it. The missing-destination case can't be held there and relies on the uucore unit tests. With--backup, a refused create leaves the backup in place instead of restoring it as GNU does (#16240).--attributes-onlycreates exclusively on every platform. The Windows and WASI data copy still usesfs::copy; a follow-up will useCopyFileExWwithCOPY_FILE_FAIL_IF_EXISTSandcreate_new.