Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Message-ID: <006f01bfeeea$ac86da20$f7c723cb@lifelesswks> From: "Robert Collins" To: References: <004801bfeed8$5a75f610$f7c723cb AT lifelesswks> <20000715234510 DOT A8476 AT cygnus DOT com> <005c01bfeede$10604c00$f7c723cb AT lifelesswks> <20000716003824 DOT A8880 AT cygnus DOT com> <006401bfeee6$24ba9680$f7c723cb AT lifelesswks> <20000716013341 DOT A9284 AT cygnus DOT com> Subject: Re: two questions Date: Sun, 16 Jul 2000 15:57:01 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 The output was very similar yes. Is there any chance you could post the patch? Or mail it to me? Thanks Rob ----- Original Message ----- From: "Chris Faylor" To: Sent: Sunday, July 16, 2000 3:33 PM Subject: Re: two questions > On Sun, Jul 16, 2000 at 03:24:35PM +1000, Robert Collins wrote: > >This sample program demonstrates the problem. I am using execvp for my my > >code, by exec() I actually meant the exec family of calls... I'll try to be > >clearer next time.. > > > >#include > > > >int > >main (int argc, char **argv) > >{ > > char *prog; > > char passarg[]="A"; > > fprintf (stderr, "argv[0] '%s', argv[1] '%s'\n", argv[0], argv[1]); > > prog=(char *)strdup(argv[0]); > > if (argv[1]==NULL) > > { > > fprintf(stderr, "called with no args going to run '%s' with '%s' > >\n",prog,passarg); > > sleep(5); > > execl (prog,prog,passarg ); > > /* SHOULD NEVER REACH */ > > fprintf(stderr, "exec failed!\n"); > > sleep(10); > > } > > sleep(10); > >} > > Both of our test programs had bugs in them. Mine would core dump if > there was more than one argument. Yours SEGVs every time for me, although > it could also just SEGV randomly, I suppose. > > The reason is that execl needs to be terminated with a NULL final > argument. > > Regardless, my analysis of what was going wrong is still probably > correct. You didn't report on the output of any of the test > cases but I would guess that, when run from explorer, you'd see > something like: > > argv[0] '"c:\cygwin\usr\local\pathtest\pathtest"', argv[1] '(null)' > ^^ ^^ > > The extra levels of quoting are what was screwing up cygwin. As > I mentioned, I just checked in a patch to fix this. > > cgf >