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

On error, exit status code should be different than zero (0) #21

Open
iperdomo opened this issue May 21, 2018 · 0 comments
Open

On error, exit status code should be different than zero (0) #21

iperdomo opened this issue May 21, 2018 · 0 comments

Comments

@iperdomo
Copy link

When running su-exec with wrong parameters, you get the Usage: [...] text, but the exit status code is zero (0) which hides the problem on systems relying on status codes signals, e.g. CI environments or shell scripts using set -e

$ docker run --rm -ti alpine:3.7 sh
/ # apk add --no-cache su-exec=0.2-r0
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/1) Installing su-exec (0.2-r0)
Executing busybox-1.27.2-r7.trigger
OK: 4 MiB in 12 packages
/ # su-exec xxxx
Usage: su-exec user-spec command [args]
/ # echo $?
0
iperdomo added a commit to iperdomo/su-exec that referenced this issue May 21, 2018
- If su-exec is used as part of an environment where exit codes are
  used to signal errors. We can consider using wrong number of
  arguments as an error, then we can use exit(1) for that.
iperdomo added a commit to iperdomo/su-exec that referenced this issue Dec 20, 2021
Based on a review by @michaelbaudino

> According to /usr/include/sysexits.h (Linux) / man 3 sysexits
> (*BSD), shouldn't we return 64 (EX_USAGE) here, to comply with POSIX
> standard?
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

1 participant