diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2018-03-20 04:05:21 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2018-04-29 13:34:43 +0200 |
commit | bcaf1b84ff0f0709d35cd0adb1f13965d1101aeb (patch) | |
tree | 0f8b46ac04c179d334ef20e12a7e1b8c18cf1ee6 /scripts | |
parent | 27f64e378958204314a17b5c5416bd40f47603ac (diff) | |
download | pacman-bcaf1b84ff0f0709d35cd0adb1f13965d1101aeb.tar.gz pacman-bcaf1b84ff0f0709d35cd0adb1f13965d1101aeb.tar.xz |
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 <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/libmakepkg/util/pkgbuild.sh.in | 6 |
1 files changed, 6 insertions, 0 deletions
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 } |