Skip to content

truncate: exit status should be 1, not 2, on invalid arguments #2951

@jfinkels

Description

@jfinkels

The GNU version of truncate returns exit status 1 when the arguments are invalid, but the uutils version of truncate returns exit status 2.

GNU truncate

$ truncate file
truncate: you must specify either ‘--size’ or ‘--reference’
Try 'truncate --help' for more information.
$ echo $?
1

uutils truncate

$ ./target/debug/truncate file
error: The following required arguments were not provided:
    --reference <RFILE>
    --size <SIZE>

USAGE:
    ./target/debug/truncate [OPTION]... [FILE]...

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

In order to get the first two test cases in the GNU test file tests/misc/truncate-parameters.sh to pass, the uutils version needs to return exit status 1 in this situation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions