>From 8ff07573eed220c74e27dee7a80584a7497636d0 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 14 Sep 2026 17:44:45 -0400 Subject: [PATCH 08/18] locale: remove synthesis of nonexistent locale names this change does not make setlocale fail for locale names lacking a definition, but it eliminates the behavior of preserving the requested name, instead handling them as aliases for C.UTF-8 (LC_CTYLE) or C (all other categories). this breaks gettext search for translations to languages where no libc locale exists, but adding support for the new LANGUAGE environment variable will mitigate that. --- src/locale/locale_map.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c index da61f7fc..ce56bc40 100644 --- a/src/locale/locale_map.c +++ b/src/locale/locale_map.c @@ -92,19 +92,6 @@ const struct __locale_map *__get_locale(int cat, const char *val) } } - /* If no locale definition was found, make a locale map - * object anyway to store the name, which is kept for the - * sake of being able to do message translations at the - * application level. */ - if (!new && (new = malloc(sizeof *new))) { - new->map = __c_dot_utf8.map; - new->map_size = __c_dot_utf8.map_size; - memcpy(new->name, val, n); - new->name[n] = 0; - new->next = loc_head; - loc_head = new; - } - /* For LC_CTYPE, never return a null pointer unless the * requested name was "C" or "POSIX". */ if (!new && cat == LC_CTYPE) new = (void *)&__c_dot_utf8; -- 2.21.0