delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/13/01:43:40

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: Wed, 12 Jan 2005 22:42:48 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: cygwin programs called from non-cygwin programs mauling \" in args
Message-ID: <20050113064248.GA2416@efn.org>
Mime-Version: 1.0
User-Agent: Mutt/1.4.1i
Organization: bs"d
X-IsSubscribed: yes

Given a simple child process that prints its argument, and a parent
that execs it passing a\"b\"c, trying combinations of cygwin and non-
cygwin parent and child shows inconsistency in what's received:

$ 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 child.c -o nocygchild

$ 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

$ gcc -Wall parent.c -o cygparent

$ ./cygparent cygchild
[a\"b\"c]

$ ./cygparent nocygchild
[a\"b\"c]

$ ./nocygparent cygchild
[a\b"c]

$ ./nocygparent nocygchild
[a"b"c]

The a\b"c definitely looks like something going wrong.

(This is breaking things for me when using gcc from a non-cygwin make
program.)

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