On Sat, 2009-09-05 at 18:55 +0100, Adam D. Barratt wrote:
> On Sat, 2009-09-05 at 18:35 +0200, Martín Ferrari wrote:
> > See the patch below, or refer to revision 748 of
> > svn://svn.debian.org/svn/pet/trunk/PET/Watch.pm
[...]
> I've included an updated patch below.  PET SVN has also been updated to
> fix both of the issues mentioned above.

fwiw, further testing has thrown up another issue, regarding \G - namely
that it doesn't work. :)  To be honest I'm debating whether lack of
support for \G is really a problem, given that it isn't used in any
watchfile in the archive currently.

We did discover that the pattern "s/(.)\G./-/" produces a number of Perl
warnings as it appears to make Perl's regex engine deeply unhappy.  With
your patch applied, $matches ends up as 1 whilst $#- is -1, causing the
warnings.  The original uscan code causes a segfault, which appears to
be directly attributable to perl:

        $ echo foo | perl -pe "s/(.)\G./-/g"
        Segmentation fault

In any case, the additional line below gets rid of the warnings.  The
result returned is incorrect, but whether that matters depends on
whether we care about supporting \G.

[...]
> +             if ($matched) {
> +                 # save position and size of the match
> +                 $pos = pos($$in);
> +                 ($first, $last) = ($-[0], $+[0]);
> +                 for my $i (0..$#-) {
> +                     $captures[$i] = substr $$in, $-[$i], $+[$i] - $-[$i];
> +                 }

                        $matched = 0 unless $#- >= 0;

> +             }

Regards,

Adam




--
To unsubscribe, send mail to pkg-devscripts-unsubscr...@teams.debian.net.

Reply via email to