I'll have to investigate more to work out why the instability happens.
Just a note on:

> It's the pipe that's used to communicate between the processes, the
> fdopen creates buffers which do need to be independent.

The fdopen calls are used to get a FILE* for the integer file handle
which are only used as return values in the array that is returned to
the caller - only the parent process uses it. That's why I made the
assumption it's safe to move the calls to after the fork, and
happening only in the parent process. I will investigate more though
why the instability occurs.

There's an additional bug I get where 1!:20 segfaults if 2!:2 has been
used. When generating the table of file handle and filename mappings
it appears to not like the entries added by 2!:2. Possibly something
in the jtjadd2 function or in the function that handles 1!:20 itself.
Do you see this issue on your machine? This repeats it for me:

   2!:2 '/bin/ls'
9701 94708241802784 94708241803344
   1!:20 ''
Segmentation fault (core dumped)

-- 
http://bluishcoder.co.nz
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to