Skip to content

all: print format of invalid option #3333

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions