Skip to content

all: return code for invalid options #3331

Description

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

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