summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/nlsfuncs.cc19
-rw-r--r--winsup/cygwin/release/2.3.03
3 files changed, 22 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3c489d194..e46ffef09 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2015-10-30 Corinna Vinschen <corinna@vinschen.de>
+ * nlsfuncs.cc (__get_lcid_from_locale): Handle LocaleNameToLCID
+ returning LOCALE_CUSTOM_UNSPECIFIED instead of failing in case of
+ an unsupported locale on Windows 10.
+
+2015-10-30 Corinna Vinschen <corinna@vinschen.de>
+
* exceptions.cc (sigpacket::process): Avoid potentially double unlocking
the TLS mutex.
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index f7031f92e..1b2b2d790 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1,6 +1,6 @@
/* nlsfuncs.cc: NLS helper functions
- Copyright 2010, 2011, 2012, 2013 Red Hat, Inc.
+ Copyright 2010, 2011, 2012, 2013, 2015 Red Hat, Inc.
This file is part of Cygwin.
@@ -88,7 +88,9 @@ __get_lcid_from_locale (const char *name)
*c = '-';
mbstowcs (wlocale, locale, ENCODING_LEN + 1);
lcid = LocaleNameToLCID (wlocale, 0);
- if (lcid == 0)
+ /* Bug on Windows 10: LocaleNameToLCID returns LOCALE_CUSTOM_UNSPECIFIED
+ for unknown locales. */
+ if (lcid == 0 || lcid == LOCALE_CUSTOM_UNSPECIFIED)
{
/* Unfortunately there are a couple of locales for which no form
without a Script part per RFC 4646 exists.
@@ -127,24 +129,29 @@ __get_lcid_from_locale (const char *name)
{
/* Vista/2K8 is missing sr-ME and sr-RS. It has only the
deprecated sr-CS. So we map ME and RS to CS here. */
- if (lcid == 0)
+ if (lcid == 0 || lcid == LOCALE_CUSTOM_UNSPECIFIED)
lcid = LocaleNameToLCID (L"sr-Cyrl-CS", 0);
/* "@latin" modifier for the sr_XY locales changes
collation behaviour so lcid should accommodate that
by being set to the Latin sublang. */
- if (lcid != 0 && has_modifier ("@latin"))
+ if (lcid != 0 && lcid != LOCALE_CUSTOM_UNSPECIFIED
+ && has_modifier ("@latin"))
lcid = MAKELANGID (lcid & 0x3ff, (lcid >> 10) - 1);
}
else if (!strncmp (locale, "uz-", 3))
{
/* Equivalent for "@cyrillic" modifier in uz_UZ locale */
- if (lcid != 0 && has_modifier ("@cyrillic"))
+ if (lcid != 0 && lcid != LOCALE_CUSTOM_UNSPECIFIED
+ && has_modifier ("@cyrillic"))
lcid = MAKELANGID (lcid & 0x3ff, (lcid >> 10) + 1);
}
break;
}
}
- last_lcid = lcid ?: (LCID) -1;
+ if (lcid && lcid != LOCALE_CUSTOM_UNSPECIFIED)
+ last_lcid = lcid;
+ else
+ last_lcid = (LCID) -1;
debug_printf ("LCID=%04y", last_lcid);
return last_lcid;
}
diff --git a/winsup/cygwin/release/2.3.0 b/winsup/cygwin/release/2.3.0
index 1cad81b62..77090e38e 100644
--- a/winsup/cygwin/release/2.3.0
+++ b/winsup/cygwin/release/2.3.0
@@ -57,3 +57,6 @@ Bug Fixes
- Fix sigwait(3) to return errno instead of -1 and never to return with EINTR.
- Fix pthread_kill(3) to return errno instead of -1.
+
+- Workaround a bug in Windows 10 NLS handling.
+ Addresses: https://cygwin.com/ml/cygwin/2015-10/msg00547.html