aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2022-10-02 11:40:52 +1000
committerAllan McRae <allan@archlinux.org>2022-10-02 11:40:52 +1000
commita6b06a5b17e19db8700597ee06bae42b2cfe7b5a (patch)
tree9c258fdb8711e2e40fe8b35fc547df9a50c5a01a
parent546433b4fd8a3ede5d04d56b3d07ab9f671c0f89 (diff)
libmakepkg: fix compatibility with bash-5.2 globskipdots
Bash 5.2 has a new globskipdots option, which is enabled by default. The check_dotfiles lint fails with globskipdots due to the assumption that at least the "." and ".." paths will match. Disabling globskipdots would be the usual solution, but that fails on bash<5.2. Instead, enable nullglob for this check. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/libmakepkg/lint_package/dotfiles.sh.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/libmakepkg/lint_package/dotfiles.sh.in b/scripts/libmakepkg/lint_package/dotfiles.sh.in
index 243fb31c..0b993dd4 100644
--- a/scripts/libmakepkg/lint_package/dotfiles.sh.in
+++ b/scripts/libmakepkg/lint_package/dotfiles.sh.in
@@ -29,10 +29,17 @@ lint_package_functions+=('check_dotfiles')
check_dotfiles() {
local ret=0
+
+ local shellopts=$(shopt -p nullglob)
+ shopt -s nullglob
+
for f in "$pkgdir"/.*; do
[[ ${f##*/} == . || ${f##*/} == .. ]] && continue
error "$(gettext "Dotfile found in package root '%s'")" "$f"
ret=1
done
+
+ eval "$shellopts"
+
return $ret
}