develooper Front page | perl.perl5.porters | Postings from November 2010

Re: "perl: utf8.c:1997: Perl_swash_fetch: Assertion `klen <= sizeof(PL_last_swash_key)'failed." [5.12.1]

Thread Previous | Thread Next
Reverend Chip
November 26, 2010 13:03
Re: "perl: utf8.c:1997: Perl_swash_fetch: Assertion `klen <= sizeof(PL_last_swash_key)'failed." [5.12.1]
Message ID:
On 11/26/2010 2:25 AM, Nicholas Clark wrote:
> On Fri, Nov 26, 2010 at 02:20:40AM -0800, Reverend Chip wrote:
>> On 11/26/2010 1:23 AM, Nicholas Clark wrote:
>>> Isn't the bug that perl let someone create an invalid data structure?
>> That's an internally consistent position (no pun intended).  But does
>> the utf8 flag truly count as internal if manipulating it is both easy
>> and well-documented for users?
> easy (yes, too easy), documented (maybe, not well enough, particularly about
> what it's about) and WRONG.

You seriously equate Encode::_utf8_on() with, say, playing around with
optrees using B?  You seriously equate a bad pointer in an SV to a
misplaced byte in a utf8 string?

Hm, would malformed utf8 on stdin come in without validation?  I never
do utf8 I/O so I don't know.

> (WRONG in the general case. It feels like an awful lot of end-user code to
> deal with encodings is heuristics and bodgery, rather than actual
> understanding)

Very true, and a source of perpetual annoyance.  But it's a separate
issue, isn't it?

>> As a separate matter, perhaps we can at least agree that assert() is an
>> unfriendly thing for Perl to do in this case [...]
> Where do you stop?

Well, I wrote "in this case", so we would stop here.  It would be a
concession to usability based on manipulation of the utf8 flag being
easy and documented (as you acknowledged).

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About