diff options
author | Lucas Ramage <ramage.lucas@protonmail.com> | 2019-04-29 03:15:58 +0000 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-11-19 22:04:12 +0100 |
commit | c06a24eae55ab0a444b5046ef8ef733dbb565793 (patch) | |
tree | 53892b5d82619ade5c6e4a9f7d630c041362a480 /main/bash-completion/01-generalized-containers.patch | |
parent | 567df27d4e844160c3350b5ddc43291ad5735b36 (diff) | |
download | aports-c06a24eae55ab0a444b5046ef8ef733dbb565793.tar.bz2 aports-c06a24eae55ab0a444b5046ef8ef733dbb565793.tar.xz |
main/bash-completion: upgrade to 2.9
Latest version now requires pexpect to successfully run checks
Tests for ifup/down are still failing on master so they were removed
See: https://github.com/scop/bash-completion/issues/235
Diffstat (limited to 'main/bash-completion/01-generalized-containers.patch')
-rw-r--r-- | main/bash-completion/01-generalized-containers.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/main/bash-completion/01-generalized-containers.patch b/main/bash-completion/01-generalized-containers.patch new file mode 100644 index 0000000000..9d9ce117e5 --- /dev/null +++ b/main/bash-completion/01-generalized-containers.patch @@ -0,0 +1,88 @@ +From 5443c819622495fcdc759d5dd4e5c31633eab389 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> +Date: Thu, 2 May 2019 16:57:25 +0300 +Subject: [PATCH] _pnames: adapt for busybox ps, rewrite in pure bash + +Closes https://github.com/scop/bash-completion/issues/318 +--- + bash_completion | 51 ++++++++++++++++++++++++++++++------------ + test/t/test_killall.py | 4 ++++ + 2 files changed, 41 insertions(+), 14 deletions(-) + +diff --git a/bash_completion b/bash_completion +index 58987a7fc1..bf7d02c753 100644 +--- a/bash_completion ++++ b/bash_completion +@@ -1069,23 +1069,46 @@ _pnames() + } || + _pnames() + { ++ local -a procs + if [[ "$1" == -s ]]; then +- COMPREPLY=( $(compgen -X '<defunct>' \ +- -W '$(command ps axo comm | command sed -e 1d)' -- "$cur") ) ++ procs=( $(command ps axo comm | command sed -e 1d) ) + else +- # FIXME: completes "[kblockd/0]" to "0". Previously it was completed +- # to "kblockd" which isn't correct either. "kblockd/0" would be +- # arguably most correct, but killall from psmisc 22 treats arguments +- # containing "/" specially unless -r is given so that wouldn't quite +- # work either. Perhaps it'd be best to not complete these to anything +- # for now. +- COMPREPLY=( $(compgen -X '<defunct>' -W '$(command ps axo command= | command sed -e \ +- "s/ .*//" -e \ +- "s:.*/::" -e \ +- "s/:$//" -e \ +- "s/^[[(-]//" -e \ +- "s/[])]$//" | sort -u)' -- "$cur") ) ++ local line i=-1 OIFS=$IFS ++ IFS=$'\n' ++ local -a psout=( $(command ps axo command=) ) ++ IFS=$OIFS ++ for line in "${psout[@]}"; do ++ if [[ $i -eq -1 ]]; then ++ # First line, see if it has COMMAND column header. For example ++ # the busybox ps does that, i.e. doesn't respect axo command= ++ if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then ++ # It does; store its index. ++ i=${#BASH_REMATCH[1]} ++ else ++ # Nope, fall through to "regular axo command=" parsing. ++ break ++ fi ++ else ++ # ++ line=${line:$i} # take command starting from found index ++ line=${line%% *} # trim arguments ++ procs+=( $line ) ++ fi ++ done ++ if [[ $i -eq -1 ]]; then ++ # Regular axo command= parsing ++ for line in "${psout[@]}"; do ++ if [[ $line =~ ^[[(](.+)[])]$ ]]; then ++ procs+=( ${BASH_REMATCH[1]} ) ++ else ++ line=${line%% *} # trim arguments ++ line=${line##@(*/|-)} # trim leading path and - ++ procs+=( $line ) ++ fi ++ done ++ fi + fi ++ COMPREPLY=( $(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur" ) ) + } + + # This function completes on user IDs +diff --git a/test/t/test_killall.py b/test/t/test_killall.py +index 725a16e4d6..136eee7373 100644 +--- a/test/t/test_killall.py ++++ b/test/t/test_killall.py +@@ -11,3 +11,7 @@ def test_1(self, completion): + @pytest.mark.complete("killall --signal ") + def test_2(self, completion): + assert all(x in completion for x in "INT KILL TERM".split()) ++ ++ @pytest.mark.complete("killall ") ++ def test_3(self, completion): ++ assert "command=" not in completion |