Subject: Re: fork bugs (was: newbie)
From: [email-masked] (Shankar Unni)

22 Jan 1997 20:09:56 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Content-Type: text
Original-To: [email-masked] (Scott Kempf)
Original-Cc: [email-masked]
In-Reply-To: <[email-masked]> from "Scott Kempf" at Jan 21, 97 01:48:21 pm
X-Mailer: ELM [version 2.4 PL23]
Original-Sender: [email-masked]

Scott Kempf said:

> One more fork bug.  I has some problems with fork where
> I had an executable in . and one in /usr/local/bin which
> where two different versions of the same program.  Fork
> choose to spawn the wrong one and made quite a mess trying
> to copy in the data section.  I found the problem and
> removed the out dated executable from  /usr/local/bin.
> Later I decided to try to fix this bug, but I have been
> unable to recreate it.  If someone has a simple example
> of this bug I'd love to try to fix the problem.

Does the cygwin fork() try to find the executable using $PATH if
argv[0] is a relative path name? If so, then yes, I can see how you
can easily cause something like this to happen:

Consider

 PATH=xxx:/usr/local/bin:xxxxx:.

(i.e. /usr/local/bin in $PATH before ".").  

Now, you start up ./executable from some other process using

  execle("./executable", "executable", ....)

and executable tries to fork. Oops - it sees a path-less argv[0],
tries to look it up in $PATH, and gets the wrong one. 

-- 
Shankar Unni                                  [email-masked]
Chromatic Research                            (408) 752-9488
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".