delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/05/06/09:17:53

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:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=dv
O9w94lo8hLlDqfSfznISNE80LvQ8MqJ0nrCPCXZr03hc+LSdVTpQP9l6KnABcGiB
m1qOAH/aVJzXprnmXvTI4I+he37NZZxK0suWeV9KW/Z51wX+jjswzoHN/6lWBO6S
VoceHvrF/eoeKXhrHFZYHvEmI+epWDjhucs4UdRsk=
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:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=REdtrz/0
idjNUCsvazPN9CRZqNI=; b=xD2fcXRqNppQqKUIMtTJIrjRVV/P9TAnPSaTj7VZ
OtwSyzNqgH3sziBuIjkVsVPp8jDFcdVsQtIJBiSGFD7Dp4fIH1L3sFZTOmTE26IH
khQxRam+5OEpDApes4Kp9kd3tDZCHSZFPgK0aDs7fMlg3XAw+BXS9b1vG00U2Q4z
/2M=
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=0.4 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=createprocess, API's, api's, dcrt0.cc
X-HELO: mail-lf0-f53.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to; bh=pYvwxB4Lv6nAH+N8DNo4L0aMsFlyDaCOZYGjJ/is5bw=; b=SFLUdwQamMvlKPEqu+8kNx3S+JTqkU8GHpZeGd5JQ+0fl7a2K0TLxrgQxGrTbDqdUP TnWZz3axzOoqnd79rUPgKHD55XVZncgE86R6Y7SOHsDpEmKVxjK7DH5SdlzQxyYXf5dG eIRNTX0fLLfy/qtWPRfxv5OilVLIaWf4GCeib7hjqJSs2ROUhXcUYFIzE3OM0wtOyh3u uFDVIFkJgVvyxNBCKHkK8rJysHTzNb7im0Ei+7m7oTwoVK3sbHfljnmM4nb/aBIfkirI IxfW33Qe3GEkw7Mken80aZgd/YJXd93IYtqTeIHIjSUQLtXk5qDIap4LhENTDosTXVi3 7lhg==
X-Gm-Message-State: AOPr4FWZLbKHla2KwZHCujbVDr1d0e2xulHWqaq4/y2VhM6AiW27BBSq0RKxnqIKyvqlF2agnaJKriauLBXX8g==
MIME-Version: 1.0
X-Received: by 10.112.162.169 with SMTP id yb9mr9805956lbb.70.1462540649364; Fri, 06 May 2016 06:17:29 -0700 (PDT)
In-Reply-To: <000101d1a76d$c37c6b80$4a754280$@metastack.com>
References: <005c01d1a6e2$30270ba0$907522e0$@metastack.com> <CACoZoo1LObZ0zu9X5O6dV4cO4jN+GO28bdRbuDkTMdaKHXpVbQ AT mail DOT gmail DOT com> <000101d1a76d$c37c6b80$4a754280$@metastack.com>
Date: Fri, 6 May 2016 09:17:29 -0400
Message-ID: <CACoZoo3vE7ScvCy1m=vZQxChzh8xMTuSL8bcDqDqtqyqKMq7ew@mail.gmail.com>
Subject: Re: Formatting command line arguments when starting a Cygwin process from a native process
From: Erik Soderquist <ErikSoderquist AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

On Fri, May 6, 2016 at 4:03 AM, David Allsopp wrote:
>
> [With apologies if threading is broken; I erroneously thought as
> the list was not subscriber-only that replies would use reply-all
> and so wasn't subscribed]

Didn't break for me, though that might be google's threading in gmail
rather than standard threading.

> > C:\cygwin64\bin>.\echo.exe -e ^"hello\nworld^"
> > hello
> > world
> >
> > works.
>
> Indeed - but I'm not using cmd, or any shell for that matter
> (that's actually the point) - I am in a native Win32 process
> invoking a Cygwin process directly using the Windows API's
> CreateProcess call.  As it happens, the program I have already
> has the arguments for the Cygwin process in an array, but Windows
> internally requires a single command line string (which is not in
> any related to Cmd).

The you are way over my head...


> > However, I've found Windows's interpretation to be inconsistent, so often
> > have to play with it to find what the "right combination" is for a
> > particular instance.
> >
> > I find echoing the parameters to a temporary text file and then using the
> > file as input to be more reliable and easier to troubleshoot, and it
> > breaks apart whether it is Windows cli inconsistencies or receiving
> > program issues very nicely with the text file content as an intermediary
>
> This is an OK tack, but I don't wish to do this by experimentation
> and get caught out later by a case I didn't think of, so what I'm
> trying to determine is *exactly* how the Cygwin DLL processes the
> command line via its source code so that I can present it with my
> argv array converted to a single command line and be certain that
> the Cygwin will recover the same argv DLL.
>
> My reading of the relevant sources suggests that with globbing
> disabled, backslash escape sequences are *never* interpreted (since
> the quote function returns early - dcrt0.cc, line 171). If there is
> no way of encoding the double quote character, then perhaps I have
> to run with globbing enabled but ensure that the globify function
> will never actually expand anything - but as that's a lot of work,
> I was wondering if I was missing something with the simpler
> "noglob" case.

Again, way over my head, I'm currently a shell scripter...

-- Erik

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