RE: Possible bug in wait4(), 2.1.126-129 ?

Ion Badulescu (ionut@moisil.cs.columbia.edu)
Sun, 22 Nov 1998 15:50:38 -0500 (EST)


On Sun, 22 Nov 1998, Greaves Tristan TM wrote:

> [cut lots of stuff]
>
> I missed the original posting here - could someone please tell me what
> the actual symptons are, as I suspect I know what may be causing the
> problem.

Basically, a perl script running another command using the backticks
syntax (`foo`), from cron (this is important for some reason), ends up
receiving ECHILD for the child's exit status.

Simplest test case:

#!/usr/bin/perl
`cmp -s /bin/ls /bin/ls`;
die "$!" if ($? != 0);

If I run this from cron (as root, haven't tried it yet as myself), I get a
mail saying:

No child processes at <script filename> line 3.

In terms of system calls, it goes like this:

pipe()
fork()
[parent pid] read from pipe(...
[child pid] do something
[child pid] exit(0)
[parent pid] read from pipe() resumed
wait4(child pid) = -ECHILD

I can reproduce this at will. Yet, it's a "theoretically impossible"
situation.

Ion

-- 
  It is better to keep your mouth shut and be thought a fool,
            than to open it and remove all doubt.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/