| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=I752rkwwQDHDr9Rj | |
| QE+U++/XtLUVZ0LbBY/FyLkM7gVVyjcNL2x3178l16oNwJYDqXIIzNe4dLA3wJiF | |
| QmcmWzJlN9LfaVhdB6nb1MK2wWoXaBE78qUvT1Q16DViCXe77dEWbcp+FjfNhkWK | |
| KtHmsJItw3fMeGX7XRx9egXDO48= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=ubfXmq7J6J08FDI/t9K6+z | |
| +/LE8=; b=AL5P2OSu7ruLS9wXbMfuAuxBxV1YNpnIWBzwG8VFncM0PYRIIG12vy | |
| +LeNQFmTWcVRkB2ujj+oLseb8Aw25jVzlzyORU54UcXOVB45uyhkSTh9iPj2mhue | |
| QC1ykhBTYFGEku5zxDym2ueVLqO8f2ezfqosfL5mmXz5PqFxHqmaA= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Notice, principal, HContent-Transfer-Encoding:8bit |
| X-HELO: | mx1.redhat.com |
| Subject: | Re: Tab completion adding spurious escape characters |
| To: | cygwin AT cygwin DOT com |
| References: | <5b8f5198 DOT 1c69fb81 DOT 969c7 DOT a997 AT mx DOT google DOT com> |
| From: | Eric Blake <eblake AT redhat DOT com> |
| Message-ID: | <72557c18-24dd-d029-bd97-59811c4c6fda@redhat.com> |
| Date: | Wed, 5 Sep 2018 10:05:41 -0500 |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
| MIME-Version: | 1.0 |
| In-Reply-To: | <5b8f5198.1c69fb81.969c7.a997@mx.google.com> |
| X-IsSubscribed: | yes |
On 09/04/2018 10:46 PM, Steven Penny wrote:
> If you create this file:
>
> Â Â touch -- \''-#%.!$&(),;@[]^`{}=_~+9zZ'
>
> Then enter "touch", "Tab", "Tab", you get this:
>
> Â Â touch \'-#%.\!\$\&\(\)\,\;\@\[\]\^\`\{\}\=_~+9zZ
>
> So the shell is saying that these characters need to be escaped:
>
> Â Â ' ! $ & ( ) , ; @ [ ] ^ ` { } =
>
> but they dont, not all of them:
>
> Â Â $ (set -x; true \' \! \$ \& \( \) \, \; \@ \[ \] \^ \` \{ \} \=)
> Â Â + true \' '!' '$' '&' '(' ')' , ';' @ '[' ']' '^' '`' '{' '}' =
>
> Notice carefully that the shell removes escaping for these:
>
> Â Â , @ =
>
> but tab completion is adding it. Is this an issue of Readline or Cygwin?
Not cygwin specific, because you get the same behavior on Linux.
Therefore, it is is an upstream readline/bash decision on what to escape
during tab completion. (And since tab completion is a readline feature,
and readline is implemented by the author of bash, there really is no
reason to assume it would be an issue specific to Cygwin).
Also, whether or not those characters are escaped does not generally
change the actual command line you are executing, and it is a lot less
code to just blindly escape things than to figure out a minimal output,
so I see no reason to bother changing things. (Actually, there ARE
cases where = and \= behave differently, but not in what you typed. For
a demonstration:
$ echo 'echo hi' > ./a=b
$ chmod +x a=b
$ a=c
$ echo $a
c
$ (PATH=:$PATH; a\=b; echo $a)
hi
c
$ (PATH=:$PATH; a=b; echo $a)
b
As for , and @, they are never special to the shell, but as I argued
above, it's easier to write tab completion code that doesn't have to
special case things than to worry about what is or is not special)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |