coreutils
coreutils copied to clipboard
cp: treat emptystring-file as a regular missing file, not as invocation error
Discovered during #6176. Example:
$ rm -rf target/test/; mkdir target/test/; cp LICENSE "" README.md target/test/; echo "EXITCODE GNU: $?"; ls -l target/test/; echo "(end)"
cp: cannot stat '': No such file or directory
EXITCODE GNU: 1
total 12
-rw-r--r-- 1 user user 1056 Apr 1 21:12 LICENSE
-rw-r--r-- 1 user user 7973 Apr 1 21:12 README.md
(end)
$ rm -rf target/test/; mkdir target/test/; cargo run cp LICENSE "" README.md target/test/; echo "EXITCODE uutils: $?"; ls -l target/test/; echo "(end)"
error: a value is required for '[paths]...' but none was supplied
For more information, try '--help'.
EXITCODE uutils: 1
total 0
(end)
In the above example, GNU cp
tried its best to copy the two reasonably-named files, and reported the emptystring-named file as a regular error. In contrast, uutils cp
refused to even start copying.
I feel like both behaviors are reasonable; but if we want uutils to bee a drop-in replacement, then it should also try its best to copy all files.