delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/19/14:26:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <F10D23B02E54D011A0AB0020AF9CEFE988F977@lynx.ceddec.com>
From: "Town, Brad" <btown AT ceddec DOT com>
To: "'cygwin AT sources DOT redhat DOT com'" <cygwin AT sources DOT redhat DOT com>
Subject: RE: Make --win32 shell bug?
Date: Thu, 19 Oct 2000 14:27:09 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

------_=_NextPart_000_01C039FA.315ADEE0
Content-Type: text/plain

Attached is a patch to winsup/cygwin/spawn.cc -- it's the final piece of the
puzzle.  It and the patches I sent yesterday fix the make --win32/cmd.exe
problem.

Details:
When you provide both the first and second parameters to CreateProcess, it
doesn't use the search path to find the executable.  It wasn't finding
cmd.exe because it didn't have a path specified.

This appears to be a problem for cygwin only when attempting to spawn/exec
"cmd.exe /c ..." in spawn_guts.  I added a call to SearchPath for this case
to find the full path to the executable.

Brad Town

PS  Anyone else having problems with today's sources from CVS?  I'm getting
stack dumps all the time with make, bash, etc.  I guess I may have to
actually learn how to extract earlier versions from CVS.  :)


> Attached are two patches to avoid the stackdump with 
> make-3.79.1-1 and the
> Makefile I was using to test them.
> 
> The patch to job.c fixes the access violation; the patch to 
> function.c fixes
> a tiny bug when nothing is read into the buffer but later 
> code assumes it's
> a null-terminated string.
> 
> Note that it still doesn't work 100%:
> 
> make: cmd.exe: Command not found
> make: Nothing to be done for `all'.
> 
> Anyone else want to help?
> 
> Brad Town
> 
> 
> > On Wed, Oct 18, 2000 at 08:55:27AM +0200, Axel Kittenberger wrote:
> > >Hi,
> > >
> > >the
> > >-----------------------------------------
> > >OBJLST := $(shell echo hello)
> > >-----------------------------------------
> > >was originally one line, only out of some reason my mailer 
> > thought it's
> > >better to devide it ;) (hope this time it work's)
> > >
> > >yes i was running make 3.79-3, since the version number 
> felt somehow
> > >"higher", however i downloaded now 3.79.1-1, but the stack 
> > error remains the
> > >same....
> > >
> > >Well running in the bash shell invoking make without --win32 works
> > >correctly, but starting it from a DOS-BOX with --win32 
> > yields me to that stack dump
> > >:(
> > 
> > Oops.  Today I *can* duplicate it.  I must not have been 
> > adding --win32
> > yesterday.
> > 
> > Anyway, if you would like to submit a patch to fix this 
> behavior, I'll
> > release a new version of make.
> > 
> > cgf


------_=_NextPart_000_01C039FA.315ADEE0
Content-Type: application/octet-stream;
	name="spawn.cc.diff"
Content-Disposition: attachment;
	filename="spawn.cc.diff"

--- spawn.cc	Thu Oct 19 13:58:16 2000
+++ spawn.cc.mine	Thu Oct 19 13:53:11 2000
@@ -352,12 +352,27 @@
   if (ac == 3 && argv[1][0] == '/' && argv[1][1] == 'c' &&
       (iscmd (argv[0], "command.com") || iscmd (argv[0], "cmd.exe")))
     {
-      one_line.add (argv[0]);
+      /* Find the full path to the executable */
+      debug_printf("looking for %s", argv[0]);
+      char sz[1024];
+      char * pch;
+      if (!SearchPath(0, argv[0], 0, sizeof(sz)/sizeof(sz[0]), sz, &pch)) {
+	debug_printf("could not find %s", argv[0]);
+	set_errno(ENOENT);
+	return -1;
+      }
+
+      debug_printf("found at %s", sz);
+
+      /* Add quotes just in case the path or filename has spaces */
+      one_line.add ("\"");
+      one_line.add (sz);
+      one_line.add ("\"");
       one_line.add (" ");
       one_line.add (argv[1]);
       one_line.add (" ");
       one_line.add (argv[2]);
-      strcpy (real_path, argv[0]);
+      strcpy (real_path, sz);
       goto skip_arg_parsing;
     }
 


------_=_NextPart_000_01C039FA.315ADEE0
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------_=_NextPart_000_01C039FA.315ADEE0--

- Raw text -


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