public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] LC_COLLATE: Fix last character ellipsis handling (Bug 22668) Date: Mon, 26 Apr 2021 12:38:53 +0000 (GMT) [thread overview] Message-ID: <20210426123853.34A76385800A@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=82292c99b2b68504e0b09b19a339d0232c2e1eaa commit 82292c99b2b68504e0b09b19a339d0232c2e1eaa Author: Hanataka Shinya <hanataka.shinya@gmail.com> Date: Wed Feb 17 23:00:48 2021 -0500 LC_COLLATE: Fix last character ellipsis handling (Bug 22668) During ellipsis processing the collation cursor was not correctly moved to the end of the ellipsis after processing. The code inserted the new entry after the cursor, but before the real end of the ellipsis: [cursor] ... element_t <-> element_t <-> element_t <-> element_t "<U0000>" "<U0001>" "<U007F>" startp endp At the end of the function we have: [cursor] ... element_t <-> element_t <-> element_t "<U007E>" "<U007F>" endp The cursor should be pointing at endp, the last element in the doubly-linked list, otherwise when execution returns to the caller we will start inserting the next line after <U007E>. Subsequent operations end up unlinking the ellipsis end entry or just leaving it in the list dangling from the end. This kind of dangling is immediately visible in C.UTF-8 with the following sorting from strcoll: <U0010FFFF> <U0000FFFF> <U000007FF> <U0000007F> With the cursor correctly adjusted the end entry is correctly given the right location and thus the right weight. Retested and no regressions on x86_64 and i686. Co-authored-by: Carlos O'Donell <carlos@redhat.com> Diff: --- locale/programs/ld-collate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 0af21e05e2..b6406b775d 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1483,6 +1483,9 @@ order for `%.*s' already defined at %s:%Zu"), } } } + /* Move the cursor to the last entry in the ellipsis. + Subsequent operations need to start from the last entry. */ + collate->cursor = endp; }
reply other threads:[~2021-04-26 12:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210426123853.34A76385800A@sourceware.org \ --to=carlos@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).