From: Denis Barbier <[email protected]>
Date: Tue, 23 Oct 2007 09:24:51 -0500

Localedef is pretty strict with keywords ordering in LC_COLLATE section.
One consequence is that it is sometimes hard to extend iso14651_t1 template.
For instance, am_ET uses a hack to define a new script, and the patch
sent to BZ686 chokes on this file.
Here is a patch to let localedef be less strict.

Originally from belocs-locales-bin 2.3.3-14, 2005-01-21.

Submitted upstream: BZ690

[[email protected], 2007-10-23: cleanup]

Signed-off-by: Jonathan Nieder <[email protected]>
---
That's the end of the series.  I don't expect anything to happen
immediately; just wanted to get these out there so if my copy gets
destroyed the little research I did is not for nothing so there's a
place to put comments as I learn more.

Some of these were marked fixed upstream, some wontfix.

Thanks for keeping the patches directory nicely sorted and readable.

 locale/programs/ld-collate.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 7d1455a..c433f41 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2896,14 +2896,23 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
       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;
@@ -2917,9 +2926,6 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
              break;
            }
 
-         if (state != 0)
-           goto err_label;
-
          arg = lr_token (ldfile, charmap, result, NULL, verbose);
          if (arg->tok != tok_number)
            goto err_label;
@@ -2940,7 +2946,7 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
              break;
            }
 
-         if (state != 0)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -2987,7 +2993,7 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
              break;
            }
 
-         if (state != 0 && state != 2)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -3053,7 +3059,7 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
              break;
            }
 
-         if (state != 0 && state != 2)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -3199,7 +3205,7 @@ collate_read (struct linereader *ldfile, struct 
localedef_t *result,
              break;
            }
 
-         if (state != 0)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -3320,7 +3326,7 @@ error while adding equivalent collating symbol"));
              break;
            }
 
-         if (state != 0 && state != 1 && state != 2)
+         if (state == 3 || state == 5)
            goto err_label;
          state = 1;
 
@@ -3631,8 +3637,6 @@ error while adding equivalent collating symbol"));
 %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.  */
-- 
1.7.5.1


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/20110510071851.GG2277@elie

Reply via email to