diff --git a/backport-fix-_umount-feh-sbopkg-check-diretory-name-for-_comp.patch b/backport-fix-_umount-feh-sbopkg-check-diretory-name-for-_comp.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b0cc870c0887c26096132d5ff1c50fc6d11e050 --- /dev/null +++ b/backport-fix-_umount-feh-sbopkg-check-diretory-name-for-_comp.patch @@ -0,0 +1,63 @@ +From c2c6c08a62d8fc905739abe4e8dc8c1f37850e86 Mon Sep 17 00:00:00 2001 +From: Koichi Murase +Date: Mon, 30 Dec 2024 20:21:06 +0900 +Subject: [PATCH] fix(_umount,feh,sbopkg): check diretory name for + "_comp_compgen -C" + +* fix(_umount): specify the correct path as a directory +* fix(feh): check the directory name before attempting path completion +* fix(sbopkg): check the QUEUEDIR value before generating *.sqf +--- + completions/_umount.linux | 2 +- + completions/feh | 6 ++++-- + completions/sbopkg | 4 +++- + 3 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/completions/_umount.linux b/completions/_umount.linux +index ca515c8c..5540e8ea 100644 +--- a/completions/_umount.linux ++++ b/completions/_umount.linux +@@ -72,7 +72,7 @@ _comp_cmd_umount__linux_fstab() + realcur="$(readlink -f "$cur." 2>/dev/null)/" || + realcur=$(readlink -f "$cur" 2>/dev/null) + if [[ $realcur ]]; then +- local dirrealcur="" dircur="" basecur ++ local dirrealcur="" dircur=. basecur + if [[ $cur == */* ]]; then + dirrealcur="${realcur%/*}/" + dircur="${cur%/*}/" +diff --git a/completions/feh b/completions/feh +index c5fb30c3..d9550519 100644 +--- a/completions/feh ++++ b/completions/feh +@@ -33,8 +33,10 @@ _comp_cmd_feh() + for ((i = ${#words[@]} - 2; i > 0; i--)); do + if [[ ${words[i]} == -@(C|-fontpath) ]]; then + font_path="${words[i + 1]}" +- _comp_compgen -aC "$font_path" -- \ +- -f -X "!*.@([tT][tT][fF])" -S / ++ if [[ -d $font_path ]]; then ++ _comp_compgen -aC "$font_path" -- \ ++ -f -X "!*.@([tT][tT][fF])" -S / ++ fi + fi + done + compopt -o nospace +diff --git a/completions/sbopkg b/completions/sbopkg +index a2fc5a68..f51064e2 100644 +--- a/completions/sbopkg ++++ b/completions/sbopkg +@@ -63,7 +63,9 @@ _comp_cmd_sbopkg() + + _comp_compgen_split -l -- "$(command sed -ne "s/^SLACKBUILD NAME: //p" \ + "$file")" +- _comp_compgen -aC "$QUEUEDIR" -- -f -X "!*.sqf" ++ if [[ -d ${QUEUEDIR-} ]]; then ++ _comp_compgen -aC "$QUEUEDIR" -- -f -X "!*.sqf" ++ fi + } && + complete -F _comp_cmd_sbopkg sbopkg + +-- +2.43.0 + diff --git a/backport-fix-feh-fix-nounset-error.patch b/backport-fix-feh-fix-nounset-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d4961661eca242cacfad66e0f4c701a076305ef --- /dev/null +++ b/backport-fix-feh-fix-nounset-error.patch @@ -0,0 +1,32 @@ +From e9e665efd7623dd9ec6d72c25c5797c497d58f65 Mon Sep 17 00:00:00 2001 +From: Koichi Murase +Date: Mon, 30 Dec 2024 20:25:16 +0900 +Subject: [PATCH] fix(feh): fix "nounset" error + +In the current master, an error message is printed on the TAB +completion with the following command line (where the cursor position +is placed before the marker "[TAB]"): + +$ set -u +$ feh --font x[TAB] --fontpath +bash: words[i + 1]: unbound variable +--- + completions/feh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/completions/feh b/completions/feh +index 3762574d..c5fb30c3 100644 +--- a/completions/feh ++++ b/completions/feh +@@ -30,7 +30,7 @@ _comp_cmd_feh() + local font_path + # font_path="$(imlib2-config --prefix 2>/dev/null)/share/imlib2/data/fonts" + # _comp_compgen -C "$font_path" -- -f -X "!*.@([tT][tT][fF])" -S / +- for ((i = ${#words[@]} - 1; i > 0; i--)); do ++ for ((i = ${#words[@]} - 2; i > 0; i--)); do + if [[ ${words[i]} == -@(C|-fontpath) ]]; then + font_path="${words[i + 1]}" + _comp_compgen -aC "$font_path" -- \ +-- +2.43.0 + diff --git a/bash-completion.spec b/bash-completion.spec index b942a2ab1d45215e663b14576e4f17c075ee6bab..17e23b4052d81e6df48280ca99721ed408022afc 100644 --- a/bash-completion.spec +++ b/bash-completion.spec @@ -3,7 +3,7 @@ Name: bash-completion Version: 2.16.0 -Release: 2 +Release: 3 Epoch: 1 Summary: Completion for bash command License: GPL-2.0-or-later @@ -12,6 +12,8 @@ Source0: https://github.com/scop/%{name}/releases/download/%{version}/%{na Patch0: bash-completion-2.16.0-remove-python2.patch Patch6001: backport-refactor-secret-tool-deprecate-ours-in-favor-of-upstream.patch +Patch6002: backport-fix-feh-fix-nounset-error.patch +Patch6003: backport-fix-_umount-feh-sbopkg-check-diretory-name-for-_comp.patch BuildArch: noarch @@ -66,6 +68,9 @@ make -C completions check %doc CHANGELOG.md README.md doc/configuration.md CONTRIBUTING.md %changelog +*Tue May 27 2025 Linux_zhang - 1:2.16.0-3 +- DESC:check diretory name for _comp_compgen -C + * Tue Jan 28 2025 Funda Wang - 1:2.16.0-2 - Do not ship secret-tool scriptlet