Mailing List Archive

pclose bug in 5.001m or BSDI 2.0 bug... You decide.
Under BSDI 2.0 (gcc 1.42 compiled), I run into the folowing:

perl -le 'open(P,"cat /etc/passwd|");$x=<P>;close(P)||die("Fail: $?")'

prints "Fail: 13". Why? Well, it would seem that, contrary to the
docs, perl is doing a non-blocking wait on the process. This confused
the heck out of me. Here's a trace of the process (you'll notice that
wait4 is called in blocking mode, the default).

611 perl CALL read(0x3,0xadc04,0x1000)
611 perl GIO fd 3 read 4096 bytes
611 perl RET read 4096/0x1000
611 perl CALL close(0x3)
611 perl RET close 0
611 perl CALL sigaction(0x1,0xefbfd564,0xefbfd558)
611 perl RET sigaction 0
611 perl CALL sigaction(0x2,0xefbfd55c,0xefbfd550)
611 perl RET sigaction 0
611 perl CALL sigaction(0x3,0xefbfd578,0xefbfd56c)
611 perl RET sigaction 0
611 perl CALL wait4(0x264,0xefbfd5a8,0,0) # Pid 612, ptr, 0, 0
611 perl RET wait4 612/0x264 # Should be blocking...
611 perl CALL sigaction(0x1,0xefbfd578,0xefbfd56c)
611 perl RET sigaction 0

Is this a BSDI bug or a perl bug?

Some potentially relevant options from Config.pm:

d_wait4='define'
d_waitpid='define'
gccversion='1.42'
cc='cc'

--
Aaron Sherman <ajs@ajs.com> B4 f w+ c kv s+(--)v r p
I-Kinetics, Inc. Pager: (508)545-0584
1 NE Executive Park Fax: (617)270-4979
Burlington, MA 01803-5005 WWW: http://ajs.com/~ajs/
ajs@ajs.com or ajs@openmarket.com
"I speak for no one."