coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

install: create destination file with safer modes before copy

Open nerdroychan opened this issue 11 months ago • 3 comments

This is a followup PR to #6595.

Regarding the unconditional removal of the destination file problem, before this patch, the destination file is removed unconditionally when copy_file is called. Now a healthy check is added, which only removes the destination file if the source file exists and can be opened to read.

Furthermore, this patch uses std::io::copy with file descriptors to avoid the chmod 644 problem in the original patch. This is verified using strace.

A new test case is added as well.

Ping @mjguzik.

nerdroychan avatar Dec 18 '24 19:12 nerdroychan

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Dec 18 '24 20:12 github-actions[bot]

sorry but it needs to be rebased

sylvestre avatar Apr 17 '25 19:04 sylvestre

ping @nerdroychan

RenjiSann avatar Jul 16 '25 18:07 RenjiSann

please reopen when ready

sylvestre avatar Sep 09 '25 21:09 sylvestre