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: print format of invalid option #3333

Closed
Tracked by #3336
ghost opened this issue Mar 29, 2022 · 1 comment · Fixed by #3335
Closed
Tracked by #3336

all: print format of invalid option #3333

ghost opened this issue Mar 29, 2022 · 1 comment · Fixed by #3335

Comments

@ghost
Copy link

ghost commented Mar 29, 2022

refer: #3320

Below is at least one of the reason why the gnu test tests/misc/usage_vs_getopt.sh is in error state.

gnu:

> b2sum -/ 
b2sum: invalid option -- '/'
Try 'b2sum --help' for more information.

uutils:

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

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

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

For more information try --help

Explanation:

  1. Note that whereas gnu prints '/' in the error message, uutils prints '-/'.
  2. The gnu test greps for " '*/'*" in the output error message.
  3. In grep, the * indicates zero or more preceding character. The error message should have something like '/' and not '-/'.
  4. I think the gnu test is wrong. I am assuming the intention of * is meant to be any character not just the preceding character. It does not make sense to have error message that'll have multiple single quote like '''/'''. The person who wrote the test might not have know the behavior of * in grep.

I am not sure if we need to fix the uutils error message to remove preceding - or fix the gnu test.

@sylvestre
Copy link
Contributor

yeah, I agree with your finding. I took the option to fix the test:
#3335

#3330 has been necessary too:

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

Successfully merging a pull request may close this issue.

2 participants