Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Qmail-Scanner-Diagnostics: from hahler.de by f.primenet.com.au (envelope-from <genml+zsh-workers@thequod.de>, uid 7791) with qmail-scanner-2.11 
 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1.  
 Clear:RC:0(188.40.33.212):SA:0(1.3/5.0):. 
 Processed in 0.221234 secs); 17 Aug 2016 22:52:56 -0000
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: *
X-Spam-Status: No, score=1.3 required=5.0 tests=SPF_PASS,T_DKIM_INVALID,
	URI_HEX autolearn=no autolearn_force=no version=3.4.1
X-Envelope-From: genml+zsh-workers@thequod.de
X-Qmail-Scanner-Mime-Attachments: |signature.asc|
X-Qmail-Scanner-Zip-Files: |
Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.hahler.de designates 188.40.33.212 as permitted sender)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h=
	content-type:content-type:in-reply-to:mime-version:user-agent
	:date:date:message-id:from:from:references:subject:subject
	:received:received; s=postfix2; t=1471474367; bh=qDxW4dqDFxeZTpl
	h22WHHgkXtkphqzFfZGvBxzE4STU=; b=FLRjLzViZ7uiVCj8FlAok/ggsi7Wx6N
	veWfwqC8eo5Q16ydB+QyGd5ctKMOZW+sDCSSlQKqtGaIkRlnhKr36crT9ejKqHO3
	mo75Z2Lk2xjgN0RfpwJKH7Pzt0rs6Z8tLbr0oeE/fuca2HD+Q4PGyz+FIhZXU2Cn
	dyJ9yVAZTMkw=
Subject: Re: SSH hostname completion with common suffix and globcomplete
 inserts characters
References: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
 <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Message-ID: <174db3fa-2af2-d43b-3978-5cb789af4ed9@thequod.de>
Date: Thu, 18 Aug 2016 00:52:47 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature";
 boundary="IUVVp04dI7QTdQlcv8T3DqVgkK2APQN6C"
X-Seq: zsh-workers 39057

--IUVVp04dI7QTdQlcv8T3DqVgkK2APQN6C
Content-Type: multipart/mixed; boundary="Q1vnAjWdD2Nl84OIFFNmG9QO5nQwd7mVn"
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Message-ID: <174db3fa-2af2-d43b-3978-5cb789af4ed9@thequod.de>
Subject: Re: SSH hostname completion with common suffix and globcomplete
 inserts characters
References: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
 <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>
In-Reply-To: <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>

--Q1vnAjWdD2Nl84OIFFNmG9QO5nQwd7mVn
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

> % ssh -F ssh_config2 -test-|.foo.bar
>=20
> and a second invocation of the completion will then use the "-t" at the=

> beginning (for "escape character (or `none')").
>=20
> Should this get quoted on expansion to prevent this?

This would need to be escaped using a backslash at the beginning:

  ssh -F ssh_config2 \-test-.foo.bar

> When quoting it manually, I see a similar issue as described before (se=
e
> below), where
>=20
>   ssh -F ssh_config2 '-test-<TAB>.foo.bar'
>=20
> gets expanded to
>=20
>   ssh -F ssh_config2 '-test-BR.foo.bar'
>=20
> (without the globcomplete option though!)

The insertion of "BR" does not happen with "zsh -f" though.  It is
caused by matcher-list zstyle setting in my config: 'r:|[._-]=3D*'

My full setting (based on the one from oh-my-zsh):

  zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}=3D{[:upper:]}' \
    'm:{[:upper:]}=3D{[:lower:]}' 'r:|[._-]=3D* r:|=3D*' 'l:|=3D* r:|=3D*=
'

While looking at it, it seems like 'r:|[._-]=3D* r:|=3D*' is redundant, b=
ut
the "COMPLETION MATCHING CONTROL" section in zshcompwid(1) is not really
trivial.

For some other reason I cannot reproduce the issue of "BR" being
inserted when using ssh_config2 with "zsh -f" just by using the same
matcher-list zstyle config.


> On 17.08.2016 21:16, Daniel Hahler wrote:
>> When using TAB completion (via expand-or-complete, and "setopt
>> globcomplete") on a partial hostname where alternatives with a common
>> suffix exist, the second invocation of TAB will insert some character(=
s)
>> that make it fail to complete afterwards.
>>
>>
>> % autoload -Uz compinit
>> % compinit
>> % echo "Host test-05827d88.foo.bar test-6cae9ce0.foo.bar" > ssh_config=

>> % setopt globcomplete
>>
>> With
>>
>> % ssh -F ssh_config test-<TAB>
>>
>> You will get:
>>
>> % ssh -F ssh_config test-|.foo.bar
>>
>> Pressing TAB again results in:
>>
>> % ssh -F ssh_config test-|BR.foo.bar
>>
>> The characters being inserted seem to come from the "bar".
>>
>> With ".dot.com" at the end I am seeing "CM" being inserted.
>>
>> With "Host test-05.dot.com test-6c.dot.com" however "D" is being
>> inserted.
>>
>> And with a single TLD (i.e. "test-05827d88.com test-6cae9ce0.com") it
>> works.
>>
>> In _ssh_hosts the following is used, which seems to be relevant, since=

>> the inserted characters are uppercased:
>>
>>     compadd -M 'm:{a-zA-Z}=3D{A-Za-z} r:|.=3D* r:|=3D*' "$@" $config_h=
osts
>>
>> zsh 5.2-dev-1, 062aeca.
>>
>>
>> Thanks,
>> Daniel.
>>
>=20


--Q1vnAjWdD2Nl84OIFFNmG9QO5nQwd7mVn--

--IUVVp04dI7QTdQlcv8T3DqVgkK2APQN6C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAle06r8ACgkQfAK/hT/mPgByegCgj4aLK/11T3+VltofxVLfD27p
O4EAoNm4/aKfJcBQLi36795bHsxX0ySi
=95Ez
-----END PGP SIGNATURE-----

--IUVVp04dI7QTdQlcv8T3DqVgkK2APQN6C--

