Skip to content

Commit

Permalink
sys-apps/util-linux: Revbump fix bash-completion umount code execution
Browse files Browse the repository at this point in the history
Committed straight to stable.

Bug: https://bugs.gentoo.org/649812
Package-Manager: Portage-2.3.24, Repoman-2.3.6
  • Loading branch information
Lars Wendler committed Mar 7, 2018
1 parent c7127c9 commit da1d162
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 75f03badd7ed9f1dd951863d75e756883d3acc55 Mon Sep 17 00:00:00 2001
From: Karel Zak <[email protected]>
Date: Thu, 16 Nov 2017 16:27:32 +0100
Subject: [PATCH] bash-completion: (umount) use findmnt, escape a space in
paths

# mount /dev/sdc1 /mnt/test/foo\ bar
# umount <tab>

has to return "/mnt/test/foo\ bar".

Changes:

* don't use mount | awk output, we have findmnt
* force compgen use \n as entries separator

Addresses: https://github.com/karelzak/util-linux/issues/539
Signed-off-by: Karel Zak <[email protected]>
---
bash-completion/umount | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bash-completion/umount b/bash-completion/umount
index d76cb9fff..98c90d61a 100644
--- a/bash-completion/umount
+++ b/bash-completion/umount
@@ -40,9 +40,10 @@ _umount_module()
return 0
;;
esac
- local DEVS_MPOINTS
- DEVS_MPOINTS="$(mount | awk '{print $1, $3}')"
- COMPREPLY=( $(compgen -W "$DEVS_MPOINTS" -- $cur) )
- return 0
+
+ local oldifs=$IFS
+ IFS=$'\n'
+ COMPREPLY=( $( compgen -W '$(findmnt -lno TARGET | sed "s/\([[:blank:]]\)/\\\\\1/g")' -- "$cur" ) )
+ IFS=$oldifs
}
complete -F _umount_module umount
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

S="${WORKDIR}/${MY_P}"

PATCHES=(
"${FILESDIR}/${PN}-2.32_rc2-umount_completion.patch" #649812
)

pkg_setup() {
use python && python-single-r1_pkg_setup
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

S="${WORKDIR}/${MY_P}"

PATCHES=(
"${FILESDIR}/${PN}-2.32_rc2-umount_completion.patch" #649812
)

pkg_setup() {
use python && python-single-r1_pkg_setup
}
Expand Down

0 comments on commit da1d162

Please sign in to comment.