Re: [SCM] Debian package checker branch, master, updated. 2.5.11-222-g70ed124
On 2013-04-04 00:38, Adam D. Barratt wrote:
> On Wed, 2013-04-03 at 22:26 +0000, Niels Thykier wrote:
>> --- a/lib/Lintian/Collect/Package.pm
>> +++ b/lib/Lintian/Collect/Package.pm
>> @@ -219,10 +219,13 @@ sub _fetch_extracted_dir {
> [...]
>> # strip leading ./ - if that leaves something, return the path there
>> - $file =~ s,^\.?/*+,,go;
>> - return "$dir/$file" if $file;
>> + if ($file =~ s,^(?:\.?/)++,,go) {
>
> The new version there looks like it has too many "+"s?
>
> Regards,
>
> Adam
>
>
Mmm, as far as I can tell it is actually right. I want it to match only
if there is a "./" or "/", so it definitely needs to be "+" instead of "*".
The second plus is just a "no-backtrack" hint. I suspect the hint is
redundant, but it has become a habit of mine to not rely on regex
implementations to have sane runtimes by default[1]
~Niels
[1] There is a old 2007 or so paper on "Thompson NFAs vs Perl regex" or
something like that.
Reply to: