summaryrefslogtreecommitdiffstats
path: root/bash-completion/fdisk
diff options
context:
space:
mode:
authorSami Kerola2014-10-26 23:07:08 +0100
committerKarel Zak2014-10-31 10:39:00 +0100
commit53154dae39cd16924c97754589ed5396a91946bd (patch)
tree2db36d7308a6b16abcf570fba3b435517c63b334 /bash-completion/fdisk
parentfstrim: initialize path variable (diff)
downloadkernel-qcow2-util-linux-53154dae39cd16924c97754589ed5396a91946bd.tar.gz
kernel-qcow2-util-linux-53154dae39cd16924c97754589ed5396a91946bd.tar.xz
kernel-qcow2-util-linux-53154dae39cd16924c97754589ed5396a91946bd.zip
bash-completion: stop being clever when listing block devices
Various commands such as blkid, cfdisk, fdisk, delpart, and so on listed only partitions and missed for example disks and volume groups. The right thing to do is to list all block devices in all for all commands performing operations with them. This might occasionally list unexpected devices that I think is lesser bad than missing some. Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764488 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'bash-completion/fdisk')
-rw-r--r--bash-completion/fdisk12
1 files changed, 2 insertions, 10 deletions
diff --git a/bash-completion/fdisk b/bash-completion/fdisk
index 28cdda622..72a2b4236 100644
--- a/bash-completion/fdisk
+++ b/bash-completion/fdisk
@@ -6,11 +6,7 @@ _fdisk_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-s'|'--getsz')
- local DEV TYPE DEVICES=''
- while read DEV TYPE; do
- [ $TYPE = 'part' ] && DEVICES+="$DEV "
- done < <(lsblk -pnro name,type)
- COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
return 0
;;
'-b'|'--sector-size')
@@ -55,11 +51,7 @@ _fdisk_module()
return 0
;;
esac
- local DEV TYPE DEVICES=''
- while read DEV TYPE; do
- [ $TYPE = 'disk' ] && DEVICES+="$DEV "
- done < <(lsblk -pnro name,type)
- COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
return 0
}
complete -F _fdisk_module fdisk