[PATCH 2 of 4] bash_completion: be more careful about whitespaces
Alexis S. L. Carvalho
alexis at cecm.usp.br
Fri Jan 27 03:09:17 UTC 2006
Thus spake Thomas Arendsen Hein:
> Works fine on Linux and especially the last feature is really nice,
> but on Solaris 2.8 the bash falls into an endless loop when typing
> hg s<tab>
>
> This seems to be a bug in
> GNU bash, version 2.05a.0(1)-release (sparc-sun-solaris2.8)
OK, I've compiled bash 2.05a and reproduced this. I'm actually a bit
surprised that you only hit this now - with the bash_completion file in
current tip, I can reproduce it with something like
hg init
touch foo bar
hg add foo bar
hg diff <Tab>
The following patch implements a workaround mentioned at
http://lists.gnu.org/archive/html/bug-bash/2002-05/msg00052.html . It
should be patch 2.5 in my series.
Alexis
# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Node ID 8c7631095f4591413edfc196c532f0e165df21bc
# Parent ae6b9a6a16b1e2e5f6228126be73bade1d95e897
bash_completion: always use single quotes with compgen -W
This avoids a bug in bash 2.05a
diff -r ae6b9a6a16b1 -r 8c7631095f45 contrib/bash_completion
--- a/contrib/bash_completion Fri Jan 27 00:47:34 2006 -0200
+++ b/contrib/bash_completion Fri Jan 27 00:49:38 2006 -0200
@@ -41,14 +41,14 @@ _hg_commands()
all=$(_hg_command_list)
commands=${all%%$'\n'debug*}
- result=$(compgen -W "$commands" -- "$cur")
+ result=$(compgen -W '$commands' -- "$cur")
# hide debug commands from users, but complete them if
# there is no other possible command
if [ "$result" = "" ]; then
local debug
debug=debug${all#*$'\n'debug}
- result=$(compgen -W "$debug" -- "$cur")
+ result=$(compgen -W '$debug' -- "$cur")
fi
COMPREPLY=(${COMPREPLY[@]:-} $result)
@@ -57,7 +57,7 @@ _hg_paths()
_hg_paths()
{
local paths="$(hg paths | sed -e 's/ = .*$//')"
- COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$paths" -- "$cur" ))
+ COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
}
_hg_repos()
@@ -71,13 +71,13 @@ _hg_status()
_hg_status()
{
local files="$( hg status -n$1 . )"
- COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$files" -- "$cur" ))
+ COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
}
_hg_tags()
{
local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
- COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$tags" -- "$cur") )
+ COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
}
# this is "kind of" ugly...
@@ -123,7 +123,7 @@ _hg()
if [[ "$cur" == -* ]]; then
opts=$(_hg_option_list $cmd)
- COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$opts" -- "$cur") )
+ COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur") )
return
fi
More information about the Mercurial
mailing list