develooper Front page | perl.perl5.porters | Postings from February 2012

Re: [perl #111174] /(?i:...)/ loses passed in charset

Thread Previous | Thread Next
From:
Karl Williamson
Date:
February 22, 2012 20:24
Subject:
Re: [perl #111174] /(?i:...)/ loses passed in charset
Message ID:
4F45BF7D.40502@khwilliamson.com
On 02/20/2012 12:38 PM, Karl Williamson wrote:
> On 02/20/2012 11:46 AM, Nicholas Clark wrote:
>> On Mon, Feb 20, 2012 at 11:42:35AM -0700, Karl Williamson wrote:
>>> On 02/20/2012 11:21 AM, karl williamson (via RT) wrote:
>>>
>>> Here is a patch for this bug, that was just spotted by Yves. This bug
>>> has existed in all of 5.14.
>>>
>>> Should this go into 5.16?
>>>
>>>
>>>> -----------------------------------------------------------------
>>>> Setting flags in a regular expression using the (?foo:...) notation
>>>> loses any passed in character set. for example through the -E flag.
>>>> So,
>>>> perl -E ' "\xe0" =~ /(?i:\w)/'
>>>> fails because the ?i: destroys the memory that the -E was used, which
>>>> should have forced Unicode semantics on the Latin1 character \xe0.
>
> That was a poor choice of wording on my part. What I meant was that the
> regex ignores the -E flag, and parsed the regex as if it had a /d
> modifier. Similarly for a 'use re /a'; the /a gets ignored.
>
> That means the issue raised below is from some other cause, and it
> doesn't show up on my system either with blead or blead+patch, in any of
> the configurations I normally build with. For example
> config_args='-des -Dprefix=/home/khw/fastbleadperl -Dusedevel
> -Dman1dir=none -D man3dir=none'
>>
>> Well, valgrind thinks that it looks like this:
>>
>> $ valgrind ./perl -Ilib -E ' "\xe0" =~ /(?i:\w)/'
>> ==69701== Memcheck, a memory error detector
>> ==69701== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
>> ==69701== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
>> info
>> ==69701== Command: ./perl -Ilib -E \ "\\xe0"\ =~\ /(?i:\\w)/
>> ==69701==
>> --69701-- ./perl:
>> --69701-- dSYM directory is missing; consider using --dsymutil=yes
>> ==69701== Invalid read of size 8
>> ==69701== at 0x7FFFFFE00A71: ???
>> ==69701== by 0x100201C0E: __inline_memmove_chk (in ./perl)
>> ==69701== by 0x100215B31: Perl_sv_setpvn (in ./perl)
>> ==69701== by 0x100260BED: Perl_newSVpv (in ./perl)
>> ==69701== by 0x10004D793: S_init_postdump_symbols (in ./perl)
>> ==69701== by 0x10004E825: S_parse_body (in ./perl)
>> ==69701== by 0x10004BDD9: perl_parse (in ./perl)
>> ==69701== by 0x100001403: main (in ./perl)
>> ==69701== Address 0x100817e08 is 136 bytes inside a block of size 142
>> alloc'd
>> ==69701== at 0x1004B95CF: malloc (vg_replace_malloc.c:266)
>> ==69701== by 0x100160060: Perl_safesysmalloc (in ./perl)
>> ==69701== by 0x10016B4BA: Perl_my_setenv (in ./perl)
>> ==69701== by 0x10004B989: perl_parse (in ./perl)
>> ==69701== by 0x100001403: main (in ./perl)
>> ==69701==
>> ==69701==
>> ==69701== HEAP SUMMARY:
>>
>> That has some potential for mischief, doesn't it?
>>
>> Nicholas Clark
>>
>

Since I didn't get this to happen on my 32 bit machine, I tried on 
dromedary, and also don't get it to happen.  I used:
./Configure -des -Dusedevel -O -Uusenm -DDEBUGGING
I'm wondering what configuration you used.  Could this be related to 
dSYM being missing (I don't know what that is, BTW)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About