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

Exit code can overflow, falsely indicating success #27

Closed
lucaswerkmeister opened this issue Nov 15, 2018 · 2 comments
Closed

Exit code can overflow, falsely indicating success #27

lucaswerkmeister opened this issue Nov 15, 2018 · 2 comments

Comments

@lucaswerkmeister
Copy link

has $(for i in {1..256}; do echo go; done)
echo $?

This will appear to indicate success regardless of whether the system has go or not, because the real exit code of 256 is truncated (only the least significant eight bits are used).

@kdabir
Copy link
Owner

kdabir commented Nov 16, 2018

Interesting. Although practically has is meant to test only a handful commands, nonetheless this could be issue if args are being provided from a file or something.

I can think of putting an upper bound on the status code returned to a something smaller. Ideally lower than 127.

@kdabir kdabir closed this as completed in 79f3eb8 Nov 16, 2018
@kdabir
Copy link
Owner

kdabir commented Nov 16, 2018

Pushed the change, along with the test. Thanks for reporting issue.

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

No branches or pull requests

2 participants