[PATCH 1/7] localedef: add check for unknown symbols in collation rules
Check for unknown symbols in collation rules. This is useful to
detect broken locales since unknown symbols are always wrong.
Original patch from belocs-locales-bin 2.3.4-3, 2005-03-30. This
request has not been submitted upstream yet.
[aurelien@aurel32.net, 2008-08-08: changed errors to warnings]
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
locale/programs/ld-collate.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 11bd7ea..88b6890 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -3645,8 +3645,20 @@ error while adding equivalent collating symbol"));
}
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)
+ {
+ if (verbose)
+ lr_error (ldfile, _("%s: symbol `%.*s' not known"),
+ "LC_COLLATE", (int) symlen, symstr);
+ }
}
else
{
--
1.7.5.1.668.gce6e7.dirty
Reply to: