From 6bab375973e62e9fcc0b41451d637134073e3007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 21 Apr 2023 19:07:02 +0100 Subject: install: support stripping files with a leading hyphen * src/install.c (strip): Prepend "./" to file names with a leading "-". * tests/install/strip-program.sh: Add a test case. * NEWS: Mention the bug fix. Reported in https://bugs.debian.org/1034429 --- tests/install/strip-program.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/install/strip-program.sh b/tests/install/strip-program.sh index 0a702f7fa..1b7de52a2 100755 --- a/tests/install/strip-program.sh +++ b/tests/install/strip-program.sh @@ -27,7 +27,6 @@ sed s/b/B/ \$1 > \$1.t && mv \$1.t \$1 EOF chmod a+x b || framework_failure_ - echo abc > src || framework_failure_ echo aBc > exp || framework_failure_ ginstall src dest -s --strip-program=./b || fail=1 @@ -37,4 +36,13 @@ compare exp dest || fail=1 returns_ 1 ginstall src dest2 -s --strip-program=./FOO || fail=1 test -e dest2 && fail=1 +# Ensure naked hyphens not passed +cat < no-hyphen || framework_failure_ +#!$SHELL +printf -- '%s\\n' "\$1" | grep '^[^-]' +EOF +chmod a+x no-hyphen || framework_failure_ + +ginstall -s --strip-program=./no-hyphen -- src -dest || fail=1 + Exit $fail -- cgit v1.2.1