From bcaf1b84ff0f0709d35cd0adb1f13965d1101aeb Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 19 Mar 2018 23:05:21 -0400 Subject: libmakepkg/util/pkgbuild.sh: fix missing extglob We use an extended glob here, but were relying on having it globally set in makepkg. This causes it to fail when used in scripts. Since scripts using libmakepkg may not want extglob to be set, save and restore the environment while explicitly setting extglob only where we need it. Signed-off-by: Eli Schwartz Signed-off-by: Allan McRae --- scripts/libmakepkg/util/pkgbuild.sh.in | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/libmakepkg/util') diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in index 25ad03ce..d35c064b 100644 --- a/scripts/libmakepkg/util/pkgbuild.sh.in +++ b/scripts/libmakepkg/util/pkgbuild.sh.in @@ -80,6 +80,10 @@ extract_function_variable() { printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2" fi + # save our shell options and turn on extglob + local shellopts=$(shopt -p) + shopt -s extglob + while read -r; do # strip leading whitespace and any usage of declare decl=${REPLY##*([[:space:]])} @@ -89,6 +93,8 @@ extract_function_variable() { r=0 done < <(grep_function "$funcname" "$attr_regex") + eval "$shellopts" + return $r } -- cgit v1.2.3-70-g09d2