From: GNU Libc Maintainers Date: Sat, 2 Dec 2017 10:07:17 +0000 (+0000) Subject: fix-LC_COLLATE-rules X-Git-Tag: archive/raspbian/2.25-3+rpi1^2~197 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=37229964c3a5f4c50b88e3f7078a78129f68547a;p=glibc.git fix-LC_COLLATE-rules Gbp-Pq: Topic locale Gbp-Pq: Name fix-LC_COLLATE-rules.diff --- diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 8667249a1..8e7d496ae 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1555,6 +1555,7 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap) int i; int need_undefined = 0; struct section_list *sect; + enum coll_sort_rule *orules; int ruleidx; int nr_wide_elems = 0; @@ -1566,18 +1567,28 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap) "LC_COLLATE")); return; } + if (nrules == 0) + { + /* An error message has already been printed: + empty category description not allowed. */ + return; + } /* If this assertion is hit change the type in `element_t'. */ assert (nrules <= sizeof (runp->used_in_level) * 8); /* Make sure that the `position' rule is used either in all sections or in none. */ + sect = collate->sections; + while (sect != NULL && sect->rules == NULL) + sect = sect->next; + orules = sect->rules; for (i = 0; i < nrules; ++i) for (sect = collate->sections; sect != NULL; sect = sect->next) if (sect != collate->current_section && sect->rules != NULL && ((sect->rules[i] & sort_position) - != (collate->current_section->rules[i] & sort_position))) + != (orules[i] & sort_position))) { WITH_CUR_LOCALE (error (0, 0, _("\ %s: `position' must be used for a specific level in all sections or none"), @@ -3363,6 +3374,9 @@ error while adding equivalent collating symbol")); no_error = 0; } } + /* Update current section. */ + if (collate->cursor != NULL) + collate->current_section = collate->cursor->section; lr_ignore_rest (ldfile, no_error); }