HomeFreeBSD

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

Description

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

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.
Reviewed by: tamelingdaniel_gmail.com, asomers, emaste
Differential Revision: https://reviews.freebsd.org/D48000

Details

Provenance
desAuthored on Dec 9 2024, 7:44 PM
Reviewer
tamelingdaniel_gmail.com
Differential Revision
D48000: uniq: Fix off-by-one bug in -cD case.
Parents
rGb93791f5e7b0: uniq: Correctly document the -D option.
Branches
Unknown
Tags
Unknown