Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #28106] reading from DATA on win32 with perlio behaves oddly

4 views
Skip to first unread message

Steve Peters via RT

unread,
Dec 16, 2006, 11:32:55 AM12/16/06
to perl5-...@perl.org
> After looking at ticket #27918, I ran into this ticket. This one is
> the
> actual cause. Attempting to read from <DATA> while performing
> system()
> or `` commands will lead to unreliable results.
>
> Setting PERLIO to stdio does solve the problem as a workaround. I'm
> interested in the patch, but, unfortunately, can't get to it this
> evening. My concern is for Borland and Netware based system. I'm
> guessing this patch could do harm to those systems, but, frankly, I
> don't know. Can someone with some more Win32 experience check out the
> above patch, particularly if you know something about Netware or
> Borland?
>
> Also, just re-writing the patch to leave Borland and Netware alone
> would
> probably work fine as well.

I can no longer replicate this bug with either bleadperl (compiled with
VC++ 8.0 or borland), or with ActiveState Perl 5.8.8 .

Jan Dubois

unread,
Jul 4, 2007, 9:26:04 PM7/4/07
to perlbug-...@perl.org, perl5-...@perl.org

This problem is not fixed; it still happens with 5.8.8 and blead. It only
happens when you store your script with CRLF line endings, so maybe that
is the reason you couldn't reproduce it anymore.

You'll see this error with the t/op/readline.t test in blead too, if you
convert the bleadperl sources to Windows line-endings first.

The backticks are triggering the issue because they will flush all
filehandles. You'll see that the internal fileposition for the DATA
handle is wrong; you can replace the backticks with the following line
to achieve the same effect:

seek(DATA, tell DATA, 0);

which should have been a no-op.

I was thinking about another way to fix this: Defining the
PERL_TEXTMODE_SCRIPTS preprocessor variable to always open scripts in
text mode. This breaks ByteLoader, but that doesn't matter because
ByteLoader is no more. However, it might also break source filters
storing binary data in the __DATA__ section, so it may still not be safe
for blead. It does not break any tests in blead though. :)

Cheers,
-Jan

0 new messages