check-unknown-symbols
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 25 Dec 2022 18:42:32 +0000 (18:42 +0000)
committerAurelien Jarno <aurel32@debian.org>
Sun, 25 Dec 2022 18:42:32 +0000 (18:42 +0000)
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

Gbp-Pq: Topic locale
Gbp-Pq: Name check-unknown-symbols.diff

locale/programs/ld-collate.c

index 992814491d2a5e2321786844f1d7930aa3b5e54b..4981c8b9abcc57c561301a3f3bf38b3e05bc54df 100644 (file)
@@ -3515,8 +3515,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
            {