summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-04 12:27:59 -0700
committerKarl Williamson <khw@cpan.org>2019-03-04 13:01:37 -0700
commit8e13243a89cbac8e8110cc8ac0674183cfa30bf7 (patch)
tree801f6ea21d4a9deafea646bea79ad5c3e016897f /locale.c
parent201f75a992613afb464a3a412b8a271c8726ecb3 (diff)
downloadperl-8e13243a89cbac8e8110cc8ac0674183cfa30bf7.tar.gz
Properly handle systems with crippled locales
Some systems fake their locales, so that they pretend to accept a locale change, but they either do nothing, making everything the C locale, or on some systems there is a a second locale "C-UTF-8" that can be switched to. Configure probes have been added to find such systems, and this commit changes to use the results of these probes, so that we don't try looking for other locales (any names we came up with would be accepted as valid, but don't work, and tests were failing as a result). Anything running the musl library fits, as does OpenBSD and its kin, as they view locales as security risks. This commit allows us to take out some code that was looking for particular OS's.
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/locale.c b/locale.c
index e2bb54ebdf..2b123d16ee 100644
--- a/locale.c
+++ b/locale.c
@@ -589,8 +589,11 @@ S_emulate_setlocale(const int category,
/* If this assert fails, adjust the size of curlocales in intrpvar.h */
STATIC_ASSERT_STMT(C_ARRAY_LENGTH(PL_curlocales) > LC_ALL_INDEX);
-# if defined(_NL_LOCALE_NAME) && defined(DEBUGGING)
-
+# if defined(_NL_LOCALE_NAME) \
+ && defined(DEBUGGING) \
+ && ! defined(SETLOCALE_ACCEPTS_ANY_LOCALE_NAME)
+ /* On systems that accept any locale name, the real underlying locale
+ * is often returned by this internal function, so we can't use it */
{
/* Internal glibc for querylocale(), but doesn't handle
* empty-string ("") locale properly; who knows what other