delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/30/14:50:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <533517069.6831891248978979849.JavaMail.root@sz0059a.emeryville.ca.mail.comcast.net>
References: <20090728091647 DOT GK18621 AT calimero DOT vinschen DOT de> <533517069 DOT 6831891248978979849 DOT JavaMail DOT root AT sz0059a DOT emeryville DOT ca DOT mail DOT comcast DOT net>
Date: Thu, 30 Jul 2009 14:50:10 -0400
Message-ID: <f60fe000907301150u114aecbr3b008a4380737c8@mail.gmail.com>
Subject: Re: [1.7] bash UNC path bug?
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Thu, Jul 30, 2009 at 2:36 PM, Eric Blake wrote:
>> > bash... maybe cygpath, seems to be doing something weird:
> Weird - yes.  But buggy - no.

Backtick-quoting rules are strange.  For instance, single quotes
within backticks still prevent variable expansion:

$ x=1
$ echo `echo '$x'`
$x                           # not "1"

So it's not as simple as backticks working like double quotes (within
which single quotes have no effect whatsoever):

$ echo " '$x' "
'1'

What's going on is that there's a rule that allows nesting backticks
by using successively increasing numbers of backslashes in front of
them:

`outer \`inner \\\`innermost\\\` inner\` outer`

and because of this, backticks essentially add yet another layer of
backslash parsing and removal to the mix.

This is the biggest reason to prefer new-style $(...) command
substitution to backticks.

None of this is Cygwin-specific, we just deal with literal backslashes
more in Cygwinland thanks to DOS-style file paths.




-- 
Mark J. Reed <markjreed AT gmail DOT com>

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019