-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Reading patterns from file (-f) loses last character #1259
Labels
bug
A bug.
Comments
Fixed in e7829c0 |
Thanks for reporting this! I don't think this was a regression in the latest release, so I don't know whether I'll cut a new patch release just for this or not. In the mean time, you can add a |
Just recompiled from master, and I can confirm it appears to be fixed in e7829c0. Thanks for the ridiculously fast fix, and for writing such a great tool! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of ripgrep are you using?
ripgrep 11.0.1 (rev a622293)
-SIMD -AVX (compiled)
+SIMD -AVX (runtime)
How did you install ripgrep?
Compiled from source
What operating system are you using ripgrep on?
Arch Linux
Describe your question, feature request, or bug.
When reading patterns in from a file using the "-f" flag, it appears that the last character is lost. Depending on the last character in the patterns file, this causes either a parsing error, or the silent use of a truncated pattern.
If this is a bug, what are the steps to reproduce the behavior?
Create the patterns file (patterns.txt):
N.B. Ensure a blank newline is not added at the end of the file by your editor (see bug #783)
Run the following command (you can use any file as the corpus, as we don't get as far as loading it):
If this is a bug, what is the actual behavior?
ripgrep reports that there's a parsing error, indicating that the last char "]" has been lost whilst loading the patterns from the file:
If you modify the patterns.txt file to the following, you no longer receive an error, even though the pattern is now invalid, leading me to believe that the last char is discarded:
If this is a bug, what is the expected behavior?
Read the last character of the file when loading patterns using "-f", omitting only a trailing newline, as per #783
The text was updated successfully, but these errors were encountered: