https://bugzilla.redhat.com/show_bug.cgi?id=541423#c3
Done by adding the eval back. The only thing that this breaks AFAIK
is handling of known hosts filenames that have more than one
consecutive space in them, but I couldn't figure out how to get both
to work and IMO support for files starting with ~ is much more
important.
https://bugzilla.redhat.com/show_bug.cgi?id=541423#c2
As a side effect, this simplifies things somewhat and grabs user and
global known hosts filenames from config files with one command
instead of doing one for each.
This fixes the auto tests for `finger' and `ssh' on machines where an IPv6 host
"::1" is mentioned in /etc/hosts.
Added helper function __ltrim_colon_completions.
To run the tests:
./runCompletion finger.exp ssh.exp
Changed the last `echo' to a `printf' to make completing `-n' or '-e'
come through. Declaring a function local (break_index & word_start)
also doesn't work on my machine: the functions become visible global. I
considered doing an unset -f at the end of __get_cword4, but I made them
global (__break_index & __word_start) because they're used so often.
Thanks to Sung Pae (Alioth #312030):
"This patch extends both __get_cword3() and __get_cword4() to accept an
additional integer argument that specifies how many places previous to
the current word the desired word resides, respecting any user
exceptions to COMP_WORDBREAKS."
This fixes a bug under bash-4 where completing:
scp -F 'spaced conf' <TAB>
causes `dequote' to yield errors:
bash: eval: line 1: unexpected EOF while looking for matching `''
bash: eval: line 2: syntax error: unexpected end of file
The bug occurs because of a bug in bash-4.0, where quoted words are split
unintended, see: http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
Workaround is now to silence `dequote' in case of errors and wait for bash-4 to
be fixed...
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
Needed to add okular-specific completions: xps, epub, odt, fb, mobi,
g3 and chm.
Also, okular can read any of its formats also in .gz/.bz2 compressed
format, so change the regular expression to match this.
- Added code comments to _get_cword, __get_cword3 & __get_cword4
- (testsuite) Added tests for _get_cword
- (testsuite) Bugfixes assert_bash_exec() && match_items()
Bash-4 splits COMP_WORDS using characters from COMP_WORDBREAKS, but has
a bug where quoted words are also splitted, see:
http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
__get_cword3 is used for bash-2/3 and __get_cword4 is used for bash-4.
__get_cword4 handles well temporarily disabling of COMP_WORDBREAK
characters, but fails quoted words (a 'b c) and subshells (a $(b c).
See the expected failures when running the automated tests.
__get_cword3 does a better job of returning quoted words.
To run the automated tests on bash-3/4:
$ ./runUnit _get_cword.exp [--tool_exec <path to bash-3/4 binary>]
`_get_cword' is reverted to before commit f6497298.
This fixes unittest:
"a b:c| with WORDBREAKS -= : should return b:c"
(| = cursor position)
notably by restoring passing an argument to _get_cword to omit
characters from $COMP_WORDBREAKS.
At the end of `get_cword', `echo "$cur"' has been changed to `printf
"%s" "$cur"'. This fixes unittest:
"a -n| should return -n"
(| = cursor position)
This reverts commit 11d4d978876ceb58eaec5dcfd82fae7b9699acfd.
Avoiding breaking completion for the sudo'd command isn't as
straightforward as I thought.
See also bugreport Alioth #311614.
Added tests for the awk script processing IP numbers. To run the tests:
cd test
./runUnit _known_hosts_real.exp
./runCompletion ssh.exp scp.exp sftp.exp
Quote sed output ("\1") retrieving "GlobalKnownHostsFile/UserKnownHostsFile" to
prevent bash globbing of special characters, e.g. '*'.
Added unit test "Config file containing star (*) should work".
Added test library function `assert_bash_list()'.
To run unit tests:
cd test && ./runUnit _known_hosts_real.exp