diff options
author | Pádraig Brady <P@draigBrady.com> | 2022-07-24 18:46:10 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2022-07-24 18:55:41 +0100 |
commit | 96c149941357186abcbd8da914544a7867cab01e (patch) | |
tree | bf910ba22468258258603b31bf00b0f62f9f4137 /tests | |
parent | b8aafe514516c5796c8ae9e6806f1f3a803b6adb (diff) | |
download | coreutils-96c149941357186abcbd8da914544a7867cab01e.tar.gz |
runcon: ensure --compute runs the file it inspects
* src/runcon.c (main): With -c avoid searching the path
to ensure the file specified to --compute is executed.
* tests/misc/runcon-compute.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Reported in https://bugs.debian.org/1013924
Diffstat (limited to 'tests')
-rw-r--r-- | tests/local.mk | 1 | ||||
-rwxr-xr-x | tests/misc/runcon-compute.sh | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/local.mk b/tests/local.mk index 0f7778619..0496c2873 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -351,6 +351,7 @@ all_tests = \ tests/misc/readlink-fp-loop.sh \ tests/misc/readlink-root.sh \ tests/misc/realpath.sh \ + tests/misc/runcon-compute.sh \ tests/misc/runcon-no-reorder.sh \ tests/misc/sha1sum.pl \ tests/misc/sha1sum-vec.pl \ diff --git a/tests/misc/runcon-compute.sh b/tests/misc/runcon-compute.sh new file mode 100755 index 000000000..1c4e0c060 --- /dev/null +++ b/tests/misc/runcon-compute.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Ensure that runcon -c uses absolute file names + +# Copyright (C) 2022 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ runcon + +# Create an executable that's sure to fail +printf '%s\n' '#!/bin/sh' 'exit 1' >> 'true' || framework_failure_ +chmod a+x 'true' || framework_failure_ + +returns_ 1 runcon -c true || fail=1 + +Exit $fail |