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 --- src/diffpkg.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/diffpkg.in') diff --git a/src/diffpkg.in b/src/diffpkg.in index 10b0904..6d07419 100644 --- a/src/diffpkg.in +++ b/src/diffpkg.in @@ -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 -- cgit v1.2.3-54-g00ecf