delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4C51F0AD.9080605@redhat.com> |
Date: | Thu, 29 Jul 2010 15:20:45 -0600 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Inconsistent escaping of bash commands (depends on the first command) |
References: | <AANLkTimwjHa+sZOpzcLOQ+jerreG2vOKT8P0W+C6B4Sm AT mail DOT gmail DOT com> |
In-Reply-To: | <AANLkTimwjHa+sZOpzcLOQ+jerreG2vOKT8P0W+C6B4Sm@mail.gmail.com> |
X-IsSubscribed: | yes |
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 |
--------------enig0B4C049FF90DB72E49EC0E0D Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/29/2010 03:13 PM, Ives van der Flaas wrote: > 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: >=20 > 1 C:\cygwin\bin>bash.exe -x -v -c "C:\\s \\" There's your problem - you are expecting sane quoting rules from cmd. The quoting rules for cmd are vastly different from the quoting rules for bash itself. Also, remember that cmd does not do globbing before invoking a command, but neither do cygwin apps do it on entry (they expect the shell to have already done it). Therefore, when a cygwin app detects that it was invoked by a non-cygwin app, cygwin must do the globbing before main(); and yes, the rules for what cygwin1.dll will try to glob depend heavily on how much the command line argument passed by cmd looks like it might need globbing. You may be better off writing a shell script with the command you really want to run, and just calling 'bash path/to/script' than trying to call 'bash -c "complicated command"' from cmd. --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig0B4C049FF90DB72E49EC0E0D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMUfCtAAoJEKeha0olJ0Nq4MwH/3h3TrFr7ZNJ/CS27beT5KIu mSAGPU7tzjpNc6ONYMA5WyF43u24eHx1UhFFek36msTlnc1zOEFsYE2grnOy2sro MaZ6kDdVKaBolxUxwKcMu/R9j8dabb+TGf9BySzS9lLzf67R7qWIcOIjh09iz5nS OOrklQVSCzKjNQjMpnnyuA24h86WxN+RZV+jMmosJEldyLgP4xU77Rp1MTBu/9FW E+T6hE7ooMPRh0FaWA3cx7lPYXrU6hEY9avwzDynVA1k49+fhzQKKxscljTDKZU3 94a8mbkF9y2l9VMEYaO1GSv9LzE9Z0CN+yYjrkUJqp0ZWnXZLCCa8s0z+jvFtw0= =zltM -----END PGP SIGNATURE----- --------------enig0B4C049FF90DB72E49EC0E0D--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |