delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/29/17:14:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=4.1 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
From: Ives van der Flaas <ives DOT vdf AT gmail DOT com>
Date: Thu, 29 Jul 2010 23:13:57 +0200
Message-ID: <AANLkTimwjHa+sZOpzcLOQ+jerreG2vOKT8P0W+C6B4Sm@mail.gmail.com>
Subject: Inconsistent escaping of bash commands (depends on the first command)
To: cygwin AT cygwin DOT com
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

After a good few hours of searching, I've distilled this down as far
as humanly possible. The problem I'm encountering is that if I tell
bash.exe to execute the commands in parameter (using the -c flag),
escaping varies based on what commands I give bash.
A more detailed example:

1 C:\cygwin\bin>bash.exe -x -v -c "C:\\s \\"
2 C:\\s \\
3 + 'C:\s' '\'
4 bash: C:\s: command not found
5 C:\cygwin\bin>bash.exe -x -v -c "C\\s \\"
6 C\s \
7 + Cs
8 bash: line 1: Cs: command not found

Please note that lines 2 and 6 are just bash telling me what command I
gave it. On line 2 you can clearly see how the last argument received
by bash is \\. On line 6 the last argument is a single \. Notice how I
only removed a colon several characters earlier?

With a lot of good will, I can maybe see how this could be useful in
some rare situations. Is this documented behavior? Is there a way to
turn this off? Is the regex /^[a-zA-Z]:/ the only time bash does this?

Thanks
Ives

--
Ives van der Flaas
Wijntuinstraat 10
2330 Merksplas
=E2=98=8E 0499/31.54.37
www.GoodSoft.be

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