diff options
author | Tobias Powalowski <tpowa@archlinux.org> | 2023-01-31 09:43:15 +0100 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-03-06 21:51:27 +0100 |
commit | 0365edb264c08b6520c8b57fadbff55967e1e948 (patch) | |
tree | 180b4e8defcdb47c19383199488ed9e5bf21dd7d /src/diffpkg.in | |
parent | 4ff7aa0d8a8c88a6d1d02fa8462fa59c24a97422 (diff) | |
download | devtools-0365edb264c08b6520c8b57fadbff55967e1e948.tar.xz |
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>
Diffstat (limited to 'src/diffpkg.in')
-rw-r--r-- | src/diffpkg.in | 2 |
1 files changed, 2 insertions, 0 deletions
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 |