From 0365edb264c08b6520c8b57fadbff55967e1e948 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Tue, 31 Jan 2023 09:43:15 +0100 Subject: fix: enable extglob before func definition for bash-5.2 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Co-authored-by: Levente Polyak Signed-off-by: Levente Polyak --- lib/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/common.sh') diff --git a/lib/common.sh b/lib/common.sh index a5e4616..d345307 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -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 -- cgit v1.2.3-54-g00ecf