sift icon indicating copy to clipboard operation
sift copied to clipboard

blocked when "-e ." with a big file

Open Pingze-github opened this issue 6 years ago • 1 comments

When I run "sift -e . /***/log.log -n --follow --binary-skip --limit=10", the program blocked with nothing to print.

But when I change "." to ".*", It works normally(in 30ms).

The file has about 8,000 lines.

In my opinion, "." has nothing different with ".*", why it makes the program blocked?

(version: sift 0.9.0 (windows/amd64))

Pingze-github avatar Oct 10 '18 02:10 Pingze-github

Thank you for your report. sift does not really block - the search just runs insanely slow, as every character in the file generates a match and those matches are later merged into one match per line. Searching for '.' is quite unusual and there is a good workaround ('.+' would be better here, as '.*' also matches empty lines), but I have to admit that this behavior is bad and should be improved.

I will leave this issue open to track this.

svent avatar Oct 10 '18 21:10 svent