This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: using spawn functions to avoid fork() errors -- FIXED


> >> On 2/6/2014 8:50 AM, Steven Bardwell wrote:
> >>> Larry - thanks for the link to the source for the spawn() APIs.  It
> > works
> >>> perfectly on my 32-bit install (where, as it happens, the fork() issue
> >>> never shows up either).
> >>>
> >>> However, on my 64-bit install, the spawnv() call is returning with an
> >>> error -- 'No such file or  directory' -- when I try to spawn /bin/sh.
> >>> I have attached the output from 'strace' on this process. If you look
at
> >>> line 602, I think you can see where the exception gets generated. Can
> >>> you see what is going on? I tried to create a simple test program that
> >>> shows the problem, but (so far) they all work. Thanks.
> >>
> > I am still trying to create a simple example, but the fact that it works
on
> > the 32-bit
> > install inspired me to look again at the strace output, comparing the
> output
> > from
> > the install that works with the 64-bit strace output that shows the
> problem.
> >
> /bin/sh is crashing, for sure, but it's not clear to me why that would
> be the case.  It certainly has something to do with the way it's being
> invoked.  But whether that's the problem (i.e. GIGO) or whether there's
> something wrong on the Cygwin side that your usage is conveniently
> bringing to light, I can't say.  I'm assuming the former given your
> description so far.
> 
> --
> Larry
> 
I found  the problem that was causing the failure of child creation logic
on the 64-bit install but not on the 32-bit version:

in an effort to make the output from 'ps' more useful, my application was
over-writing the contents of argv[1] in the main process. This trick works
fine in many flavors of Unix (including Interix and Linux and 32-bit
Cygwin).
However, in Cygwin 64-bit, it somehow corrupts things such that the
child process created by fork() or spawnv() failed to load correctly. After
removing that 'feature,' both spawnv() as well as the original fork() logic
work without any problem.

I really appreciate everyone's looking into this. 

Steve



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]