diff --git a/Dockerfile b/Dockerfile index c285385..41f6138 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:jessie +FROM debian:stretch MAINTAINER Chris Kuehl diff --git a/debian/control b/debian/control index 5e9c3be..16d054c 100644 --- a/debian/control +++ b/debian/control @@ -8,9 +8,10 @@ Build-Depends: help2man, musl-tools, ## Tests: + procps, python, - python-pytest, python-mock, + python-pytest, Standards-Version: 3.9.7 Homepage: https://github.com/Yelp/dumb-init Vcs-Browser: https://github.com/Yelp/dumb-init diff --git a/dumb-init.c b/dumb-init.c index af4f92d..f8b3357 100644 --- a/dumb-init.c +++ b/dumb-init.c @@ -173,6 +173,7 @@ char **parse_command(int argc, char *argv[]) { {"rewrite", required_argument, NULL, 'r'}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, + {NULL, 0, NULL, 0}, }; while ((opt = getopt_long(argc, argv, "+hvVcr:", long_options, NULL)) != -1) { switch (opt) { diff --git a/tests/cli_test.py b/tests/cli_test.py index 1fe4584..2a6065e 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -21,6 +21,17 @@ def test_no_arguments_prints_usage(both_debug_modes, both_setsid_modes): ) +@pytest.mark.usefixtures('both_debug_modes', 'both_setsid_modes') +def test_exits_invalid_with_invalid_args(): + proc = Popen(('dumb-init', '--yolo', '/bin/true'), stderr=PIPE) + _, stderr = proc.communicate() + assert proc.returncode == 1 + assert stderr in ( + b"dumb-init: unrecognized option '--yolo'\n", # glibc + b'dumb-init: unrecognized option: yolo\n', # musl + ) + + @pytest.mark.parametrize('flag', ['-h', '--help']) def test_help_message(flag, both_debug_modes, both_setsid_modes, current_version): """dumb-init should say something useful when called with the help flag,