From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128133 invoked by alias); 5 Sep 2018 15:05:46 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 128011 invoked by uid 89); 5 Sep 2018 15:05:45 -0000 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 Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 15:05:43 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2437804B4B9 for ; Wed, 5 Sep 2018 15:05:41 +0000 (UTC) Received: from [10.10.123.107] (ovpn-123-107.rdu2.redhat.com [10.10.123.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id B69F22027069 for ; Wed, 5 Sep 2018 15:05:41 +0000 (UTC) Subject: Re: Tab completion adding spurious escape characters To: cygwin@cygwin.com References: <5b8f5198.1c69fb81.969c7.a997@mx.google.com> From: Eric Blake Message-ID: <72557c18-24dd-d029-bd97-59811c4c6fda@redhat.com> Date: Wed, 05 Sep 2018 15:05:00 -0000 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00098.txt.bz2 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