commit: f60b038e3ae789d01b38eb44ed15dc44ad78bf7c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 17 18:25:22 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 22 19:37:46 2024 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=f60b038e
Double quote a ${parameter+word} expansion in defer()
Doing so protects against the following scenario.
$ IFS=e word=1
$ set -x; test ${word+set}
+ test s t
dash: 2: test: s: unexpected operator
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/functions.sh b/functions.sh
index 3dd2969..8180182 100644
--- a/functions.sh
+++ b/functions.sh
@@ -175,7 +175,7 @@ deref()
elif ! trueof_all is_identifier -- "$@"; then
_warn_for_args deref "$@"
false
- elif ! eval "test \${$1+set}"; then
+ elif ! eval "test \"\${$1+set}\""; then
false
elif [ "$#" -eq 1 ]; then
eval "printf '%s\\n' \"\$$1\""