check-unknown-symbols
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Tue, 27 May 2025 10:40:04 +0000 (11:40 +0100)
committerSean Whitton <spwhitton@spwhitton.name>
Tue, 27 May 2025 10:40:04 +0000 (11:40 +0100)
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 feb1a11258437e482e9aede8036b1749da5ca1b3..a0a3a1572a3841ddc306487a34c4f64ad2292ff7 100644 (file)
@@ -3492,8 +3492,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
            {