Hello community, here is the log from the commit of package bash-completion for openSUSE:Factory checked in at 2015-12-21 12:03:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bash-completion (Old) and /work/SRC/openSUSE:Factory/.bash-completion.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bash-completion" Changes: -------- --- /work/SRC/openSUSE:Factory/bash-completion/bash-completion.changes 2015-10-01 12:22:08.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.bash-completion.new/bash-completion.changes 2015-12-21 12:03:42.000000000 +0100 @@ -1,0 +2,10 @@ +Fri Dec 18 09:33:05 UTC 2015 - [email protected] + +- Add patch respect-variables-boo940837.patch to avoid completions + which results in e.g. ls \$HO +- Add patch rm-completion-smart-boo958462.patch to allow completions + list e.g. rm prefix*.jpg<TAB><TAB> +- Modify patch LVM-completion-bsc946875.patch that is add the + new patch from Liuhua Wang + +------------------------------------------------------------------- New: ---- respect-variables-boo940837.patch rm-completion-smart-boo958462.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bash-completion.spec ++++++ --- /var/tmp/diff_new_pack.eZdV9S/_old 2015-12-21 12:03:43.000000000 +0100 +++ /var/tmp/diff_new_pack.eZdV9S/_new 2015-12-21 12:03:43.000000000 +0100 @@ -41,6 +41,10 @@ Patch6: backtick-completion-boo940835.patch # PATCH-FIX-SUSE bsc#946875 Patch7: LVM-completion-bsc946875.patch +# PATCH-FIX-SUSE boo#940837, bsc#959299 +Patch8: respect-variables-boo940837.patch +# PATCH-FIX-SUSE boo#958462 +Patch9: rm-completion-smart-boo958462.patch BuildRequires: pkg-config Requires: bash BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -59,7 +63,9 @@ %patch4 -b .p4 %patch5 -b .p5 %patch6 -b .p6 -%patch7 -b .p7 +%patch7 -b .p7 -p1 +%patch8 -b .p8 +%patch9 -b .p9 %build %configure ++++++ LVM-completion-bsc946875.patch ++++++ --- /var/tmp/diff_new_pack.eZdV9S/_old 2015-12-21 12:03:43.000000000 +0100 +++ /var/tmp/diff_new_pack.eZdV9S/_new 2015-12-21 12:03:43.000000000 +0100 @@ -1,171 +1,153 @@ ---- - completions/lvm | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) +There are the following problems with lvm completions: +1)_lvm_physicalvolumes() only gets PVs that belong to a VG. In some + cases like pvremove we can use all PVs including those not included + in any VGs. + solution: Add _lvm_physicalvolumes_all to get all PVs and correct + all the commands. ---- completions/lvm -+++ completions/lvm 2015-09-23 11:55:33.862917000 +0000 -@@ -25,6 +25,12 @@ _lvm_logicalvolumes() - fi - } +2)pvcreate should be able to use all block devcices. + solution: Add _lvm_filedir() to use _filedir except set $cur to /dev + when $cur is empty. + +3)when /etc/lvm/lvm.conf silent is 1 there is no output for vg/lv/pvscan, + bash-completion will not work. + solution: Check the value of silent option. If it is 1 then temporarily + set silent 0 and recover back to 1 after the command executed. + +Signed-off-by: Liuhua Wang <[email protected]> +Reviewed-by: Lidong Zhong <[email protected]> + + +diff --git a/completions/lvm b/completions/lvm +--- a/completions/lvm ++++ b/completions/lvm +@@ -1,19 +1,57 @@ + # bash completion for lvm -*- shell-script -*- +_lvm_filedir() +{ -+ test -n "$COMPREPLY" && return -+ COMPREPLY+=( $( compgen -f -d -- "${cur:-/dev/}" ) ) ++ cur=${cur:-/dev/} ++ _filedir +} + - _lvm_units() + _lvm_volumegroups() { - COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) ) -@@ -98,6 +104,7 @@ _pvs() ++ local silent ++ silent=$(sed -n -e "s|^[ \t]*silent[ \t]*=[ \t]*\([01]\)|\1|p" /etc/lvm/lvm.conf) ++ silent=${silent:-0} ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\10|" /etc/lvm/lvm.conf ++ + COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ + sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) ) ++ ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\11|" /etc/lvm/lvm.conf ++} ++ ++_lvm_physicalvolumes_all() ++{ ++ local silent ++ silent=$(sed -n -e "s|^[ \t]*silent[ \t]*=[ \t]*\([01]\)|\1|p" /etc/lvm/lvm.conf) ++ silent=${silent:-0} ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\10|" /etc/lvm/lvm.conf ++ ++ COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ ++ sed -n -e 's|^.*PV \([^ ]*\) .*|\1|p' )" -- "$cur" ) ) ++ ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\11|" /etc/lvm/lvm.conf + } + + _lvm_physicalvolumes() + { ++ local silent ++ silent=$(sed -n -e "s|^[ \t]*silent[ \t]*=[ \t]*\([01]\)|\1|p" /etc/lvm/lvm.conf) ++ silent=${silent:-0} ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\10|" /etc/lvm/lvm.conf ++ + COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ + sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) ) ++ ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\11|" /etc/lvm/lvm.conf + } + + _lvm_logicalvolumes() + { ++ local silent ++ silent=$(sed -n -e "s|^[ \t]*silent[ \t]*=[ \t]*\([01]\)|\1|p" /etc/lvm/lvm.conf) ++ silent=${silent:-0} ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\10|" /etc/lvm/lvm.conf ++ + COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ + sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) ) + if [[ $cur == /dev/mapper/* ]]; then +@@ -23,6 +61,8 @@ _lvm_logicalvolumes() + [[ ${COMPREPLY[i]} == */control ]] && unset COMPREPLY[i] + done + fi ++ ++ [ $silent -eq 1 ] && sed -i "s|\(^[ \t]*silent[ \t]*=[ \t]*\)[01].*$|\11|" /etc/lvm/lvm.conf + } + + _lvm_units() +@@ -96,7 +136,7 @@ _pvs() + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi -+ _lvm_filedir } && complete -F _pvs pvs - -@@ -118,6 +125,7 @@ _pvdisplay() +@@ -116,7 +156,7 @@ _pvdisplay() + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi -+ _lvm_filedir } && complete -F _pvdisplay pvdisplay - -@@ -138,6 +146,7 @@ _pvchange() +@@ -136,7 +176,7 @@ _pvchange() + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi -+ _lvm_filedir } && complete -F _pvchange pvchange - -@@ -170,6 +179,7 @@ _pvcreate() +@@ -168,7 +208,7 @@ _pvcreate() + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes +- _lvm_physicalvolumes ++ _lvm_filedir fi -+ _lvm_filedir } && complete -F _pvcreate pvcreate - -@@ -195,6 +205,7 @@ _pvmove() - else - _lvm_physicalvolumes - fi -+ _lvm_filedir - } && - complete -F _pvmove pvmove - -@@ -208,6 +219,7 @@ _pvremove() +@@ -206,7 +246,7 @@ _pvremove() + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) ) else - _lvm_physicalvolumes +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi -+ _lvm_filedir } && complete -F _pvremove pvremove - -@@ -325,6 +337,7 @@ _vgcreate() - _lvm_physicalvolumes - fi - fi -+ _lvm_filedir - } && - complete -F _vgcreate vgcreate - -@@ -385,6 +398,7 @@ _vgreduce() - _lvm_physicalvolumes +@@ -322,7 +362,7 @@ _vgcreate() + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi fi -+ _lvm_filedir } && - complete -F _vgreduce vgreduce - -@@ -415,6 +429,7 @@ _vgextend() - _lvm_physicalvolumes +@@ -412,7 +452,7 @@ _vgextend() + if [[ $args -eq 0 ]]; then + _lvm_volumegroups + else +- _lvm_physicalvolumes ++ _lvm_physicalvolumes_all fi fi -+ _lvm_filedir } && - complete -F _vgextend vgextend - -@@ -568,6 +583,7 @@ _vgsplit() - _lvm_physicalvolumes - fi - fi -+ _lvm_filedir - } && - complete -F _vgsplit vgsplit - -@@ -618,6 +634,7 @@ _lvs() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvs lvs - -@@ -638,6 +655,7 @@ _lvdisplay() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvdisplay lvdisplay - -@@ -662,6 +680,7 @@ _lvchange() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvchange lvchange - -@@ -700,6 +719,7 @@ _lvcreate() - _lvm_physicalvolumes - fi - fi -+ _lvm_filedir - } && - complete -F _lvcreate lvcreate - -@@ -720,6 +740,7 @@ _lvremove() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvremove lvremove - -@@ -740,6 +761,7 @@ _lvrename() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvrename lvrename - -@@ -764,6 +786,7 @@ _lvreduce() - else - _lvm_logicalvolumes - fi -+ _lvm_filedir - } && - complete -F _lvreduce lvreduce - -@@ -794,6 +817,7 @@ _lvresize() - _lvm_physicalvolumes - fi - fi -+ _lvm_filedir - } && - complete -F _lvresize lvresize - -@@ -824,6 +848,7 @@ _lvextend() - _lvm_physicalvolumes - fi - fi -+ _lvm_filedir - } && - complete -F _lvextend lvextend - ++++++ respect-variables-boo940837.patch ++++++ Bug boo#940837 Bug bsc#959299 That is do not escape the dollar character of a variable to allow commands like `ls' to go further in its completion chain. --- bash_completion | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- bash_completion +++ bash_completion 2015-12-18 09:53:36.647442000 +0100 @@ -1798,8 +1798,19 @@ _complete_as_root() _longopt() { - local cur prev words cword split - _init_completion -s || return + local cur=${COMP_WORDS[COMP_CWORD]} + local prev words cword split + + if [[ "${cur:0:1}" == '$' ]] ; then + compopt -o dirnames +o filenames + else + compopt +o dirnames -o filenames + fi + + if ! _init_completion -s ; then + _dollar $cur + return + fi case "${prev,,}" in --help|--usage|--version) ++++++ rm-completion-smart-boo958462.patch ++++++ Bug boo#958462 Allow the smart bash builtin completion if normal completion scripting does not return anything. --- bash_completion | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- bash_completion +++ bash_completion 2015-12-18 09:17:57.865910263 +0000 @@ -1857,10 +1857,11 @@ _longopt() complete -F _longopt -o filenames a2ps awk base64 bash bc bison cat colordiff cp csplit \ cut date df diff dir du enscript expand fmt fold gperf \ grep grub head indent irb ld ldd less ln m4 md5sum mkdir mkfifo mknod \ - mv nl nm objcopy objdump od paste pr ptx readelf rm rmdir \ + mv nl nm objcopy objdump od paste pr ptx readelf \ sed sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \ texindex touch tr unexpand uniq vdir wc who complete -F _longopt -o default env netstat seq uname units +complete -F _longopt -o bashdefault -o default -o filenames -o nospace rm rmdir if typeset -F _ls_ &> /dev/null; then complete -o bashdefault -o default -o filenames -o nospace -F _ls_ ls ll la l ls-l lf
