using spawn functions to avoid fork() errors

Larry Hall (Cygwin) reply-to-list-only-lh@cygwin.com
Thu Feb 6 22:34:00 GMT 2014


On 2/6/2014 5:14 PM, Steven Bardwell wrote:
>
>> 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.
>>
>> Interesting.  No, off hand, the strace output doesn't shed any light on
>> the situation for me either.  Clearly an access violation occurs when
>> /bin/sh is spawned but if it only happens in your specific code and not
>> in a simple invocation of spawn(), that suggests a possible usage problem.
>> I know, that's not much help. ;-)
>>
>> --
>> Larry
>>
> 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.
>
> Can you look at this section?   /bin/sh (the program that is getting
> spawned)
> gets loaded and starts running with PID 1464, but /bin/sh is failing :
>
>     47 8674492 [main] ulpd 2116 child_info::sync: n 2, waiting for
> subproc_ready(0x258) and child process(0x26C)
>      4       4 [main] sh (1464)
> **********************************************
>    296     300 [main] sh (1464) Program name: C:\cygwin64\bin\sh.exe (windows
> pid 1464)
>     52     352 [main] sh (1464) OS version:   Windows NT-6.1
>     34     386 [main] sh (1464)
> **********************************************
>    233     619 [main] sh (1464) sigprocmask: 0 = sigprocmask (0, 0x1802BBC68,
> 0x0)
>    287     906 [main] sh 1464 child_copy: cygheap - hp 0x254 low 0x1802DA410,
> high 0x1802E46D0, res 1
>    122    1028 [main] sh 1464 child_copy: done --- Process 1464, exception
> c0000005 at 00000001800448D0
>
> My process (PID=2116) creates the new process (/bin/sh with PID=1464), but
> then /bin/sh craps out.
> Does that shed any light on what might be the issue?

/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

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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



More information about the Cygwin mailing list