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
F106649249: D10824.diff
Fri, Jan 3, 8:53 AM
Unknown Object (File)
Nov 30 2024, 5:23 PM
Unknown Object (File)
Nov 25 2024, 12:54 AM
Unknown Object (File)
Nov 22 2024, 10:38 PM
Unknown Object (File)
Nov 21 2024, 7:33 PM
Unknown Object (File)
Nov 20 2024, 9:22 PM
Unknown Object (File)
Nov 12 2024, 6:44 PM
Unknown Object (File)
Nov 10 2024, 10:40 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9387
Build 9847: arc lint + arc unit

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.