Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ack-2.12 fails to run in Windows while ack-2.10 succeeds #425

passiontolearn opened this Issue · 10 comments

4 participants


Steps to reproduce:
1. Copy to c:\Program Files\Ack\
2. Add c:\Program Files\Ack\ to Windows PATH environment variable.
3. Run a search with such as:
C:\ "hello"

Expected result:
Ack runs successfully like it did in version 2.10

Actual Result:
Can't use string ("C:\ProgramData\ackrc") as a HASH ref while "strict refs" in use at C:\Program Files\Ack\ line 4223.

Tested with: ActivePerl 5.16.3 Build 1603 (64-bit) on Windows 7 SP1 64 bit.


Can you please verify for me that line 4223 of is the my @lines = ... line in this block of code?

    foreach my $file ( @files) {
        my @lines = App::Ack::ConfigFinder::read_rcfile($file->{path});

        if(@lines) {
            push @arg_sources, {
                name     => $file->{path},
                contents => \@lines,
                project  => $file->{project},

And if that is indeed the case, please add this line before the foreach():

use Data::Dumper; print Dumper( \@files );

and then run it again and show us what it shows?


C:> "hello"
$VAR1 = [
Can't use string ("C:\ProgramData\ackrc") as a HASH ref while "strict refs" in use at C:\Program Files\Ack\ line 4224.



Thanks. That gives us to go off of, I think. @files should contain hashrefs, but it doesn't.


Ok I did some very basic testing and the following seems to fix it, change line 4223 from:
my @lines = App::Ack::ConfigFinder::read_rcfile($file->{path});
my @lines = App::Ack::ConfigFinder::read_rcfile($file);

Looks like the bug was the dereference $file->{path}


That'll fix it in your specific case, but the real question is why does @lines contain filenames instead of hashrefs.


I don't think it's supposed to contain hashrefs but I didn't write the code :)

Just do a diff with ack-2.10 :

The signature of the read_rcfile sub has remained the same too (as has it's implementation) so looks like the dereference "->{path}" snuck in there somehow... (bug)


Looks like it's related to #419 / #417


I ran into this bug today, and planned to report it. If this is still not fixed, the bug comes from the Windows-only path of _remove_redundancies. Namely, the loop that starts on line 3410 should be:

    foreach my $path (@configs) {
        push @uniq, $path unless $seen{$path->{path}};
        $seen{$path} = 1;


    foreach my $path (map { $_->{path} } @configs) {
        push @uniq, { path => $path } unless $seen{$path};
        $seen{$path} = 1;

This method has been refactored in the last version 2.13_04, or at least it's on the current dev.

@petdance petdance closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.