In article <[EMAIL PROTECTED]>,
Nicholas Clark <[EMAIL PROTECTED]> writes:
> This patch has the rather unfortunate effect of causing 3598 lines of
> Malformed UTF-8 warnings from t/op/pack.t when testing with a UTF-8 locale;
> 1799 each from lines 135 and 136;
>
> $ (cd t; LC_ALL=fr_FR.UTF-8 PERL_UNICODE="" ./perl op/pack.t >/dev/null )
> 2>&1 | grep -c 136
> 1799
> $ (cd t; LC_ALL=fr_FR.UTF-8 PERL_UNICODE="" ./perl op/pack.t >/dev/null )
> 2>&1 | grep -c 135
> 1799
>
bummer...
>
> Actually, it looks like that number depends on the size of my perl binary...
>
> Silenced with a binmode in change 24251.
>
> I also added qw(FATAL all) to the use warnings, plus appropriate local
> disabling, to try to stop things like this getting missed in the future.
>
Mm, looking at that code, using sysread and expecting to get all requested
bytes is strictly speaking wrong, it's allowed to return less (though on
every OS I know that won't happen for plain files). I'd feel a bit happier
with something like (untested):
open(BIN, $Perl) || die "Can't open $Perl: $!\n";
binmode BIN;
read(BIN, my $foo, 8192) == 8192 || die "Unexpected short read from $Perl";
close(BIN) || die "Error closing $Perl: $!";