develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #54926] IO on active pipes fails after ithread fork in 5.8.8

Thread Previous
From:
bulk88 via RT
Date:
May 26, 2013 17:34
Subject:
[perl #54926] IO on active pipes fails after ithread fork in 5.8.8
Message ID:
rt-3.6.HEAD-2650-1369589661-1331.54926-15-0@perl.org
On Sun May 26 09:51:31 2013, jkeenan wrote:
> Could someone familiar with threads try this out on Perl 5.18 and make
> some suggestions?
> 
> Thank you very much.
> Jim Keenan

Script as posted above
________________________________________________________________________
C:\Documents and Settings\Owner\Desktop>perl pipe_test.pl < pipe_input.in
Header, always correct: #h header
0: line one
1: line two
line count: 2

Count will incorrectly be 0 if run with cat pipe_input.in | perl
pipe_test.pl,
or 2 if run with perl pipe_test.pl <pipe_input.in.
It should be the same in both cases.
Suspected bug: after fork, perl lseeks on $in, which files if
it is a pipe (OS: linux 2.6.24 on Fedora 8, perl-5.8.8).
(Note: it works if there is no pre-existing IO on the file,
i.e., if first getline is commented out.)

C:\Documents and Settings\Owner\Desktop>type pipe_input.in | perl
pipe_test.pl
Header, always correct: #h header

line count: 0

Count will incorrectly be 0 if run with cat pipe_input.in | perl
pipe_test.pl,
or 2 if run with perl pipe_test.pl <pipe_input.in.
It should be the same in both cases.
Suspected bug: after fork, perl lseeks on $in, which files if
it is a pipe (OS: linux 2.6.24 on Fedora 8, perl-5.8.8).
(Note: it works if there is no pre-existing IO on the file,
i.e., if first getline is commented out.)

C:\Documents and Settings\Owner\Desktop>
____________________________________________________________________

Below is with "my($header) = $in->getline;" commented out.
___________________________________________________________________
C:\Documents and Settings\Owner\Desktop>perl pipe_test.pl < pipe_input.in
Header, always correct: 0: #h header
1: line one
2: line two
line count: 3

Count will incorrectly be 0 if run with cat pipe_input.in | perl
pipe_test.pl,
or 2 if run with perl pipe_test.pl <pipe_input.in.
It should be the same in both cases.
Suspected bug: after fork, perl lseeks on $in, which files if
it is a pipe (OS: linux 2.6.24 on Fedora 8, perl-5.8.8).
(Note: it works if there is no pre-existing IO on the file,
i.e., if first getline is commented out.)

C:\Documents and Settings\Owner\Desktop>type pipe_input.in | perl
pipe_test.pl
Header, always correct: 0: #h header
1: line one
2: line two
line count: 3

Count will incorrectly be 0 if run with cat pipe_input.in | perl
pipe_test.pl,
or 2 if run with perl pipe_test.pl <pipe_input.in.
It should be the same in both cases.
Suspected bug: after fork, perl lseeks on $in, which files if
it is a pipe (OS: linux 2.6.24 on Fedora 8, perl-5.8.8).
(Note: it works if there is no pre-existing IO on the file,
i.e., if first getline is commented out.)

C:\Documents and Settings\Owner\Desktop>
______________________________________________________

tested with "Summary of my perl5 (revision 5 version 19 subversion 0)"
on Win32 32 bits, VC. It is beyond my knowledge set to comment if there
is a bug in Perl or not.

-- 
bulk88 ~ bulk88 at hotmail.com

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=54926

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About