beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

App/Ack/ConfigFinder.pm _remove_redundancies wrong return type on Windows #417

Closed denishowe closed 10 years ago

denishowe commented 10 years ago

In App/Ack/ConfigFinder.pm, function _remove_redundancies on Windows returns paths whereas it's supposed to return a subset of the hashes it gets as args.

Fixed version:

sub _remove_redundancies
{
    my (@configs) = @_;

    my %seen;
    foreach my $config (@configs)
    {
        my $key = $config->{path};
        if (! $App::Ack::is_windows)
        {
            # On Unix uniquify on inode - no inodes on Windows
            my ($dev, $inode) = (stat $key)[0, 1];
            $key = "$dev:$inode" if (defined $dev);
        }
        undef $config
            if ($seen{$key}++);
    }
    return grep defined($_), @configs;
}
petdance commented 10 years ago

Is there a test that exercises this bug?

pdl commented 10 years ago

Yep, several - see #419 for some logs - t/ack-match.t line 52 seems to be the first that fails.

petdance commented 10 years ago

OK, so if it fixes it on Windows, and still passes on t/ack-match.t, we're happy.

petdance commented 10 years ago

I missed this in 2.13_03. I'm putting it in 2.13_04.

petdance commented 10 years ago

Thanks: b41bfec38544068244eb7a3c636ceadc203f0603