uniq: fix bug with -w in multibyte locales
commit74b9d6a6e872553dcebfc41f8cb962d5d85d77e5
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Nov 2023 19:34:55 +0000 (16 11:34 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Nov 2023 19:37:25 +0000 (16 11:37 -0800)
tree05984d870a9ccc2233182acc5dee8ff139a29251
parent0ed9d1823a0a994d8c135f3932592f7fee97d444
uniq: fix bug with -w in multibyte locales

-w counted bytes not characters, which is wrong in multibyte locales.
This bug exists even in Fedora, which is why the recently-added
test cases from Fedora didn’t catch it.
* src/uniq.c (find_field): New arg PLEN.  All callers changed.
Compute length of field correctly in multi-byte locales.
(different): Don’t worry about check_chars; find_field now does that.
* tests/uniq/uniq.pl: Test for this bug.
src/uniq.c
tests/uniq/uniq.pl