Page MenuHomeFreeBSD

uniq: Fix off-by-one bug in -cD case.
ClosedPublic

Authored by des on Dec 9 2024, 3:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 13, 10:29 PM
Unknown Object (File)
Thu, Mar 13, 10:28 PM
Unknown Object (File)
Sun, Mar 9, 6:29 PM
Unknown Object (File)
Dec 19 2024, 4:40 AM
Unknown Object (File)
Dec 18 2024, 5:04 PM
Unknown Object (File)
Dec 18 2024, 9:01 AM
Unknown Object (File)
Dec 9 2024, 7:45 PM
Subscribers

Details

Summary

When printing only duplicated lines, the first line of each set is not
printed until we encounter the second. When that happens, we need to
increment the repetition count between printing the first and the
second line, so that if we are also printing counts, we don't print the
same (pre-increment) count twice.

MFC after: 1 week
PR: 275764
Reported by: Yu-Sheng Ma <s110062131@m110.nthu.edu.tw>
Submitted by: Daniel Tameling <tamelingdaniel@gmail.com> (original patch)
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Dec 9 2024, 3:01 PM
emaste requested changes to this revision.Dec 9 2024, 3:46 PM
emaste added a subscriber: emaste.

We don't increment repeats with only -c now.

This revision now requires changes to proceed.Dec 9 2024, 3:46 PM

Please double check the PR number in your commit message.

Simpler patch that doesn't break the cflag && !dflag && !Dflag case

This revision is now accepted and ready to land.Dec 9 2024, 6:45 PM
This revision was automatically updated to reflect the committed changes.