beyondgrep / ack2

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

Existence of file called '0' stops ack finding other files #667

Closed epa closed 5 years ago

epa commented 6 years ago

If there is a file called 0 then ack can fail to search other files in or below the directory.

% echo hello >0
% rm foo
% echo goodbye >foo
% ack -f
(nothing)
% rm 0
% ack -f
foo

Somehow, the existence of the file 0 gets ack confused. This is likely to be some bit of perl code calling readdir() and checking whether the result returned is true or false. A filename 0 evaluates as false but there are more things in the directory.

Just creating a new file called 0 isn't enough to trigger the bug. It has to be earlier in the directory listing than the other file foo. On many systems that means the 0 file has to be created first.

hoelzro commented 6 years ago

Thanks for the report, @epa - I just pushed a fix for this to the dev branch.

petdance commented 5 years ago

This was released in 2.23_03.