r1095 - in glibc-package/trunk/debian: . patches patches/locale patches/localedata
Author: barbier
Date: 2006-01-09 00:05:24 +0000 (Mon, 09 Jan 2006)
New Revision: 1095
Added:
glibc-package/trunk/debian/patches/forward-backward-collation.diff
glibc-package/trunk/debian/patches/locale/
glibc-package/trunk/debian/patches/locale/LC_COLLATE-keywords-ordering.diff
glibc-package/trunk/debian/patches/locale/LC_IDENTIFICATION-optional-fields.diff
glibc-package/trunk/debian/patches/locale/check-unknown-symbols.diff
glibc-package/trunk/debian/patches/locale/complex-collate.diff
glibc-package/trunk/debian/patches/locale/fix-LC_COLLATE-rules.diff
glibc-package/trunk/debian/patches/locale/fix-exhausted-memory.diff
glibc-package/trunk/debian/patches/locale/locale-print-LANGUAGE.diff
glibc-package/trunk/debian/patches/locale/preprocessor-collate.diff
Removed:
glibc-package/trunk/debian/patches/localedata/discard-dz_BT.diff
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/series
Log:
* Import collation fixes and enhancements for localedef from
belocs-locales-bin.
* debian/patches/localedata/discard-dz_BT.diff can then be removed.
* debian/patches/forward-backward-collation.diff: New file. Due to the
fixes in localedef, some bugs in code which was previously never run
did show up. (Closes: #310635)
* debian/patches/locale/locale-print-LANGUAGE.diff: New file, so that
locale displays the LANGUAGE environment variable when called without
argument.
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/changelog 2006-01-09 00:05:24 UTC (rev 1095)
@@ -26,9 +26,14 @@
* debian/patches/locale-ku_TR.diff: New file, to provide a Kurdish
locale needed by d-i. This locale comes from upstream CVS, and has
been updated to the latest patch sent to BZ870.
- * debian/patches/discard-dz_BT.diff: New file, to temporarily discard
- the generation of dz_BT until localedef fixes are grabbed from CVS
- (see BZ368).
+ * Import collation fixes and enhancements for localedef from
+ belocs-locales-bin.
+ * debian/patches/forward-backward-collation.diff: New file. Due to the
+ fixes in localedef, some bugs in code which was previously never run
+ did show up. (Closes: #310635)
+ * debian/patches/locale/locale-print-LANGUAGE.diff: New file, so that
+ locale displays the LANGUAGE environment variable when called without
+ argument.
-- Denis Barbier <barbier@debian.org> Sat, 7 Jan 2006 20:54:37 +0100
Added: glibc-package/trunk/debian/patches/forward-backward-collation.diff
===================================================================
--- glibc-package/trunk/debian/patches/forward-backward-collation.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/forward-backward-collation.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,71 @@
+#! /bin/sh -e
+
+# DP: Description: Fix segfault when strings contain a mix of forward
+# and backward rules.
+# DP: Related bugs: #310635 BZ645
+# DP: Dpatch Author: Denis Barbier <barbier@linuxfr.org>
+# DP: Patch Author: Denis Barbier
+# DP: Upstream status: fix in strxfrm_l.c has been committed upstream
+# DP: and strcoll_l.c has not been submitted yet.
+# DP: Test case: the following command segfaults in en_US.UTF-8 locale
+# DP: when BZ645 is fixed:
+# DP: echo 2d d194 0a 2d d194 0a | xxd -r -p | sort
+# DP: Date: 2005-11-01
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+--- libc/string/strxfrm_l.c 14 Mar 2004 20:52:47 -0000 1.4
++++ libc/string/strxfrm_l.c 15 Oct 2005 20:49:18 -0000 1.5
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1995,96,97,2002, 2004 Free Software Foundation, Inc.
++/* Copyright (C) 1995,96,97,2002, 2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Ulrich Drepper <drepper@gnu.org>, 1995.
+
+@@ -210,8 +210,9 @@
+ /* Handle the pushed elements now. */
+ size_t backw;
+
+- for (backw = idxcnt - 1; backw >= backw_stop; --backw)
++ for (backw = idxcnt; backw > backw_stop; )
+ {
++ --backw;
+ len = weights[idxarr[backw]++];
+
+ if (needed + len < n)
+@@ -293,8 +294,9 @@
+ /* Handle the pushed elements now. */
+ size_t backw;
+
+- for (backw = idxcnt - 1; backw >= backw_stop; --backw)
++ for (backw = idxcnt; backw > backw_stop; )
+ {
++ --backw;
+ len = weights[idxarr[backw]++];
+ if (len != 0)
+ {
+--- libc/string/strcoll_l.c 14 Mar 2004 20:52:47 -0000 1.4
++++ libc/string/strcoll_l.c 23 May 2005 22:35:59 -0000
+@@ -370,7 +370,10 @@
+ /* The last pushed character was handled. Continue
+ with forward characters. */
+ if (idx1cnt < idx1max)
+- idx1now = idx1cnt;
++ {
++ idx1now = idx1cnt;
++ backw1_stop = ~0ul;
++ }
+ else
+ {
+ /* Nothing anymore. The backward sequence
Property changes on: glibc-package/trunk/debian/patches/forward-backward-collation.diff
___________________________________________________________________
Name: svn:executable
+ *
Added: glibc-package/trunk/debian/patches/locale/LC_COLLATE-keywords-ordering.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/LC_COLLATE-keywords-ordering.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/LC_COLLATE-keywords-ordering.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,138 @@
+Be less strict about keywords ordering in LC_COLLATE section, to
+ease definition of new scripts.
+
+Submitted upstream: BZ690
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: BZ690
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-collate.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-collate.c
++++ glibc-2.3.5/locale/programs/ld-collate.c
+@@ -2724,7 +2724,6 @@
+
+ if (nowtok == tok_copy)
+ {
+- state = 2;
+ now = lr_token (ldfile, charmap, result, NULL, verbose);
+ if (now->tok != tok_string)
+ {
+@@ -2795,14 +2794,23 @@
+ switch (nowtok)
+ {
+ case tok_copy:
+- /* Allow copying other locales. */
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
+ now = lr_token (ldfile, charmap, result, NULL, verbose);
+ if (now->tok != tok_string)
+ goto err_label;
+
+- if (! ignore_content)
+- load_locale (LC_COLLATE, now->val.str.startmb, repertoire_name,
+- charmap, result);
++ if (state == 1 || state == 3 || state == 5)
++ goto err_label;
++
++ load_locale (LC_COLLATE, now->val.str.startmb, repertoire_name,
++ charmap, result);
+
+ lr_ignore_rest (ldfile, 1);
+ break;
+@@ -2816,9 +2824,6 @@
+ break;
+ }
+
+- if (state != 0)
+- goto err_label;
+-
+ arg = lr_token (ldfile, charmap, result, NULL, verbose);
+ if (arg->tok != tok_number)
+ goto err_label;
+@@ -2839,7 +2844,7 @@
+ break;
+ }
+
+- if (state != 0)
++ if (state == 1 || state == 3 || state == 5)
+ goto err_label;
+
+ arg = lr_token (ldfile, charmap, result, repertoire, verbose);
+@@ -2886,7 +2891,7 @@
+ break;
+ }
+
+- if (state != 0 && state != 2)
++ if (state == 1 || state == 3 || state == 5)
+ goto err_label;
+
+ arg = lr_token (ldfile, charmap, result, repertoire, verbose);
+@@ -2955,7 +2960,7 @@
+ break;
+ }
+
+- if (state != 0 && state != 2)
++ if (state == 1 || state == 3 || state == 5)
+ goto err_label;
+
+ arg = lr_token (ldfile, charmap, result, repertoire, verbose);
+@@ -3103,7 +3108,7 @@
+ break;
+ }
+
+- if (state != 0)
++ if (state == 1 || state == 3 || state == 5)
+ goto err_label;
+
+ arg = lr_token (ldfile, charmap, result, repertoire, verbose);
+@@ -3219,7 +3224,7 @@
+ break;
+ }
+
+- if (state != 0 && state != 1)
++ if (state == 3 || state == 5)
+ goto err_label;
+ state = 1;
+
+@@ -3390,8 +3395,12 @@
+ was_ellipsis = tok_none;
+ }
+ }
+- else if (state != 2 && state != 3)
+- goto err_label;
++ else if (state == 5)
++ {
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
++ state = 6;
++ }
+ state = 3;
+
+ arg = lr_token (ldfile, charmap, result, repertoire, verbose);
+@@ -3526,8 +3535,6 @@
+ %s: missing `reorder-end' keyword"), "LC_COLLATE"));
+ state = 4;
+ }
+- else if (state != 2 && state != 4)
+- goto err_label;
+ state = 5;
+
+ /* Get the name of the sections we are adding after. */
+@@ -4063,7 +4070,7 @@
+ /* Next we assume `LC_COLLATE'. */
+ if (!ignore_content)
+ {
+- if (state == 0)
++ if (state == 0 && nrules == 0)
+ /* We must either see a copy statement or have
+ ordering values. */
+ lr_error (ldfile,
Added: glibc-package/trunk/debian/patches/locale/LC_IDENTIFICATION-optional-fields.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/LC_IDENTIFICATION-optional-fields.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/LC_IDENTIFICATION-optional-fields.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,35 @@
+In LC_IDENTIFICATION, audience, application and abbreviation keywords
+are optional, thus do not report an error if they are not defined.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: not submitted
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-identification.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-identification.c
++++ glibc-2.3.5/locale/programs/ld-identification.c
+@@ -148,6 +148,9 @@
+ "LC_IDENTIFICATION", #cat)); \
+ identification->cat = ""; \
+ }
++#define TEST_ELEM_OPT(cat) \
++ if (identification->cat == NULL) \
++ identification->cat = ""; \
+
+ TEST_ELEM (title);
+ TEST_ELEM (source);
+@@ -158,9 +161,9 @@
+ TEST_ELEM (fax);
+ TEST_ELEM (language);
+ TEST_ELEM (territory);
+- TEST_ELEM (audience);
+- TEST_ELEM (application);
+- TEST_ELEM (abbreviation);
++ TEST_ELEM_OPT (audience);
++ TEST_ELEM_OPT (application);
++ TEST_ELEM_OPT (abbreviation);
+ TEST_ELEM (revision);
+ TEST_ELEM (date);
+
Added: glibc-package/trunk/debian/patches/locale/check-unknown-symbols.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/check-unknown-symbols.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/check-unknown-symbols.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,35 @@
+Check for unknown symbols in collation rules. This is useful to detect
+broken locales since unknown symbols are always wrong.
+
+This request has not been submitted upstream yet.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: not submitted
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-collate.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-collate.c
++++ glibc-2.3.5/locale/programs/ld-collate.c
+@@ -3524,8 +3524,20 @@
+ }
+ else if (arg != NULL)
+ {
++ void *ptr = NULL;
+ symstr = arg->val.str.startmb;
+ symlen = arg->val.str.lenmb;
++ if (state != 5
++ && find_entry (&charmap->char_table, symstr, symlen, &ptr) != 0
++ && (repertoire == NULL ||
++ find_entry (&repertoire->char_table, symstr, symlen, &ptr) != 0)
++ && find_entry (&collate->elem_table, symstr, symlen, &ptr) != 0
++ && find_entry (&collate->sym_table, symstr, symlen, &ptr) != 0)
++ {
++ lr_error (ldfile, _("%s: symbol `%.*s' not known"),
++ "LC_COLLATE", (int) symlen, symstr);
++ lr_ignore_rest (ldfile, 0);
++ }
+ }
+ else
+ {
Added: glibc-package/trunk/debian/patches/locale/complex-collate.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/complex-collate.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/complex-collate.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,45 @@
+This bug has been submitted upstream BZ368 and fixed in CVS 1.106.
+But this revision applied another fix at the same time which cannot
+be applied because magic number has to be bumped at the same time.
+
+This patch can be dropped with glibc 2.4.x.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: In CVS
+# DP: Status Details: HEAD, but not 2.3 branch yet
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-collate.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-collate.c
++++ glibc-2.3.5/locale/programs/ld-collate.c
+@@ -2469,14 +2469,15 @@
+ runp = collate->start;
+ while (runp != NULL)
+ {
+- if (runp->mbs != NULL && runp->weights != NULL)
++ if (runp->mbs != NULL && runp->weights != NULL && !runp->is_character)
+ /* Yep, the element really counts. */
+ ++elem_size;
+
+ runp = runp->next;
+ }
++rehash:
+ /* Add 40% and find the next prime number. */
+- elem_size = MIN (next_prime (elem_size * 1.4), 257);
++ elem_size = next_prime (elem_size * 1.4);
+
+ /* Allocate the table. Each entry consists of two words: the hash
+ value and an index in a secondary table which provides the index
+@@ -2508,6 +2509,10 @@
+ idx += iter;
+ if (idx >= elem_size)
+ idx -= elem_size;
++ if (idx == (hash % elem_size)) {
++ obstack_free (&extrapool, elem_table);
++ goto rehash;
++ }
+ }
+ while (elem_table[idx * 2] != 0);
+ }
Added: glibc-package/trunk/debian/patches/locale/fix-LC_COLLATE-rules.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/fix-LC_COLLATE-rules.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/fix-LC_COLLATE-rules.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,91 @@
+Fix rules definitions in LC_COLLATE. Backward/forward rules were
+sometimes affected to a wrong section, some rules could wrongly be
+declared as identical, and localedef segfaults are also fixed.
+Special French collation now works as described in ISO-14651.
+
+Submitted upstream: BZ645
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: BZ645
+# DP: Status Details: depends on #310635
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-collate.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-collate.c
++++ glibc-2.3.5/locale/programs/ld-collate.c
+@@ -1524,6 +1524,7 @@
+ int i;
+ int need_undefined = 0;
+ struct section_list *sect;
++ enum coll_sort_rule *orules;
+ int ruleidx;
+ int nr_wide_elems = 0;
+
+@@ -1535,17 +1536,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->rules != NULL
+ && ((sect->rules[i] & sort_position)
+- != (collate->sections->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"),
+@@ -1840,7 +1852,7 @@
+
+ while (osect != sect)
+ if (osect->rules != NULL
+- && memcmp (osect->rules, sect->rules, nrules) == 0)
++ && memcmp (osect->rules, sect->rules, nrules * sizeof (*osect->rules)) == 0)
+ break;
+ else
+ osect = osect->next;
+@@ -3189,12 +3201,15 @@
+ {
+ /* Insert sp in the collate->sections list,
+ right after collate->current_section. */
+- if (collate->current_section == NULL)
++ if (collate->sections == NULL)
++ collate->sections = collate->current_section = sp;
++ else if (collate->current_section == NULL)
+ collate->current_section = sp;
+ else
+ {
+ sp->next = collate->current_section->next;
+ collate->current_section->next = sp;
++ collate->current_section = sp;
+ }
+ }
+
+@@ -3385,6 +3400,9 @@
+ no_error = 0;
+ }
+ }
++ /* Update current section. */
++ if (collate->cursor != NULL)
++ collate->current_section = collate->cursor->section;
+
+ lr_ignore_rest (ldfile, no_error);
+ }
Added: glibc-package/trunk/debian/patches/locale/fix-exhausted-memory.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/fix-exhausted-memory.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/fix-exhausted-memory.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,33 @@
+Localedef fails if a symbol name has exactly 55 characters in charmap file.
+
+This bug has not been submitted upstream yet.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: not submitted
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/linereader.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/linereader.c
++++ glibc-2.3.5/locale/programs/linereader.c
+@@ -531,8 +531,8 @@
+ {
+ lr->token.tok = tok_bsymbol;
+
+- buf[bufact] = '\0';
+ buf = xrealloc (buf, bufact + 1);
++ buf[bufact] = '\0';
+
+ lr->token.val.str.startmb = buf;
+ lr->token.val.str.lenmb = bufact - 1;
+@@ -584,8 +584,8 @@
+ {
+ lr->token.tok = tok_ident;
+
+- buf[bufact] = '\0';
+ buf = xrealloc (buf, bufact + 1);
++ buf[bufact] = '\0';
+
+ lr->token.val.str.startmb = buf;
+ lr->token.val.str.lenmb = bufact;
Added: glibc-package/trunk/debian/patches/locale/locale-print-LANGUAGE.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/locale-print-LANGUAGE.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/locale-print-LANGUAGE.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,30 @@
+Comments tell that LANG has to be the first value, and LC_ALL the last
+one. Thus LANGUAGE is printed between them.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: not submitted
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/locale.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/locale.c
++++ glibc-2.3.5/locale/programs/locale.c
+@@ -753,6 +753,7 @@
+ {
+ size_t cat_no;
+ const char *lcall = getenv ("LC_ALL");
++ const char *language = getenv ("LANGUAGE");
+ const char *lang = getenv ("LANG") ? : "";
+
+ auto void get_source (const char *name);
+@@ -771,6 +772,9 @@
+ /* LANG has to be the first value. */
+ printf ("LANG=%s\n", lang);
+
++ if (language != NULL && getenv ("POSIXLY_CORRECT") == NULL)
++ printf ("LANGUAGE=%s\n", language);
++
+ /* Now all categories in an unspecified order. */
+ for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
+ if (cat_no != LC_ALL)
Added: glibc-package/trunk/debian/patches/locale/preprocessor-collate.diff
===================================================================
--- glibc-package/trunk/debian/patches/locale/preprocessor-collate.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/locale/preprocessor-collate.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -0,0 +1,331 @@
+Allow preprocessor-like directives. These keywords were already
+defined in locale/programs/locfile-kw.h, an implementation for
+'define', 'undef', 'ifdef', 'else' and 'endif' is now provided in
+locale/programs/ld-collate.c. For the moment, 'ifndef' and 'elif'
+are not implemented because they do not appear in locfile-kw.h.
+This patch is harmless, it only adds new keywords.
+
+# DP: Dpatch author: Denis Barbier
+# DP: Patch author: Denis Barbier
+# DP: Upstream status: BZ686
+# DP: Date: 2006-01-08
+
+Index: glibc-2.3.5/locale/programs/ld-collate.c
+===================================================================
+--- glibc-2.3.5.orig/locale/programs/ld-collate.c
++++ glibc-2.3.5/locale/programs/ld-collate.c
+@@ -161,6 +161,24 @@
+ size_t line;
+ };
+
++/* Data type for toggles. */
++struct toggle_list_t;
++
++struct toggle_list_t
++{
++ const char *name;
++
++ /* Predecessor in the list. */
++ struct toggle_list_t *last;
++
++ /* This flag is set when a keyword is undefined. */
++ int is_undefined;
++
++ /* Where does the branch come from. */
++ const char *file;
++ size_t line;
++};
++
+ /* Sparse table of struct element_t *. */
+ #define TABLE wchead_table
+ #define ELEMENT struct element_t *
+@@ -214,6 +232,12 @@
+ /* This value is used when handling ellipsis. */
+ struct element_t ellipsis_weight;
+
++ /* Known keywords. */
++ struct toggle_list_t *defined_keywords;
++
++ /* This is a stack of . */
++ struct toggle_list_t *flow_control;
++
+ /* Known collating elements. */
+ hash_table elem_table;
+
+@@ -1456,6 +1480,56 @@
+ }
+
+
++static struct token *
++flow_skip (struct linereader *ldfile, const struct charmap_t *charmap,
++ struct locale_collate_t *collate)
++{
++ int level = 0;
++ struct token *now;
++ enum token_t nowtok;
++ while (1)
++ {
++ lr_ignore_rest (ldfile, 0);
++ now = lr_token (ldfile, charmap, NULL, NULL, 0);
++ nowtok = now->tok;
++ if (nowtok == tok_eof)
++ break;
++ else if (nowtok == tok_ifdef || nowtok == tok_ifndef)
++ ++level ;
++ else if (nowtok == tok_else)
++ {
++ if (strcmp (collate->flow_control->name, "else") == 0)
++ lr_error (ldfile,
++ _("%s: `else' statement at `%s:%Zu' cannot be followed by another `else' statement"),
++ "LC_COLLATE", collate->flow_control->name, collate->flow_control->line);
++ if (level == 0)
++ {
++ collate->flow_control->name = "else";
++ collate->flow_control->file = ldfile->fname;
++ collate->flow_control->line = ldfile->lineno;
++ break;
++ }
++ }
++ else if (nowtok == tok_endif)
++ {
++ if (level == 0)
++ {
++ collate->flow_control = collate->flow_control->last;
++ break;
++ }
++ --level ;
++ }
++ }
++ if (nowtok == tok_eof)
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: unterminated `%s' flow control beginning at %s:%Zu"),
++ "LC_COLLATE", collate->flow_control->name,
++ collate->flow_control->file,
++ collate->flow_control->line));
++ return now;
++}
++
++
+ static void
+ collate_startup (struct linereader *ldfile, struct localedef_t *locale,
+ struct localedef_t *copy_locale, int ignore_content)
+@@ -3786,6 +3860,205 @@
+ repertoire, result, nowtok);
+ break;
+
++ case tok_define:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ arg = lr_token (ldfile, charmap, result, NULL, verbose);
++ if (arg->tok != tok_ident)
++ goto err_label;
++ else
++ {
++ struct toggle_list_t *runp = collate->defined_keywords;
++ char *name;
++
++ while (runp != NULL)
++ if (strncmp (runp->name, arg->val.str.startmb,
++ arg->val.str.lenmb) == 0
++ && runp->name[arg->val.str.lenmb] == '\0')
++ break;
++ else
++ runp = runp->last;
++
++ if (runp != NULL && runp->is_undefined == 0)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ if (runp == NULL)
++ {
++ runp = (struct toggle_list_t *) xcalloc (1, sizeof (*runp));
++ runp->last = collate->defined_keywords;
++ collate->defined_keywords = runp;
++ }
++ else
++ {
++ free ((char *) runp->name);
++ runp->is_undefined = 0;
++ }
++
++ name = (char *) xmalloc (arg->val.str.lenmb + 1);
++ memcpy (name, arg->val.str.startmb, arg->val.str.lenmb);
++ name[arg->val.str.lenmb] = '\0';
++ runp->name = name;
++ }
++ lr_ignore_rest (ldfile, 1);
++ break;
++
++ case tok_undef:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ arg = lr_token (ldfile, charmap, result, NULL, verbose);
++ if (arg->tok != tok_ident)
++ goto err_label;
++ else
++ {
++ struct toggle_list_t *runp = collate->defined_keywords;
++ while (runp != NULL)
++ if (strncmp (runp->name, arg->val.str.startmb,
++ arg->val.str.lenmb) == 0
++ && runp->name[arg->val.str.lenmb] == '\0')
++ {
++ runp->is_undefined = 1;
++ break;
++ }
++ else
++ runp = runp->last;
++ }
++ lr_ignore_rest (ldfile, 1);
++ break;
++
++ case tok_ifdef:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ arg = lr_token (ldfile, charmap, result, NULL, verbose);
++ if (arg->tok != tok_ident)
++ goto err_label;
++ else
++ {
++ struct toggle_list_t *runp = collate->defined_keywords;
++ struct toggle_list_t *flow = (struct toggle_list_t *) xcalloc (1, sizeof (*runp));
++ flow->name = "ifdef";
++ flow->file = ldfile->fname;
++ flow->line = ldfile->lineno;
++ flow->last = collate->flow_control;
++ collate->flow_control = flow;
++
++ while (runp != NULL)
++ if (strncmp (runp->name, arg->val.str.startmb,
++ arg->val.str.lenmb) == 0
++ && runp->name[arg->val.str.lenmb] == '\0')
++ break;
++ else
++ runp = runp->last;
++
++ if (runp == NULL)
++ {
++ now = flow_skip(ldfile, charmap, collate);
++ if (now->tok == tok_eof)
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: unterminated `%s' flow control"), "LC_COLLATE", collate->flow_control->name));
++ }
++ }
++ lr_ignore_rest (ldfile, 1);
++ break;
++
++ case tok_ifndef:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ arg = lr_token (ldfile, charmap, result, NULL, verbose);
++ if (arg->tok != tok_ident)
++ goto err_label;
++ else
++ {
++ struct toggle_list_t *runp = collate->defined_keywords;
++ struct toggle_list_t *flow = (struct toggle_list_t *) xcalloc (1, sizeof (*runp));
++ flow->name = "ifndef";
++ flow->file = ldfile->fname;
++ flow->line = ldfile->lineno;
++ flow->last = collate->flow_control;
++ collate->flow_control = flow;
++
++ while (runp != NULL)
++ if (strncmp (runp->name, arg->val.str.startmb,
++ arg->val.str.lenmb) == 0
++ && runp->name[arg->val.str.lenmb] == '\0')
++ break;
++ else
++ runp = runp->last;
++
++ if (runp != NULL)
++ {
++ now = flow_skip(ldfile, charmap, collate);
++ if (now->tok == tok_eof)
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: unterminated `%s' flow control"), "LC_COLLATE", collate->flow_control->name));
++ }
++ }
++ lr_ignore_rest (ldfile, 1);
++ break;
++
++ case tok_else:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ if (strcmp (collate->flow_control->name, "else") == 0)
++ lr_error (ldfile,
++ _("%s: `else' statement at `%s:%Zu' cannot be followed by another `else' statement"),
++ "LC_COLLATE", collate->flow_control->name, collate->flow_control->line);
++ collate->flow_control->name = "else";
++ collate->flow_control->file = ldfile->fname;
++ collate->flow_control->line = ldfile->lineno;
++ now = flow_skip(ldfile, charmap, collate);
++ if (now->tok == tok_eof)
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: unterminated `%s' flow control"), "LC_COLLATE", collate->flow_control->name));
++ break;
++
++ case tok_endif:
++ /* Ignore the rest of the line if we don't need the input of
++ this line. */
++ if (ignore_content)
++ {
++ lr_ignore_rest (ldfile, 0);
++ break;
++ }
++
++ if (collate->flow_control == NULL)
++ goto err_label;
++ else
++ collate->flow_control = collate->flow_control->last;
++ break;
++
+ case tok_end:
+ /* Next we assume `LC_COLLATE'. */
+ if (!ignore_content)
+@@ -3815,6 +4088,13 @@
+ else if (state == 5)
+ WITH_CUR_LOCALE (error (0, 0, _("\
+ %s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
++ if (collate->flow_control != NULL
++ && strcmp(collate->flow_control->file, ldfile->fname) == 0)
++ WITH_CUR_LOCALE (error (0, 0, _("\
++%s: unterminated `%s' flow control beginning at %s:%Zu"),
++ "LC_COLLATE", collate->flow_control->name,
++ collate->flow_control->file,
++ collate->flow_control->line));
+ }
+ arg = lr_token (ldfile, charmap, result, NULL, verbose);
+ if (arg->tok == tok_eof)
Deleted: glibc-package/trunk/debian/patches/localedata/discard-dz_BT.diff
===================================================================
--- glibc-package/trunk/debian/patches/localedata/discard-dz_BT.diff 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/localedata/discard-dz_BT.diff 2006-01-09 00:05:24 UTC (rev 1095)
@@ -1,14 +0,0 @@
-This locale can be generated only after localedef is fixed, see BZ870.
-
-Index: glibc-2.3.5/localedata/SUPPORTED
-===================================================================
---- glibc-2.3.5.orig/localedata/SUPPORTED
-+++ glibc-2.3.5/localedata/SUPPORTED
-@@ -83,7 +83,6 @@
- de_LU.UTF-8/UTF-8 \
- de_LU/ISO-8859-1 \
- de_LU@euro/ISO-8859-15 \
--dz_BT/UTF-8 \
- el_GR.UTF-8/UTF-8 \
- el_GR/ISO-8859-7 \
- en_AU.UTF-8/UTF-8 \
Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series 2006-01-09 00:01:46 UTC (rev 1094)
+++ glibc-package/trunk/debian/patches/series 2006-01-09 00:05:24 UTC (rev 1095)
@@ -101,4 +101,13 @@
glibc235-dash.diff -p0
glibc235-leapsecond.diff -p0
localedata/locale-ku_TR.diff -p0
-localedata/discard-dz_BT.diff
+#localedata/discard-dz_BT.diff # not needed when complex-collate is applied
+locale/complex-collate.diff
+locale/fix-exhausted-memory.diff
+#locale/check-unknown-symbols.diff # locales have to be fixed first
+locale/fix-LC_COLLATE-rules.diff
+forward-backward-collation.diff
+locale/preprocessor-collate.diff
+locale/LC_IDENTIFICATION-optional-fields.diff
+locale/LC_COLLATE-keywords-ordering.diff
+locale/locale-print-LANGUAGE.diff
Reply to: