Page MenuHomeFreeBSD

bsdgrep(1): Correct some minor assumptions to prepare for later chunking efforts
ClosedPublic

Authored by kevans on May 19 2017, 5:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 30, 6:46 AM
Unknown Object (File)
Thu, Apr 24, 5:53 AM
Unknown Object (File)
Thu, Apr 24, 5:05 AM
Unknown Object (File)
Sun, Apr 20, 5:54 PM
Unknown Object (File)
Tue, Apr 15, 4:57 PM
Unknown Object (File)
Mar 17 2025, 2:21 PM
Unknown Object (File)
Mar 11 2025, 2:32 PM
Unknown Object (File)
Mar 10 2025, 8:13 AM
Subscribers

Details

Summary

Correct a couple of minor bsdgrep(1) assumptions that are valid for line processing
but not future chunk-based processing.

Rename MAX_LINE_MATCHES to MAX_MATCHES; the name is kind of misleading to begin with, since it's
actually the maximum number of matches we'll process in one pass at the line. There is currently
a bug in that we're actually limiting line matches to MAX_LINE_MATCHES, which is wrong and to be
corrected in D10577.

Additionally, we set REG_NOTBOL if st > 0, but that's only correct if st is an index into a line-based
buffer. Correct this one simply by checking also that the character preceding is not EOL to hold up when
we're looking beyond a single line.

These are some low-hanging fruit and should clean up the rest of procline. The name will be addressed
when its input is actually no longer expected to be a single line, but the additional assumptions were cleared
with rS317703 lifting line/context printing out into procfile.

Future work will be to remove line-based assumptions from procfile by pulling in chunks and processing the
matches produced by procline there to determine line numbers, etc. as needed.

Test Plan

Run test suite to ensure no regressions

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • Also set REG_NEWLINE for regex compilation; effectively a no-op right now since we're excluding all newlines from subjects as it's our delimiter, but this will save us a headache down the road
This revision is now accepted and ready to land.May 19 2017, 9:56 PM
This revision was automatically updated to reflect the committed changes.