Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cp: treat emptystring-file as a regular missing file, not as invocation error #6177

Open
BenWiederhake opened this issue Apr 1, 2024 · 0 comments
Labels

Comments

@BenWiederhake
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants