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

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

Closed
jfinkels opened this issue Jan 29, 2022 · 1 comment · Fixed by #3012
Closed

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

jfinkels opened this issue Jan 29, 2022 · 1 comment · Fixed by #3012

Comments

@jfinkels
Copy link
Collaborator

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.

@shoriminimoe
Copy link
Contributor

I took a whack at a solution in #3012

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

Successfully merging a pull request may close this issue.

3 participants