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)
Tue, Apr 9, 5:44 PM
Unknown Object (File)
Feb 24 2024, 12:19 AM
Unknown Object (File)
Feb 8 2024, 12:14 PM
Unknown Object (File)
Jan 5 2024, 12:18 PM
Unknown Object (File)
Jan 3 2024, 9:20 PM
Unknown Object (File)
Dec 20 2023, 6:00 AM
Unknown Object (File)
Dec 10 2023, 7:22 PM
Unknown Object (File)
Nov 22 2023, 11:54 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.