[pacman-dev] [PATCH 2/4] util/pkgbuild: manually set extglob

Andrew Gregory andrew.gregory.8 at gmail.com
Sat Feb 25 17:21:16 UTC 2017


extract_function_variable requires extglob; set it in case the caller
hasn't.
---
 scripts/libmakepkg/util/pkgbuild.sh.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 08b35f53..7074c8c5 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -74,6 +74,9 @@ extract_function_variable() {
 
 	local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
 
+	local reset_shopt="$(shopt -p extglob)"
+	shopt -s extglob
+
 	if (( isarray )); then
 		printf -v attr_regex '^[[:space:]]* %s\+?=\(' "$2"
 	else
@@ -89,6 +92,8 @@ extract_function_variable() {
 		r=0
 	done < <(grep_function "$funcname" "$attr_regex")
 
+	eval "$reset_shopt"
+
 	return $r
 }
 
-- 
2.11.1


More information about the pacman-dev mailing list