fix: enable extglob before func definition for bash-5.2 compatibility
The `extglob` option changes the behavior of the shell parser, since extended glob patterns would otherwise be syntax errors. bash-5.2 changed the way a function definition is processed by calling the parser instead of relying on the ad-hoc code in bash-5.1 and earlier versions. This means, in bash-5.2 the shell function was parsed without `extglob` being enabled because the `shopt` command to enable it was part of the function body. Add `shopt` options for `extglob` around function definitions to address this issue and allow bash-5.2 to correctly parse the function. Co-authored-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org> Co-authored-by: Levente Polyak <anthraxx@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
parent
4ff7aa0d8a
commit
0365edb264
2
Makefile
2
Makefile
|
@ -78,7 +78,7 @@ $(1)/%: $(2)%.in $(LIBUTILS)
|
|||
@$(RM) "$$@"
|
||||
@{ echo -n 'm4_changequote([[[,]]])'; cat $$<; } | m4 -P --define=m4_devtools_version=$$(BUILDTOOLVER) | $(edit) >$$@
|
||||
@chmod $(3) "$$@"
|
||||
@bash -n "$$@"
|
||||
@bash -O extglob -n "$$@"
|
||||
endef
|
||||
|
||||
$(eval $(call buildInScript,build/bin,src/,555))
|
||||
|
|
|
@ -137,6 +137,7 @@ pkgver_equal() {
|
|||
# $pkgver can be supplied with or without a pkgrel appended.
|
||||
# If not supplied, any pkgrel will be matched.
|
||||
##
|
||||
shopt -s extglob
|
||||
find_cached_package() {
|
||||
local searchdirs=("$PWD" "$PKGDEST") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
|
@ -191,7 +192,7 @@ find_cached_package() {
|
|||
return 1
|
||||
esac
|
||||
}
|
||||
|
||||
shopt -u extglob
|
||||
|
||||
check_package_validity(){
|
||||
local pkgfile=$1
|
||||
|
|
|
@ -248,6 +248,7 @@ diff_pkgs() {
|
|||
fi
|
||||
}
|
||||
|
||||
shopt -s extglob
|
||||
fetch_pkg() {
|
||||
local pkg pkgdest pkgurl
|
||||
case $1 in
|
||||
|
@ -295,6 +296,7 @@ fetch_pkg() {
|
|||
|
||||
echo "$pkgdest"
|
||||
}
|
||||
shopt -u extglob
|
||||
|
||||
if (( $# < 2 )); then
|
||||
if [[ ! -f PKGBUILD ]]; then
|
||||
|
|
|
@ -40,6 +40,7 @@ else
|
|||
pushd "$WORKDIR" >/dev/null
|
||||
fi
|
||||
|
||||
shopt -s extglob
|
||||
process_sofile() {
|
||||
# extract the library name: libfoo.so
|
||||
shopt -s extglob nullglob
|
||||
|
@ -56,6 +57,7 @@ process_sofile() {
|
|||
soobjects+=("${soname}=${soversion}-${soarch}")
|
||||
fi
|
||||
}
|
||||
shopt -u extglob
|
||||
|
||||
case $script_mode in
|
||||
deps) find_args=(-perm -u+x);;
|
||||
|
|
Loading…
Reference in New Issue