On Fri, Aug 12, 2005 at 11:37:53AM -0700, Will Coleda wrote:
> # New Ticket Created by  Will Coleda 
> # Please include the string:  [perl #36882]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36882 >
> 
> 
> Trying to glob empty strings causes a bus error. I would expect this  
> to be a match. works fine with a glob of "*" and a string of "".

The problem seems to be in Data::Escape, when passed an empty string
to be escaped it returns null instead of an empty string -- this
then causes the substr op to fail:

    $ cat t.pir
    .sub "main" @MAIN
    
        load_bytecode "Data/Escape.pbc"
        $P0 = find_global "Data::Escape", "String"

        $S1 = ""                       # empty string
        ($S2) = $P0($S1, "'")          # $S2 is escaped empty string

        $S3 = "hello, world\n"
        substr $S3, 5, 2, $S2          # replace ", " with escaped empty string
    
        print $S3
    .end

    $ parrot t.pir
    Segmentation fault

I think that Data::Escape should return an empty string when
passed an empty string as an argument, but perhaps there's a reason
it's returning null?

I can either fix PGE to handle nulls returned by Data::Escape,
or I can fix Data::Escape to return an empty string instead of a 
null.  Let me know.

Pm

Reply via email to