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: Usage of --recursive multiple times #5027

Closed
TheDcoder opened this issue Jul 3, 2023 · 2 comments
Closed

cp: Usage of --recursive multiple times #5027

TheDcoder opened this issue Jul 3, 2023 · 2 comments
Labels

Comments

@TheDcoder
Copy link
Contributor

It seems GNU coreutils doesn't mind if the user uses the recursive argument multiple times, this leads to incompatibility with our implementation since we reject it:

error: the argument '--recursive' cannot be used multiple times

I found this issue while using this script which calls cp like this:

cp -r "${srcdir}/${_pkg}/"* "${pkgdir}/opt/${_pkgname}" -R

I'm not sure why it's being used like that but it works with GNU coreutils.

This issue might be more widespread as I expect other GNU utils to follow the same lenient behavior regarding arguments which set a flag.

@TheDcoder
Copy link
Contributor Author

Turns out it was just a mistake (and not some obscure feature):

dcelasun commented on 2023-07-03 11:55 (IST)
@TheDcoder it's just a mistake, I'll fix it in the next release. Keep in mind that coreutils (the GNU one) is mandatory for AUR packages. Third party reimplementations are unsupported. It's on them to be compatible with GNU, bug for bug.

I agree with the last statement, we should silently ignore errors like this to maintain compatibility.

sylvestre added a commit to sylvestre/coreutils that referenced this issue Jul 3, 2023
@tertsdiepraam
Copy link
Member

tertsdiepraam commented Jul 3, 2023

Yeah basically all flags in coreutils do this. In clap, we generally fix this by allowing them to override themselves, which should be turned on already. So I'm not sure what's going on there. Good catch!

Maybe this should be used: https://docs.rs/clap/latest/clap/struct.Command.html#method.args_override_self
I'm not sure why it isn't already. There might have been some reason for that

It's on them to be compatible with GNU, bug for bug.

I agree with this too. Keep the bug reports coming and we'll get closer and closer!

cakebaker added a commit that referenced this issue Jul 3, 2023
cp: allow multiple usages of -R - Closes: #5027
cakebaker pushed a commit to NikolaiSch/coreutils that referenced this issue Jul 5, 2023
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

3 participants