Hello Again,

I've played with the bug a little more and I include several more scripts,
that should help pinning down the bug.

First, let's get rid of the dependence on UTF-8 in the mail. This is the
original testcase, with escape sequence instead of the non-ascii character.
Also it now says :encoding(ascii) instead of iso-8859-2.

#!/usr/bin/perl
use utf8;
$string = "\x{8336}\n";
binmode STDERR, ":encoding(ascii)";
print STDERR $string;
__END__

Now the next script does NOT crash. It works normally:

#!/usr/bin/perl
use utf8;
$SIG{__WARN__} = sub { };
$string = "\x{8336}\n";
binmode STDERR, ":encoding(ascii)";
print STDERR $string;
__END__

As you can see, the only difference is the line:

$SIG{__WARN__} = sub { };

So it shows, that the problem is caused by printing to STDERR from a warning
generated inside print to STDERR. The next script crashes again:

#!/usr/bin/perl
use utf8;
$SIG{__WARN__} = sub { print STDERR "BUG\n"; };
$string = "\x{8336}\n";
binmode STDERR, ":encoding(ascii)";
print STDERR $string;
__END__

Now if the print is not to STDERR, it works. The following script does not
crash:

#!/usr/bin/perl
use utf8;
$SIG{__WARN__} = sub { print "BUG\n"; };
$string = "\x{8336}\n";
binmode STDERR, ":encoding(ascii)";
print STDERR $string;
__END__

The most surprising is this script though. The next script replaces STDERR
with STDOUT:

#!/usr/bin/perl
use utf8;
$SIG{__WARN__} = sub { print STDOUT "BUG\n"; };
$string = "\x{8336}\n";
binmode STDOUT, ":encoding(ascii)";
print STDOUT $string;
__END__

Now this script does crash, but in a DIFFERENT WAY. Instead of immediately
dying of SIGSEGV, it prints the following:

"\x{8336}" does not map to ascii at perlio-bug4.pl line 3.
\x{8336}
BUG
panic: sv_setpvn called with negative strlen at perlio-bug4.pl line 6.

And exits with status 2. Note, that this was on a terminal, where STDOUT is
line-buffered (but not unbuffered).

--
                                                 Jan 'Bulb' Hudec <[EMAIL 
PROTECTED]>

Attachment: signature.asc
Description: Digital signature

Reply via email to