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.19546 secs); 17 Aug 2016 19:38:43 -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=1471462720; bh=UqMx7p2zrr3o4ia
	nU3oeJwEi0gdX4kCiHFMgu/iePXY=; b=fvWHictMg6JMknWfXILiq3yVlVrWJvL
	qeey4hYSVSf2FaHE2NmpZjq8oxoR7s/pSacxYe+E436ytzATfo2rdsSJDUn3PDyb
	jkPDzwEg2Y90KmtDviyNcqAChRoOXjGaHxvp/UV22Xn9JEN5f/0g55WioxyBr8Xy
	/Wx/aC3SfZoI=
Subject: Re: SSH hostname completion with common suffix and globcomplete
 inserts characters
To: zsh-workers@zsh.org
References: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
From: Daniel Hahler <genml+zsh-workers@thequod.de>
Message-ID: <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>
Date: Wed, 17 Aug 2016 21:38:39 +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: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature";
 boundary="RPe7QBdKuhvNNulkBCl8olOT8p2RKaLa9"
X-Seq: zsh-workers 39055

--RPe7QBdKuhvNNulkBCl8olOT8p2RKaLa9
Content-Type: multipart/mixed; boundary="x4HrNBHaW5xFUvxaHcpuw2cnQp20WEX5T"
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Message-ID: <ff26da9c-c16f-d148-1753-a4f55c8cb99f@thequod.de>
Subject: Re: SSH hostname completion with common suffix and globcomplete
 inserts characters
References: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
In-Reply-To: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>

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

Another, seemingly related issue:

Given ssh_config2:

  Host foo-test-05827d88.foo.bar bar-test-6cae9ce0.foo.bar

% ssh -F ssh_config2 test<TAB>

completes to

% ssh -F ssh_config2 -test-|.foo.bar

and a second invocation of the completion will then use the "-t" at the
beginning (for "escape character (or `none')").

Should this get quoted on expansion to prevent this?


When quoting it manually, I see a similar issue as described before (see
below), where

  ssh -F ssh_config2 '-test-<TAB>.foo.bar'

gets expanded to

  ssh -F ssh_config2 '-test-BR.foo.bar'

(without the globcomplete option though!)


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.
>=20
>=20
> % autoload -Uz compinit
> % compinit
> % echo "Host test-05827d88.foo.bar test-6cae9ce0.foo.bar" > ssh_config
> % setopt globcomplete
>=20
> With
>=20
> % ssh -F ssh_config test-<TAB>
>=20
> You will get:
>=20
> % ssh -F ssh_config test-|.foo.bar
>=20
> Pressing TAB again results in:
>=20
> % ssh -F ssh_config test-|BR.foo.bar
>=20
> The characters being inserted seem to come from the "bar".
>=20
> With ".dot.com" at the end I am seeing "CM" being inserted.
>=20
> With "Host test-05.dot.com test-6c.dot.com" however "D" is being
> inserted.
>=20
> And with a single TLD (i.e. "test-05827d88.com test-6cae9ce0.com") it
> works.
>=20
> In _ssh_hosts the following is used, which seems to be relevant, since
> the inserted characters are uppercased:
>=20
>     compadd -M 'm:{a-zA-Z}=3D{A-Za-z} r:|.=3D* r:|=3D*' "$@" $config_ho=
sts
>=20
> zsh 5.2-dev-1, 062aeca.
>=20
>=20
> Thanks,
> Daniel.
>=20


--x4HrNBHaW5xFUvxaHcpuw2cnQp20WEX5T--

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

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

iEYEARECAAYFAle0vT8ACgkQfAK/hT/mPgBJZgCg2v26u382A5qQkuRqezAIEc1+
BO8AoK2beAAgARHWX0BcWrSZPTl+ItUj
=bkmp
-----END PGP SIGNATURE-----

--RPe7QBdKuhvNNulkBCl8olOT8p2RKaLa9--

