From 92a8f360080d91e9e1e2be52b7c3704c1ffad1e7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 17 Oct 2007 17:23:56 +0200 Subject: [PATCH] Restrict the usable locale names on Cygwin. --- ChangeLog | 7 +++++++ m4/locale-fr.m4 | 16 +++++++++++++++- m4/locale-tr.m4 | 9 ++++++++- m4/locale-zh.m4 | 9 ++++++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3336f1bfd..ff56f80d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-17 Bruno Haible + + * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): On Cygwin, don't + allow locale names without encoding suffix. + * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. + * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. + 2007-10-16 Bruno Haible * lib/getcwd.c (__getcwd): Define with explicit rpl_ prefix. diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4 index a33f0680d..e1ab25436 100644 --- a/m4/locale-fr.m4 +++ b/m4/locale-fr.m4 @@ -1,4 +1,4 @@ -# locale-fr.m4 serial 6 (gettext-0.16.2) +# locale-fr.m4 serial 7 (gettext-0.16.2) dnl Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,6 +37,8 @@ changequote(,)dnl #if HAVE_LANGINFO_CODESET # include #endif +#include +#include struct tm t; char buf[16]; int main () { @@ -48,6 +50,11 @@ int main () { #if HAVE_LANGINFO_CODESET if (nl_langinfo (CODESET) [0] == '\0') return 1; #endif +#ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +#endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only one byte long. This excludes the UTF-8 encoding. */ @@ -113,6 +120,8 @@ changequote(,)dnl #if HAVE_LANGINFO_CODESET # include #endif +#include +#include struct tm t; char buf[16]; int main () { @@ -128,6 +137,11 @@ int main () { # if HAVE_LANGINFO_CODESET if (nl_langinfo (CODESET) [0] == '\0') return 1; # endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif /* Check whether in the abbreviation of the second month, the second character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is two bytes long, with UTF-8 encoding. */ diff --git a/m4/locale-tr.m4 b/m4/locale-tr.m4 index 2286c181b..5fce2cfeb 100644 --- a/m4/locale-tr.m4 +++ b/m4/locale-tr.m4 @@ -1,4 +1,4 @@ -# locale-tr.m4 serial 2 +# locale-tr.m4 serial 3 dnl Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,6 +18,8 @@ changequote(,)dnl #if HAVE_LANGINFO_CODESET # include #endif +#include +#include struct tm t; char buf[16]; int main () { @@ -33,6 +35,11 @@ int main () { # if HAVE_LANGINFO_CODESET if (nl_langinfo (CODESET) [0] == '\0') return 1; # endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif /* Check whether in the abbreviation of the eighth month, the second character (should be U+011F: LATIN SMALL LETTER G WITH BREVE) is two bytes long, with UTF-8 encoding. */ diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4 index 187ad3510..ceff55bc4 100644 --- a/m4/locale-zh.m4 +++ b/m4/locale-zh.m4 @@ -1,4 +1,4 @@ -# locale-zh.m4 serial 2 +# locale-zh.m4 serial 3 dnl Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,6 +38,8 @@ changequote(,)dnl #if HAVE_LANGINFO_CODESET # include #endif +#include +#include struct tm t; char buf[16]; int main () @@ -51,6 +53,11 @@ int main () #if HAVE_LANGINFO_CODESET if (nl_langinfo (CODESET) [0] == '\0') return 1; #endif +#ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +#endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; -- 2.11.0