Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Errors with ssh and rsync completion in zsh-beta (Debian unstable)
- X-seq: zsh-workers 23658
- From: Peter Stephenson <pws@xxxxxxx>
- To: Damien Wyart <damien.wyart@xxxxxxx>
- Subject: Re: Errors with ssh and rsync completion in zsh-beta (Debian unstable)
- Date: Thu, 5 Jul 2007 19:20:08 +0100
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <20070705162157.GA3988@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <20070705162157.GA3988@xxxxxxxxxxxxxxxxxxxxx>
On Thu, 5 Jul 2007 18:21:57 +0200
Damien Wyart <damien.wyart@xxxxxxx> wrote:
> I get error messages when completing in ssh or rsync commands :
>
> ,----
> | dwyart@dalpdw2:~$ ssh dw
> | _combination:86: bad floating point constant
> | _combination:86: bad math expression: operator expected at `root'
> | dwyart@dalpdw2:~$ ssh dw@b
> | _combination:76: bad math expression: operator expected at `root'
> | _combination:86: bad floating point constant
> | dwyart@dalpdw2:~$ rsync -av dw@b
> | _combination:76: bad math expression: operator expected at `root'
> `----
Thanks for spotting this. Here's what's happened. _combination takes
arguments that may indicate with a suffix :<num> that the num'th match
should be used. However, it's sloppy about testing for the suffix, and if
the suffix isn't present it uses the full expression. This was the name of
an array variable ("hosts" in one of the cases). In previous versions of
the shell, evaluating an array in math context substituted 0 so this went
unnoticed (it still wasn't the right thing to do, obviously). However,
we've now fixed the syntax so that an array evaluated in math context does
what (I would think) you always expected it would.
The fix is to test for a number properly in _combination.
Index: Completion/Base/Utility/_combination
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_combination,v
retrieving revision 1.1
diff -u -r1.1 _combination
--- Completion/Base/Utility/_combination 2 Apr 2001 11:10:08 -0000 1.1
+++ Completion/Base/Utility/_combination 5 Jul 2007 18:17:00 -0000
@@ -72,13 +72,21 @@
while [[ "$1" = *=* ]]; do
tmp="${1%%\=*}"
key="${tmp%:*}"
- num="${${tmp##*:}:-1}"
+ if [[ $1 = *:* ]]; then
+ num=${tmp##*:}
+ else
+ num=1
+ fi
pats[$keys[(in:num:)$key]]="${1#*\=}"
shift
done
key="${1%:*}"
-num="${${1##*:}:-1}"
+if [[ $1 = *:* ]]; then
+ num=${1##*:}
+else
+ num=1
+fi
shift
if zstyle -a ":completion:${curcontext}:$tag" "$style" tmp; then
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author