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:mime-version:date:message-id:subject:from:to | |
:content-type; q=dns; s=default; b=Q7M8bLwf+uBs59vY3/h7UiZGlK7A8 | |
DnoLgesX7RS5BCLpaojZJ5X6K06oWr6nKRDASz0dBczEQRXtXtxqxowT7xySeSFR | |
+CPGttLKoKvbHhV22PIS26T1QXgveN3+4UeoFDYwKbhWKCyM95PfUsZhigjnbC/X | |
zZjBAMvZa1RPH8= | |
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:mime-version:date:message-id:subject:from:to | |
:content-type; s=default; bh=TPfmAJGeVPEVVF6NYbTXQJTbniw=; b=SjU | |
noAqE5bPEdBz+KBh+4DEgtciMZB+3qhMqIiiO56LmIk8gfea1M3mcxOfyPWkaBV2 | |
eaPuUCD4fwZ22WRGNgmLB/TV7E9Dzm6z57tT+DD4ykDqsBbMoac67i3gSPxzgSYB | |
NsdUN/ZMjwfWmjCSAXK0fYoZ6ekfwb8+kuf+EHjY= | |
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-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=3.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
X-HELO: | mail-yk0-f176.google.com |
MIME-Version: | 1.0 |
X-Received: | by 10.13.213.3 with SMTP id x3mr8402968ywd.156.1434563770396; Wed, 17 Jun 2015 10:56:10 -0700 (PDT) |
Date: | Wed, 17 Jun 2015 20:56:10 +0300 |
Message-ID: | <CAMSC8GNk-V8qW3jKLOFayN8HRckOWdpwS26rzG_ofH4O3=s=og@mail.gmail.com> |
Subject: | Arguments parsing in cygwin executables |
From: | Sasha Unknown <sasha2048 AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
Hello. ==Preamble== Some time ago I noticed that cygwin executables (e.g. bash, tar, echo & so on) handle specially *, {} and some other symbols in command-line, even when being invoked not from shell (e.g. programmatic invocation or cmd.exe). After some googling, I found CYGWIN=noglob setting, which fixed the issue. After enabling it I hoped that cygwin executables will start parsing command-line in a standard for Windows executables way (I am not talking about path translation, only about handling special characters and splitting command string into argv array). ==Main== It revealed that even with CYGWIN=noglob, cygwin executables parse command line differently from other windows executables. (Again, I underline: I'm talking about invocation from cmd.exe or programmatic invocation, not invocation from bash.) Concretely, the 3rd and 4th test-cases from here fail: https://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx. (BTW, ironically, with CYGWIN=glob only 3rd test-case fails.) ==Questions== So, questions are: 1. Is this behavior intentional, or is it bug? 1a. If intentional: Maybe there is a way to force cygwin executables to perform command-line parsing in windows-canonical way (i.e. CommandLineToArgv-like)? (I am talking about splitting command string into argv array, not about path translation.) 2. In any case, could you point me to part of cygwin sources which is responsible for this? (In case of intentionality -- to understand what behavior I'm now forced to adopt to, in case of bug -- to possibly aid fixing.) ==Test cases== 1. I compiled code from the link above with g++. 2. And written simple simple script in bash: > #!/bin/bash > for a in "$@"; do echo "$((++i)): $a"; done Both have same behavior, which differs from canonical windows parsing. ==Additional== What I'm trying to do? I am trying to find proper way of passing parameters to cygwin executables from non-cygwin application (which doesn't even know that it's dealing with cywgin). I suppose that if one wants *nix-typical parsing, he will use some shell (e.g. bash), or at least CYGWIN=glob. BTW, in CYGWIN=glob mode, curly braces are handled wrongly (c:\cygwin\echo.exe {aa} should return {aa}, not aa; because no , or .. inside {}). -- 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 |