glibc/locale
Carlos O'Donell 684fbab755 locale: Handle loading a missing locale twice (Bug 14247)
Delay setting file->decided until the data has been successfully loaded
by _nl_load_locale().  If the function fails to load the data then we
must return and error and leave decided untouched to allow the caller to
attempt to load the data again at a later time.  We should not set
decided to 1 early in the function since doing so may prevent attempting
to load it again. We want to try loading it again because that allows an
open to fail and set errno correctly.

On the other side of this problem is that if we are called again with
the same inputs we will fetch the cached version of the object and carry
out no open syscalls and that fails to set errno so we must set errno to
ENOENT in that case.  There is a second code path that has to be handled
where the name of the locale matches but the codeset doesn't match.

These changes ensure that errno is correctly set on failure in all the
return paths in _nl_find_locale().

Adds tst-locale-loadlocale to cover the bug.

No regressions on x86_64.

Co-authored-by: Jeff Law <law@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-04-22 16:03:00 -04:00
..
bits Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
programs Update copyright dates not handled by scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-localedef-path-norm.root localedef: Add verbose messages for failure paths. 2020-04-26 13:55:58 -04:00
broken_cur_max.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C_name.c
C-address.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-collate-seq.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-collate.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-ctype.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-identification.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-measurement.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-messages.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-monetary.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-name.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-numeric.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-paper.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-telephone.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-time.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
C-translit.h.in Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
categories.def Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
coll-lookup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
coll-lookup.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
duplocale.c duplocale: protect use of global locale (bug 23970) 2024-03-11 09:52:59 +01:00
elem-hash.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
findlocale.c locale: Handle loading a missing locale twice (Bug 14247) 2024-04-22 16:03:00 -04:00
freelocale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
gen-translit.py Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
global-locale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hashval.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
indigits.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
indigitswc.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
iso-639.def Define ISO 639-3 "ssy" (Saho) 2024-01-18 11:01:10 +01:00
iso-3166.def Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
iso-4217.def Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
langinfo.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-address.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-collate.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-ctype.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-identification.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-measurement.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-messages.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-monetary.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-name.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-numeric.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-paper.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-telephone.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lc-time.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
loadarchive.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
loadlocale.c locale: Handle loading a missing locale twice (Bug 14247) 2024-04-22 16:03:00 -04:00
locale.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
localeconv.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
localeinfo.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
localename.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
locarchive.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Makefile locale: Sort Makefile variables. 2024-01-10 14:08:17 -05:00
mb_cur_max.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
newlocale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nl_langinfo_l.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nl_langinfo.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
outdigits.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
outdigitswc.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
setlocale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strlen-hash.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
SYS_libc.c
tst-C-locale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-duplocale.c
tst-locale-locpath.sh Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-localedef-path-norm.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-locname.c
uselocale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Versions C2x strtol binary constant handling 2023-02-16 23:02:40 +00:00
weight.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
weightwc.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
xlocale.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00