Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

^$ does not work when using --no-mmap #690

Closed
ericbn opened this issue Nov 23, 2017 · 3 comments · Fixed by #1017
Closed

^$ does not work when using --no-mmap #690

ericbn opened this issue Nov 23, 2017 · 3 comments · Fixed by #1017
Labels
bug A bug.
Milestone

Comments

@ericbn
Copy link
Contributor

ericbn commented Nov 23, 2017

I found this while running the examples described at #441

$ cat scratch
a
b

c


d
$ rg 'a' scratch
1:a
$ rg 'b' scratch
2:b
$ rg 'c' scratch
4:c
$ rg 'd' scratch
7:d
$ rg --mmap '^$' scratch
3:
5:
6:
8:
$ rg --no-mmap '^$' scratch
2:
4:
6:
7:
9:
$

By "does not work" I mean using --no-mmap gives an unexpected number of results and unexpected line numbers. I get these same unexpected results by running rg '^$' scratch.

I'm using ripgrep 0.7.1 under macOS.

@BurntSushi
Copy link
Owner

I suspect this can be rolled up into the same bug as #441.

@BurntSushi BurntSushi added the bug A bug. label Feb 2, 2018
@dennis-benzinger-hybris

It's similar to #441 but the interesting point here is that phantom empty lines are also found elsewhere in the file. For example between line 1 and 2 (then 3). Try with -C1.

@BurntSushi BurntSushi added this to the libripgrep milestone Jun 3, 2018
@BurntSushi
Copy link
Owner

I believe this bug should be fixed in libripgrep.

BurntSushi added a commit that referenced this issue Aug 19, 2018
This commit updates the CHANGELOG to reflect all the work done to make
libripgrep a reality.

* Closes #162 (libripgrep)
* Closes #176 (multiline search)
* Closes #188 (opt-in PCRE2 support)
* Closes #244 (JSON output)
* Closes #416 (Windows CRLF support)
* Closes #917 (trim prefix whitespace)
* Closes #993 (add --null-data flag)
* Closes #997 (--passthru works with --replace)

* Fixes #2 (memory maps and context handling work)
* Fixes #200 (ripgrep stops when pipe is closed)
* Fixes #389 (more intuitive `-w/--word-regexp`)
* Fixes #643 (detection of stdin on Windows is better)
* Fixes #441, Fixes #690, Fixes #980 (empty matching lines are weird)
* Fixes #764 (coalesce color escapes)
* Fixes #922 (memory maps failing is no big deal)
* Fixes #937 (color escapes no longer used for empty matches)
* Fixes #940 (--passthru does not impact exit status)
* Fixes #1013 (show runtime CPU features in --version output)
BurntSushi added a commit that referenced this issue Aug 20, 2018
This commit updates the CHANGELOG to reflect all the work done to make
libripgrep a reality.

* Closes #162 (libripgrep)
* Closes #176 (multiline search)
* Closes #188 (opt-in PCRE2 support)
* Closes #244 (JSON output)
* Closes #416 (Windows CRLF support)
* Closes #917 (trim prefix whitespace)
* Closes #993 (add --null-data flag)
* Closes #997 (--passthru works with --replace)

* Fixes #2 (memory maps and context handling work)
* Fixes #200 (ripgrep stops when pipe is closed)
* Fixes #389 (more intuitive `-w/--word-regexp`)
* Fixes #643 (detection of stdin on Windows is better)
* Fixes #441, Fixes #690, Fixes #980 (empty matching lines are weird)
* Fixes #764 (coalesce color escapes)
* Fixes #922 (memory maps failing is no big deal)
* Fixes #937 (color escapes no longer used for empty matches)
* Fixes #940 (--passthru does not impact exit status)
* Fixes #1013 (show runtime CPU features in --version output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants