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

all: return code for invalid options #3331

Closed
Tracked by #3336
ghost opened this issue Mar 29, 2022 · 8 comments
Closed
Tracked by #3336

all: return code for invalid options #3331

ghost opened this issue Mar 29, 2022 · 8 comments

Comments

@ghost
Copy link

ghost commented Mar 29, 2022

ref: #3320

Edit: Though the below described issue fails the gnu test tests/misc/usage_vs_getopt.sh, it does not mark it in ERROR state as I originally thought. I have created another issue #3333 which is causing the test to be marked in ERROR state.

This issue will potentially fix the gnu test failure tests/misc/usage_vs_getopts. At least, this is one of the issue why the test is in ERROR state.

The gnu utils exits with error code 1 when there is a argument mismatch. uutils does not in some (may be all) cases.

gnu

> b2sum --thisoptiondoesnotexist
b2sum: unrecognized option '--thisoptiondoesnotexist'
Try 'b2sum --help' for more information.
> echo $?
1

uutils

> ./target/release/b2sum --thisoptiondosenotexist
error: Found argument '--thisoptiondosenotexist' which wasn't expected, or isn't valid in this context

        If you tried to supply `--thisoptiondosenotexist` as a value rather than a flag, use `-- --thisoptiondosenotexist`

USAGE:
    b2sum [OPTIONS] [FILE]...

For more information try --help
> echo $?
2

@sylvestre
Copy link
Contributor

I am working on this

@sylvestre
Copy link
Contributor

I think we have some incorrect parsing/different output :)

many thanks for opening this bug
are you doing it for the other ERROR ?

@ghost
Copy link
Author

ghost commented Mar 29, 2022

I am going through them randomly. I'll create issues for the ones I find at least one of the cause for ERROR.

@sylvestre
Copy link
Contributor

Cool, excellent :)

@sylvestre
Copy link
Contributor

Small world:
clap-rs/clap#3426 ;)

sylvestre added a commit to sylvestre/coreutils that referenced this issue Mar 29, 2022
sylvestre added a commit to sylvestre/coreutils that referenced this issue Mar 29, 2022
@sylvestre sylvestre mentioned this issue Mar 29, 2022
10 tasks
@tertsdiepraam
Copy link
Member

tertsdiepraam commented Mar 30, 2022

The discussion here might also be relevant: #3102 (it's the issue that led me to create that issue on clap)

@sylvestre
Copy link
Contributor

I think we are good now

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

No branches or pull requests

2 participants