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)
Wed, Oct 22, 6:34 AM
Unknown Object (File)
Tue, Oct 21, 10:47 PM
Unknown Object (File)
Fri, Oct 10, 7:56 AM
Unknown Object (File)
Sep 18 2025, 12:48 AM
Unknown Object (File)
Sep 13 2025, 3:10 AM
Unknown Object (File)
Sep 4 2025, 6:53 AM
Unknown Object (File)
Sep 3 2025, 9:04 PM
Unknown Object (File)
Sep 1 2025, 11:38 AM
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.