--- locale/programs/ld-collate.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1553,6 +1553,7 @@ int i; int need_undefined = 0; struct section_list *sect; + enum coll_sort_rule *orules; int ruleidx; int nr_wide_elems = 0; @@ -1564,18 +1565,28 @@ "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"), @@ -3359,6 +3370,9 @@ no_error = 0; } } + /* Update current section. */ + if (collate->cursor != NULL) + collate->current_section = collate->cursor->section; lr_ignore_rest (ldfile, no_error); }