develooper Front page | perl.perl5.porters | Postings from April 2012

Re: [perl #21780] odd bug with handle dup

Thread Previous | Thread Next
From:
Brian Fraser
Date:
April 26, 2012 16:26
Subject:
Re: [perl #21780] odd bug with handle dup
Message ID:
CA+nL+nb38LkKth6oAo2qLPg+wzVkJQ4q=3tgEk52tLbC6zYExQ@mail.gmail.com
On Sat, Apr 21, 2012 at 1:02 PM, James E Keenan via RT <
perlbug-followup@perl.org> wrote:

> On Mon Mar 31 18:43:53 2003, belg4mit@mit.edu wrote:
> > This is a bug report for perl from belg4mit@mit.edu,
> > generated with the help of perlbug 1.34 running under perl v5.8.0.
> >
> >
> > -----------------------------------------------------------------
> > While playing with code to dup DATA to STDIN I inadvertently came
> > up with the following
> >
> >   $a = tell(DATA);
> >   seek(DATA,$a,0);
> >   open(STDIN, "<&DATA");
> >   while(<STDIN>){
> >     print "STDIN: $_";
> >   }
> >   __DATA__
> >   Foo
> >   Bar
> >   Quux
> >
> > The first two lines would seem to be no-ops. And yet in several
> > instances nothing is read without them. Known configs where this
> > has failed are this box with the version of perl below as well
> > as the following perl -V [all Solaris.] I have also received reports
> of failure
> > without the first two lines on builds of 5.8 for SCO and RH
> >
>
> On Sat May 10 10:32:12 2003, ni-s wrote:
> > Strange how these things go unnoticed for ages then get discovered
> > by several people at nearly same time.
> > This is caused by "fact" that DATA handle has been read in order to
> > read the script. So some data is in the buffer. The "dup" process
> > does not copy the buffer.
> >
> > Not clear if/how this should be fixed:
> >   A. Document it
> >   B. Make dup do seek(FH,tell(FH),0)  - but with more error checking.
> >   C. Make DATA file handle do the seek/tell thing implicitly.
>
> ni-s is no longer with us to handle this old ticket.
>
> This problem appears to be OS-specific; I could not reproduce it on
> Darwin or Debian Linux.  Is there someone -- especially on Solaris --
> who can try to reproduce this bug?  How should we approach this?
>
>

On Solaris 10, I can't reproduce this on 5.12.4, 5.14.2, or blead, but
could on the system-provided 5.8.4; So this was fixed somewhere along the
road.


Thread Previous | Thread Next


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