* [PATCH] bash-completion: Invoke actual commands to be completed, not basenames
@ 2014-11-15 20:36 Ville Skyttä
2014-11-18 12:59 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Ville Skyttä @ 2014-11-15 20:36 UTC (permalink / raw)
To: util-linux
Addresses partially: http://bugs.debian.org/769462
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
bash-completion/chsh | 2 +-
bash-completion/eject | 2 +-
bash-completion/findmnt | 8 ++++----
bash-completion/losetup | 4 ++--
bash-completion/lsblk | 2 +-
bash-completion/setarch | 2 +-
bash-completion/setpriv | 2 +-
7 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/bash-completion/chsh b/bash-completion/chsh
index 7064194..fbf8add 100644
--- a/bash-completion/chsh
+++ b/bash-completion/chsh
@@ -6,7 +6,7 @@ _chsh_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-s'|'--shell')
- COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
+ COMPREPLY=( $(compgen -W "$($1 -l)" -- $cur) )
return 0
;;
'-u'|'--help'|'-v'|'--version')
diff --git a/bash-completion/eject b/bash-completion/eject
index bb7187f..123829e 100644
--- a/bash-completion/eject
+++ b/bash-completion/eject
@@ -15,7 +15,7 @@ _eject_module()
return 0
;;
'-x'|'--cdspeed')
- COMPREPLY=( $(compgen -W "$(eject -X)" -- $cur) )
+ COMPREPLY=( $(compgen -W "$($1 -X)" -- $cur) )
return 0
;;
'-h'|'--help'|'-V'|'--version')
diff --git a/bash-completion/findmnt b/bash-completion/findmnt
index a7df4a0..cf66565 100644
--- a/bash-completion/findmnt
+++ b/bash-completion/findmnt
@@ -38,7 +38,7 @@ _findmnt_module()
for I in ${TMP_ARR[@]}; do
MNT_OPTS[$I]='1'
done
- done < <(findmnt -rno OPTIONS)
+ done < <($1 -rno OPTIONS)
COMPREPLY=( $(compgen -W "${!MNT_OPTS[@]}" -- $cur) )
return 0
;;
@@ -67,13 +67,13 @@ _findmnt_module()
;;
'-S'|'--source')
local DEV_MPOINT
- DEV_MPOINT=$(findmnt -rno SOURCE | grep ^/dev)
+ DEV_MPOINT=$($1 -rno SOURCE | grep ^/dev)
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
return 0
;;
'-T'|'--target')
local DEV_MPOINT
- DEV_MPOINT=$(findmnt -rno TARGET)
+ DEV_MPOINT=$($1 -rno TARGET)
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
return 0
;;
@@ -117,7 +117,7 @@ _findmnt_module()
;;
esac
local DEV_MPOINT
- DEV_MPOINT=$(findmnt -rno TARGET,SOURCE)
+ DEV_MPOINT=$($1 -rno TARGET,SOURCE)
COMPREPLY=( $(compgen -W "$DEV_MPOINT" -- $cur) )
return 0
}
diff --git a/bash-completion/losetup b/bash-completion/losetup
index 874c549..d2b7418 100644
--- a/bash-completion/losetup
+++ b/bash-completion/losetup
@@ -6,12 +6,12 @@ _losetup_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-d'|'--detach')
- ARG="$(losetup --output NAME | awk '{if (1 < NR) {print}}')"
+ ARG="$($1 --output NAME | awk '{if (1 < NR) {print}}')"
COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
return 0
;;
'-j'|'--associated')
- ARG="$(losetup --output BACK-FILE | awk '{if (1 < NR) {print}}')"
+ ARG="$($1 --output BACK-FILE | awk '{if (1 < NR) {print}}')"
COMPREPLY=( $(compgen -W "$ARG" -- $cur) )
return 0
;;
diff --git a/bash-completion/lsblk b/bash-completion/lsblk
index b5dcb40..af8b9ad 100644
--- a/bash-completion/lsblk
+++ b/bash-completion/lsblk
@@ -70,7 +70,7 @@ _lsblk_module()
;;
esac
local DEVS
- COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
+ COMPREPLY=( $(compgen -W "$($1 -pnro name)" -- $cur) )
return 0
}
complete -F _lsblk_module lsblk
diff --git a/bash-completion/setarch b/bash-completion/setarch
index b2c6a07..771de98 100644
--- a/bash-completion/setarch
+++ b/bash-completion/setarch
@@ -10,7 +10,7 @@ _setarch_module()
;;
esac
if [ $COMP_CWORD -eq 1 ]; then
- COMPREPLY=( $(compgen -W "$(setarch --list)" -- $cur) )
+ COMPREPLY=( $(compgen -W "$($1 --list)" -- $cur) )
return 0
fi
case $cur in
diff --git a/bash-completion/setpriv b/bash-completion/setpriv
index 3be5ccd..7c21dee 100644
--- a/bash-completion/setpriv
+++ b/bash-completion/setpriv
@@ -8,7 +8,7 @@ _setpriv_module()
'--inh-caps'|'--bounding-set')
# FIXME: how to append to a string with compgen?
local INHERIT
- INHERIT=$(setpriv --list-caps| awk '{print $1, "-" $1}')
+ INHERIT=$($1 --list-caps| awk '{print $1, "-" $1}')
compopt -o nospace
COMPREPLY=( $(compgen -W "all $INHERIT" -S ',' -- $cur) )
return 0
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] bash-completion: Invoke actual commands to be completed, not basenames
2014-11-15 20:36 [PATCH] bash-completion: Invoke actual commands to be completed, not basenames Ville Skyttä
@ 2014-11-18 12:59 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2014-11-18 12:59 UTC (permalink / raw)
To: Ville Skyttä; +Cc: util-linux
On Sat, Nov 15, 2014 at 10:36:04PM +0200, Ville Skyttä wrote:
> bash-completion/chsh | 2 +-
> bash-completion/eject | 2 +-
> bash-completion/findmnt | 8 ++++----
> bash-completion/losetup | 4 ++--
> bash-completion/lsblk | 2 +-
> bash-completion/setarch | 2 +-
> bash-completion/setpriv | 2 +-
> 7 files changed, 11 insertions(+), 11 deletions(-)
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bash-completion: Invoke actual commands to be completed, not basenames
2014-11-24 11:40 ` Karel Zak
@ 2014-11-24 15:25 ` Dave Reisner
0 siblings, 0 replies; 5+ messages in thread
From: Dave Reisner @ 2014-11-24 15:25 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux, Ville Skyttä
On Mon, Nov 24, 2014 at 12:40:35PM +0100, Karel Zak wrote:
> On Tue, Nov 18, 2014 at 09:28:51AM -0500, Dave Reisner wrote:
> > On Nov 18, 2014 8:00 AM, "Karel Zak" <kzak@redhat.com> wrote:
> > >
> > > On Sat, Nov 15, 2014 at 10:36:04PM +0200, Ville Skyttä wrote:
> > > > bash-completion/chsh | 2 +-
> > > > bash-completion/eject | 2 +-
> > > > bash-completion/findmnt | 8 ++++----
> > > > bash-completion/losetup | 4 ++--
> > > > bash-completion/lsblk | 2 +-
> > > > bash-completion/setarch | 2 +-
> > > > bash-completion/setpriv | 2 +-
> > > > 7 files changed, 11 insertions(+), 11 deletions(-)
> > >
> > > Applied, thanks!
> > >
> > > Karel
> > >
> >
> > I think this patch breaks completions when used with binaries from a build
> > root containing whitespace in the path. The use is probably rare, but fix
>
> For example?
>
It seems that it's moot because you cannot build util-linux in a path
containing whitespace:
$ mkdir ~/build\ root && cd "$_"
$ git clone git://github.com/karelzak/util-linux && cd util-linux
$ ./autogen.sh && ./configure && make
This will generate a libtool failure when it starts linking libuuid,
libblkid, etc.
> > is simple -- quote the $1. The commands inside $() have their own separate
> > level of quoting, i.e. "$("$1" -X)" is what we want.
>
> Ville, any comment?
>
> Karel
>
> --
> Karel Zak <kzak@redhat.com>
> http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bash-completion: Invoke actual commands to be completed, not basenames
2014-11-18 14:28 Dave Reisner
@ 2014-11-24 11:40 ` Karel Zak
2014-11-24 15:25 ` Dave Reisner
0 siblings, 1 reply; 5+ messages in thread
From: Karel Zak @ 2014-11-24 11:40 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Ville Skyttä
On Tue, Nov 18, 2014 at 09:28:51AM -0500, Dave Reisner wrote:
> On Nov 18, 2014 8:00 AM, "Karel Zak" <kzak@redhat.com> wrote:
> >
> > On Sat, Nov 15, 2014 at 10:36:04PM +0200, Ville Skyttä wrote:
> > > bash-completion/chsh | 2 +-
> > > bash-completion/eject | 2 +-
> > > bash-completion/findmnt | 8 ++++----
> > > bash-completion/losetup | 4 ++--
> > > bash-completion/lsblk | 2 +-
> > > bash-completion/setarch | 2 +-
> > > bash-completion/setpriv | 2 +-
> > > 7 files changed, 11 insertions(+), 11 deletions(-)
> >
> > Applied, thanks!
> >
> > Karel
> >
>
> I think this patch breaks completions when used with binaries from a build
> root containing whitespace in the path. The use is probably rare, but fix
For example?
> is simple -- quote the $1. The commands inside $() have their own separate
> level of quoting, i.e. "$("$1" -X)" is what we want.
Ville, any comment?
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bash-completion: Invoke actual commands to be completed, not basenames
@ 2014-11-18 14:28 Dave Reisner
2014-11-24 11:40 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Dave Reisner @ 2014-11-18 14:28 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux, Ville Skyttä
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
On Nov 18, 2014 8:00 AM, "Karel Zak" <kzak@redhat.com> wrote:
>
> On Sat, Nov 15, 2014 at 10:36:04PM +0200, Ville Skyttä wrote:
> > bash-completion/chsh | 2 +-
> > bash-completion/eject | 2 +-
> > bash-completion/findmnt | 8 ++++----
> > bash-completion/losetup | 4 ++--
> > bash-completion/lsblk | 2 +-
> > bash-completion/setarch | 2 +-
> > bash-completion/setpriv | 2 +-
> > 7 files changed, 11 insertions(+), 11 deletions(-)
>
> Applied, thanks!
>
> Karel
>
I think this patch breaks completions when used with binaries from a build
root containing whitespace in the path. The use is probably rare, but fix
is simple -- quote the $1. The commands inside $() have their own separate
level of quoting, i.e. "$("$1" -X)" is what we want.
> --
> Karel Zak <kzak@redhat.com>
> http://karelzak.blogspot.com
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: Type: text/html, Size: 1590 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-24 15:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15 20:36 [PATCH] bash-completion: Invoke actual commands to be completed, not basenames Ville Skyttä
2014-11-18 12:59 ` Karel Zak
2014-11-18 14:28 Dave Reisner
2014-11-24 11:40 ` Karel Zak
2014-11-24 15:25 ` Dave Reisner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.