[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regression: "sh -c" change causes FTBFS



On 10/05/2011 11:51 PM, Stéphane Glondu wrote:
> It seems that darcs failure was unrelated. I digged a bit more, and
> found some suspicious code in ocamlbuild:
> 
>   http://caml.inria.fr/mantis/view.php?id=5371
> 
> I still don't understand why this corner case is triggered with this
> patched dash, and I'd rather wait for more feedback before unreverting
> the patch in dash.

I got it: the command started with "sh -c" (ocamldep) redirects (with
shell's ">") its output to a file, therefore closing first its current
standard output, which is the writing end of a pipe. When fork() is
skipped, the parent process (ocamlbuild) gets an EOF on the reading end
of the pipe, which is then misinterpreted. When fork() is used, the
writing end of the pipe is closed only when the shell exits, i.e. when
ocamldep finishes.

ocamlbuild's logic is definitively incorrect, but I'm not sure if dash's
new behaviour is correct. "bash -c" doesn't skip fork() when a
redirection is set up, I guess for a reason. "dash -c" should probably
do the same for the same reason.


Cheers,

-- 
Stéphane


Reply to: