>From ef8494a49da47bf0a80c4de27316548a77a7dbeb Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 23 Sep 2026 19:34:03 -0400 Subject: [PATCH 22/23] stop locale path search on any error except deterministic unavailability any other error could indicate a transient condition that would be altering the identity of the locale selected if path search were allowed to continue. this is the same principle used for library search and similar to execvp path search. unlike with execvp, we don't bother tracking if EACCES was seen because setlocale is not specified to report a meaningful error. --- src/locale/locale_map.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c index 04dcdcaf..b08c3bce 100644 --- a/src/locale/locale_map.c +++ b/src/locale/locale_map.c @@ -102,6 +102,16 @@ const struct __locale_map *__get_locale(int cat, const char *val) buf[l+1+n] = 0; size_t map_size; const void *map = __map_file(buf, &map_size); + if (!map) { + switch (errno) { + case ENOENT: + case ENOTDIR: + case EACCES: + case ENAMETOOLONG: + continue; + } + break; + } if (map) { struct __locale_map tmp; if (load_locale(&tmp, map) || -- 2.21.0