You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
THIS
is
a
test
[broken]
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):
rg -P -f patterns.txt testfile
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:
PCRE2: error compiling pattern at offset 22: missing terminating ] for character class
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:
THIS
is
a
test
[broken]]
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:
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 \n as a work-around. But this should be fixed on master now!
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: