delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/20/03:20:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Thu, 20 Jan 2005 00:20:20 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin programs called from non-cygwin programs mauling \" in args
Message-ID: <20050120082020.GA2600@efn.org>
References: <20050119233410 DOT GA2888 AT efn DOT org> <20050120031101 DOT 981F2170624 AT samwise DOT efn DOT org>
Mime-Version: 1.0
In-Reply-To: <20050120031101.981F2170624@samwise.efn.org>
User-Agent: Mutt/1.4.1i
Organization: bs"d
X-IsSubscribed: yes

On Wed, Jan 19, 2005 at 09:08:13PM -0600, Gary R. Van Sickle wrote:
> 
> > -----Original Message-----
> > From: cygwin-owner AT cygwin DOT com 
> > [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Yitzchak Scott-Thoennes
> > Sent: Wednesday, January 19, 2005 5:34 PM
> > To: cygwin AT cygwin DOT com
> > Subject: Re: cygwin programs called from non-cygwin programs 
> > mauling \" in args
> > 
> > On Wed, Jan 12, 2005 at 10:42:48PM -0800, Yitzchak 
> > Scott-Thoennes wrote:
> > > $ cat child.c
> > > #include <stdio.h>
> > > int main(int argc, char **argv)
> > > {
> > >   printf("[%s]\n", argv[1]);
> > >   return 0;
> > > }
> > > 
> > > $ cat parent.c
> > > #include <unistd.h>
> > > int main(int argc, char **argv) {
> > >   char *args[] = { argv[1], "a\\\"b\\\"c", 0};
> > >   execv( argv[1], args);
> > >   return 1;
> > > }
> > > 
> > > $ gcc -mno-cygwin -Wall parent.c -o nocygparent
> > > parent.c: In function `main':
> > > parent.c:4: warning: passing arg 2 of `execv' from incompatible 
> > > pointer type
> > > 
> > > $ gcc -Wall child.c -o cygchild
> > > 
> > > $ ./nocygparent cygchild
> > > [a\b"c]
> > 
> > Can anybody else confirm this?
> > 
> 
> Lessee....
> 
> ...sorta.  I get:
> 
> "
> $ ./nocygparent cygchild
> 
> ~
> $ [a\b"c]
> "
> 
> And then it sits there waiting for input.  When I hit enter it quits and
> brings me back to the prompt.  This is with snapshot 20050116 and gcc (GCC)
> 3.4.1 (cygming special).
> 
> What happens if you correct the warning?

The error is the fault of the mingw headers being incorrect for exec*,
but makes no difference.  (SuSv3 whines at length about why the headers
need to be as they should be.)

See the $ before the [ there?  That's a shell prompt.  The program already
ended, but the output is a little scrambled (which seems to happen a lot
when there are child processes of late).  Not related to the problem I'm
describing.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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