Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
yesterday dree stumbled upon what seems a really nasty bug in perl 5.6.x on Win32,
so I'm posting this hoping that it can avoid some headache to someone in
the (near) future.
note that this seems to have been fixed in perl 5.8.0, so read this only if you have not upgraded (yet)! the bug appears when you use warnings and close STDERR (which is not a meaningful thing to do, but nonetheless...) and it causes the readline operator (eg. <STDIN>) to only read the first line of a file.
AFFECTED PLATFORMSfirst of all, these are the test reports I could gather so far:
summing this up, the bug seems to show only on Win32 with Perl 5.6.0 and 5.6.1 (but not with Cygwin).
DESCRIPTIONthis is the exploitation script (I called it dree.pl):if you run it as it is, it will read (and thus print) only the first line of the file. if you comment either the first line (use warnings) or the second line (close(STDERR)), the whole file is printed fine. SUMMARYif you mysteriously fail to read more than one line from a file, make sure that the following two conditions aren't both met:
cheers, King of Laziness, Wizard of Impatience, Lord of Hubris In reply to warning: perl bug in 5.6.x, Win32 (use warnings and STDERR) by dada
|
|