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

my_init doesn't preserve non-zero exit status #45

Closed
harto opened this issue Mar 28, 2014 · 4 comments
Closed

my_init doesn't preserve non-zero exit status #45

harto opened this issue Mar 28, 2014 · 4 comments

Comments

@harto
Copy link
Contributor

harto commented Mar 28, 2014

Unless I'm misunderstanding something, the final line of this output should read 42:

$ docker run --rm phusion/baseimage:0.9.9 /sbin/my_init --skip-runit -- bash -c 'exit 42'
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
*** Running /etc/rc.local...
*** Running bash -c exit 42...
*** bash exited with exit code 10752.
*** Killing all processes...
$ echo $?
0
@harto
Copy link
Contributor Author

harto commented Mar 28, 2014

The abnormally large exit code value (10752) is ignored by sys.exit:

$ python -c 'import sys; sys.exit(10752)'; echo $?
0

Probably because, according to http://docs.python.org/2/library/sys.html#sys.exit:

Most systems require [the exit code] to be in the range 0-127, and produce undefined results otherwise.

@FooBarWidget
Copy link
Member

Can you test this?

@pda
Copy link
Contributor

pda commented Mar 28, 2014

Looks good to me:

# Previous version:
root@e63c58ccd0ef:/# /sbin/my_init --skip-runit --quiet -- bash -c 'exit 42'; echo $?
0
# Current master:
root@e63c58ccd0ef:/# /baseimage-docker/image/my_init --skip-runit --quiet -- bash -c 'exit 42'; echo $?
42

@harto
Copy link
Contributor Author

harto commented Mar 29, 2014

Awesome, thanks! :-)

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

3 participants