Should be tested on bash < 4; on bash4 it gave:
awk: /^[[:space:]]*Channel/ {print $4\"G\"}
awk: ^ backslash not last character on line
(similarly for "rate")
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...
Reverting yesterdays commit d3187b6f3 (Bugfix completing scp/sftp/ssh -F '' on bash-4), which said:
set -- "${COMP_LINE:0:$COMP_POINT}"
The problem with the line above is that it needs to be unquoted for `set' in order to break up COMP_LINE into separate arguments:
set -- ${COMP_LINE:0:$COMP_POINT}
But this will yield error "unexpected EOF while looking for matching `''" if COMP_LINE is containing unbalanced single/double quotes, e.g.:
eval set -- scp -F 'config
Use ${COMP_LINE:0:$COMP_POINT} instead of ${COMP_WORDS[@]} when searching for
-F configfile in scp/sftp/ssh. 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
Also, using ${COMP_LINE:0:$COMP_POINT} is an improvement, because it takes the
current cursor position into account.
Changed `out' parameter of `assert_bash_exec()' to accept also -1 and 0:
@param mixed $out (optional) Reference to variable to hold output.
If variable equals -1 (default) the bash command is
expected to return no output. If variable equals 0,
any output from the bash command is disregarded.
This fixes the situation of commit cfcf9fa where contrib/ri was causing
invisible errors when running the test suite.
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.
From apt-cache(1):
-g, --generate
Perform automatic package cache regeneration, rather than use the
cache as it is. This is the default; to turn it off, use
--no-generate. Configuration Item: APT::Cache::Generate.
Should make calls to apt-cache faster.
- 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>]
Using option `--tool_exec' you can now specify which bash binary you
want to use:
$ ./runUnit --tool_exec /opt/bash-4/bin/bash
$ ./runCompletion --tool_exec /opt/bash-4/bin/bash
If not specified, current `bash' as found in the tcl path (/bin/bash)
will be used.