update bash-completion to 2.10

This commit is contained in:
wangchen2020 2020-07-27 14:27:08 +08:00
parent 691769a1d6
commit 1c65f7a34d
11 changed files with 8 additions and 248 deletions

View File

@ -1,24 +0,0 @@
From 57b2c937c1fa8409a4416702cf5b8844233a5566 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sat, 17 Mar 2018 13:04:12 +0200
Subject: [PATCH 001/352] completions/Makefile: Fix check-local in VPATH builds
---
completions/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/completions/Makefile.am b/completions/Makefile.am
index e442a9e..30b190d 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1000,6 +1000,6 @@ check-local:
ret=0
for file in $(bashcomp_DATA) ; do \
$${bashcomp_bash:-$${BASH:-bash}} \
- -O extglob -n $$file || ret=$$? ; \
+ -O extglob -n $(srcdir)/$$file || ret=$$? ; \
done ; \
exit $$ret
--
1.8.3.1

View File

@ -1,26 +0,0 @@
From 583562b9e56207bd428497ceb96df4e1f1f53158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sun, 6 May 2018 21:41:48 +0200
Subject: [PATCH 056/352] __load_completion: Avoid bad array subscript on
"commands" ending with slash
Closes #209
---
bash_completion | 1 +
1 file changed, 1 insertion(+)
diff --git a/bash_completion b/bash_completion
index 9a9eae0..442c075 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2019,6 +2019,7 @@ __load_completion()
{
local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
local OIFS=$IFS IFS=: dir cmd="${1##*/}" compfile
+ [[ -n $cmd ]] || return 1
for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
dirs+=( $dir/bash-completion/completions )
done
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From a47bd375bb0f95dc6d388d4097c420bddb72ae33 Mon Sep 17 00:00:00 2001
From: John Swinbank <john@swinbank.org>
Date: Wed, 9 May 2018 22:17:01 -0700
Subject: [PATCH 059/352] _xspecs: Declare as global on bash >= 4.2
By default, associative arrays are local. If bash_completion is sourced from within a function, they won't propagate to the caller, and the system is not initialized properly. By making this explicitly global, it propagates as expected. bash >= 4.2 only, because of declare -g support.
Closes #210
---
bash_completion | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bash_completion b/bash_completion
index 442c075..3884850 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1891,7 +1891,13 @@ complete -F _longopt a2ps awk base64 bash bc bison cat chroot colordiff cp \
sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \
texindex touch tr uname unexpand uniq units vdir wc who
-declare -A _xspecs
+# declare only knows -g in bash >= 4.2.
+if [[ ${BASH_VERSINFO[0]} -gt 4 ||
+ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -ge 2 ]]; then
+ declare -Ag _xspecs
+else
+ declare -A _xspecs
+fi
_filedir_xspec()
{
local cur prev words cword
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From ee6b37ad7ff5b309cbb9b886a871252abd9398fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Fri, 25 May 2018 17:38:59 +0200
Subject: [PATCH 069/352] completions/Makefile.am: Use install-data-hook, not
install-data-local
-hook is run after the main rule, while -local might end up before.
https://www.gnu.org/software/automake/manual/html_node/Extending.html#index-hook-targets
Closes #212
---
completions/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 0242c46..5419e9d 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1013,8 +1013,8 @@ symlinks: $(targetdir) $(DATA)
all-local: targetdir = .
all-local: symlinks
-install-data-local: targetdir = $(DESTDIR)$(bashcompdir)
-install-data-local: symlinks
+install-data-hook: targetdir = $(DESTDIR)$(bashcompdir)
+install-data-hook: symlinks
check-local:
ret=0
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 8d2c976c11e379f28430f1ae15be3764755dcffb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 25 Apr 2019 23:19:28 +0300
Subject: [PATCH 076/156] ssh: fix suboption completion with combined -*o
---
completions/ssh | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/completions/ssh b/completions/ssh
index 7bfae90..df2f865 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -168,7 +168,7 @@ _ssh_suboption_check()
{
# Get prev and cur words without splitting on =
local cureq=`_get_cword :=` preveq=`_get_pword :=`
- if [[ $cureq == *=* && $preveq == -o ]]; then
+ if [[ $cureq == *=* && $preveq == -*o ]]; then
_ssh_suboption $cureq "$1"
return $?
fi
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From e8ac021ed13e5b110b9e0701b29d6c9704d33461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 9 May 2019 01:49:33 +0700
Subject: [PATCH 137/156] badblocks: fix $i leak
---
completions/badblocks | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/completions/badblocks b/completions/badblocks
index a366338..221f42b 100644
--- a/completions/badblocks
+++ b/completions/badblocks
@@ -16,11 +16,8 @@
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
# Filter out -w (dangerous) and -X (internal use)
- for i in ${!COMPREPLY[@]}; do
- [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]'
- done
+ COMPREPLY=( $(compgen -X -[wX] -W '$(_parse_usage "$1")' -- "$cur") )
return
fi
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From b3a25cfe429b8c87d9194c2d9042349ba71979c9 Mon Sep 17 00:00:00 2001
From: Russell Davis <551404+russelldavis@users.noreply.github.com>
Date: Mon, 9 Jul 2018 00:58:25 -0700
Subject: [PATCH 313/352] man: Fix completion when failglob option is enabled
(#225)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Modified-by: Ville Skyttä <ville.skytta@iki.fi>
---
completions/man | 3 +++
1 file changed, 3 insertions(+)
diff --git a/completions/man b/completions/man
index d5fa50f..37af081 100644
--- a/completions/man
+++ b/completions/man
@@ -67,8 +67,11 @@ _man()
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
fi
+ local IFS=$' \t\n' reset=$( shopt -p failglob ); shopt -u failglob
# redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
+ $reset
+
# weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From dd80f35279afd4f056dc191767b9869c9649d476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Mon, 11 Mar 2019 21:26:24 +0200
Subject: [PATCH 352/352] _longopt: don't complete --no-* with file/dirname arg
Closes https://github.com/scop/bash-completion/pull/291
Thanks-to: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
---
bash_completion | 4 ++--
test/t/test_grep.py | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bash_completion b/bash_completion
index a2f0a74..d35858e 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1850,11 +1850,11 @@ _longopt()
--help|--usage|--version)
return
;;
- --*dir*)
+ --!(no-*)dir*)
_filedir -d
return
;;
- --*file*|--*path*)
+ --!(no-*)@(file|path)*)
_filedir
return
;;
--
1.8.3.1

BIN
bash-completion-2.10.tar.xz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -2,8 +2,8 @@
%define _python_bytecompile_errors_terminate_build 0 %define _python_bytecompile_errors_terminate_build 0
Name: bash-completion Name: bash-completion
Version: 2.8 Version: 2.10
Release: 9 Release: 1
Epoch: 1 Epoch: 1
Summary: Completion for bash command Summary: Completion for bash command
License: GPLv2+ License: GPLv2+
@ -12,15 +12,6 @@ Source0: https://github.com/scop/%{name}/releases/download/%{version}/%{name}-
Patch0: %{name}-1.99-noblacklist.patch Patch0: %{name}-1.99-noblacklist.patch
Patch6000:0001-completions-Makefile-Fix-check-local-in-VPATH-builds.patch
Patch6001:0056-__load_completion-Avoid-bad-array-subscript-on-comma.patch
Patch6002:0059-_xspecs-Declare-as-global-on-bash-4.2.patch
Patch6003:0069-completions-Makefile.am-Use-install-data-hook-not-in.patch
Patch6004:0313-man-Fix-completion-when-failglob-option-is-enabled-2.patch
Patch6005:0352-_longopt-don-t-complete-no-with-file-dirname-arg.patch
Patch6006:0076-ssh-fix-suboption-completion-with-combined-o.patch
Patch6007:0137-badblocks-fix-i-leak.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: gcc autoconf automake BuildRequires: gcc autoconf automake
@ -73,6 +64,12 @@ make -C completions check
%doc CHANGES README.md doc/bash_completion.txt CONTRIBUTING.md %doc CHANGES README.md doc/bash_completion.txt CONTRIBUTING.md
%changelog %changelog
* Mon Jul 27 2020 wangchen<wangchen137@huawei.com> - 1:2.10-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update to 2.10
* Fri Nov 8 2019 shenyangyang<shenyangyang4@huawei.com> - 1:2.8-9 * Fri Nov 8 2019 shenyangyang<shenyangyang4@huawei.com> - 1:2.8-9
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA