public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
To: cygwin@cygwin.com
Subject: Re: cygwin started speaking German today
Date: Sun, 16 Oct 2011 18:42:00 -0000	[thread overview]
Message-ID: <4E9B2585.1000409@cwilson.fastmail.fm> (raw)
In-Reply-To: <4E9474CA.7080408@cwilson.fastmail.fm>

[-- Attachment #1: Type: text/plain, Size: 2137 bytes --]

On 10/11/2011 12:54 PM, Charles Wilson wrote:
> Consensus does appear to be unanimous on what to do; I just need to
> review all the postings and figure out exactly /how/ to do it.

I have uploaded the new packages.  There are three new patches:

1) modified localename.c significantly.  No longer "ignores" 
LANG=C.UTF-8; also does not try to do any parsing of the Windows I18N 
settings.  Basically, acts like linux -- if the value of the locale 
string isn't supported by the underlying setlocale() implementation, 
then it is ignored (e.g. default back to "C.UTF-8" or "C") -- libintl 
doesn't try to 'be smart' -- or to second-guess.  Also, relies on 
cygwin's glibc-like setlocale(LC_*, NULL) behavior -- which has been 
supported by newlib since the cygwin 1.5 days (even if it always 
returned "C" back then).

2) Fixes to the test suite related to the above changes.  From the 
CHECK_NOTES file:

NOTE: there were four other failures that arose because of the
       changes to localename.  These were:
          format-c-3
          format-c-4
          plural-1
          plural-2
       but the test suite was patched to avoid these failures.
       The problem is rather complicated; gettext-0.18.1.1 now has a
       libintl_setlocale function that is used by libintl clients,
       instead of the system setlocale.  The localename patch left
       that in place, but ensured that it did far less work -- was less
       obtrusive -- in its interposition between clients and the system
       setlocale.  However, some of that eliminated 'work' also allowed
       the gettext test suite to 'cheat' a bit -- it used non-existent
       locales (like 'fr' rather than 'fr_FR'), and *re-hijacked* the
       setlocale function itself.  None of that works anymore -- and
       *actual* clients are unlikely to need/want to do it -- so the
       test suite was patched to use real locales in all cases, and to
       not re-hijack.

3) Adopted Bruno's upstream changes to relocatable.c, turning off 
"expensive" relocation support in libintl.

Odds of #1 and #2 being adopted upstream are effectively nil, so...

--
Chuck


[-- Attachment #2: patch-1.txt --]
[-- Type: text/plain, Size: 2607 bytes --]

diff -u old/gettext-0.18.1.1/gettext-runtime/intl/localename.c new/gettext-0.18.1.1/gettext-runtime/intl/localename.c
--- old/gettext-0.18.1.1/gettext-runtime/intl/localename.c	2011-10-15 00:21:37.853133600 -0400
+++ new/gettext-0.18.1.1/gettext-runtime/intl/localename.c	2011-10-15 00:29:27.601133600 -0400
@@ -59,7 +59,7 @@
 # define WIN32_NATIVE
 #endif
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 /* List of language codes, sorted by value:
@@ -1407,7 +1407,7 @@
 #endif
 
 
-#if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+#if defined WIN32_NATIVE /* WIN32 */
 
 /* Canonicalize a Win32 native locale name to a Unix locale name.
    NAME is a sufficiently large buffer.
@@ -2770,8 +2770,8 @@
     setting of 'local'."
    However it does not specify the exact format.  Neither do SUSV2 and
    ISO C 99.  So we can use this feature only on selected systems (e.g.
-   those using GNU C Library).  */
-#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2)
+   those using GNU C Library, or cygwin [1.5 and 1.7+]).  */
+#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) || defined __CYGWIN__
 # define HAVE_LOCALE_NULL
 #endif
 
@@ -2826,11 +2826,6 @@
          Ignore invalid LANG value set by the Terminal application.  */
       if (strcmp (retval, "UTF-8") != 0)
 #endif
-#if defined __CYGWIN__
-      /* Cygwin.
-         Ignore dummy LANG value set by ~/.profile.  */
-      if (strcmp (retval, "C.UTF-8") != 0)
-#endif
         return retval;
     }
 
@@ -2923,7 +2918,7 @@
 
 # endif
 
-# if defined WIN32_NATIVE || defined __CYGWIN__ /* WIN32 or Cygwin */
+# if defined WIN32_NATIVE /* WIN32 */
   {
     LCID lcid;
 
@@ -2933,6 +2928,23 @@
     return gl_locale_name_from_win32_LCID (lcid);
   }
 # endif
+# if defined __CYGWIN__
+  {
+    /* Rarely arrive here. This function is called only when an earlier
+     * call to gl_locale_name_posix() or gl_locale_name_environ()
+     * returned NULL.  That first function now simply delegates to
+     * setlocale (LC_*, NULL), which never fails on cygwin.  But...for
+     * completeness, or when called after gl_locale_name_environ() and
+     * none are set, go ahead and specify the cygwin default. Cheat a bit
+     * to distinguish old cygwin (1.5 and below) from new cygwin (1.7+).
+     */
+#  if PATH_MAX < 261   /* cygwin 1.5 or below */
+    return "C";
+#  else                /* PATH_MAX = 4096, cygwin 1.7 or above */
+    return "C.UTF-8";
+#  endif
+  }
+# endif
 #endif
 }
 

[-- Attachment #3: patch-2.txt --]
[-- Type: text/plain, Size: 3544 bytes --]

--- origsrc/gettext-0.18.1.1/gettext-tools/tests/format-c-3-prg.c	2010-06-06 08:49:58.000000000 -0400
+++ src/gettext-0.18.1.1/gettext-tools/tests/format-c-3-prg.c	2011-10-15 22:54:48.494133600 -0400
@@ -34,7 +34,7 @@
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in
    setlocale.c.  */
-#undef setlocale
+/* #undef setlocale */
 
 #define _(string) gettext (string)
 
--- origsrc/gettext-0.18.1.1/gettext-tools/tests/format-c-4-prg.c	2010-06-06 08:49:58.000000000 -0400
+++ src/gettext-0.18.1.1/gettext-tools/tests/format-c-4-prg.c	2011-10-15 21:49:23.028133600 -0400
@@ -34,7 +34,7 @@
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in
    setlocale.c.  */
-#undef setlocale
+/* #undef setlocale */
 
 #define _(string) gettext (string)
 
--- origsrc/gettext-0.18.1.1/gettext-tools/tests/plural-1	2010-06-06 08:49:58.000000000 -0400
+++ src/gettext-0.18.1.1/gettext-tools/tests/plural-1	2011-10-15 22:32:46.440133600 -0400
@@ -65,15 +65,15 @@ ${DIFF} fr.po.strip fr.po.un || exit 1
 tmpfiles="$tmpfiles cake.ok cake.tmp cake.out"
 : ${DIFF=diff}
 echo 'un morceau de gateau' > cake.ok
-LANGUAGE= ./cake fr 1 > cake.tmp || exit 1
+LANGUAGE= ./cake fr_FR 1 > cake.tmp || exit 1
 LC_ALL=C tr -d '\r' < cake.tmp > cake.out || exit 1
 ${DIFF} cake.ok cake.out || exit 1
 echo '2 morceaux de gateau' > cake.ok
-LANGUAGE= ./cake fr 2 > cake.tmp || exit 1
+LANGUAGE= ./cake fr_FR 2 > cake.tmp || exit 1
 LC_ALL=C tr -d '\r' < cake.tmp > cake.out || exit 1
 ${DIFF} cake.ok cake.out || exit 1
 echo '10 morceaux de gateau' > cake.ok
-LANGUAGE= ./cake fr 10 > cake.tmp || exit 1
+LANGUAGE= ./cake fr_FR 10 > cake.tmp || exit 1
 LC_ALL=C tr -d '\r' < cake.tmp > cake.out || exit 1
 ${DIFF} cake.ok cake.out || exit 1
 
--- origsrc/gettext-0.18.1.1/gettext-tools/tests/plural-1-prg.c	2010-06-06 08:49:58.000000000 -0400
+++ src/gettext-0.18.1.1/gettext-tools/tests/plural-1-prg.c	2011-10-15 23:00:57.110133600 -0400
@@ -30,7 +30,7 @@
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in
    setlocale.c.  */
-#undef setlocale
+/* #undef setlocale */
 
 int
 main (int argc, char *argv[])
--- origsrc/gettext-0.18.1.1/gettext-tools/tests/plural-2	2010-06-06 08:49:58.000000000 -0400
+++ src/gettext-0.18.1.1/gettext-tools/tests/plural-2	2011-10-15 22:51:09.838133600 -0400
@@ -3,10 +3,10 @@
 tmpfiles=""
 trap 'rm -fr $tmpfiles' 1 2 3 15
 
-tmpfiles="$tmpfiles ll ll.po dataout"
+tmpfiles="$tmpfiles es ll.po dataout"
 : ${MSGFMT=msgfmt}
-test -d ll || mkdir ll
-test -d ll/LC_MESSAGES || mkdir ll/LC_MESSAGES
+test -d es || mkdir es
+test -d es/LC_MESSAGES || mkdir es/LC_MESSAGES
 
 tmpfiles="$tmpfiles plural-2.data"
 cat <<EOF > plural-2.data
@@ -68,10 +68,10 @@ msgstr[7] "7"
 msgstr[8] "8"
 msgstr[9] "9"
 EOF
-  ${MSGFMT} -o ll/LC_MESSAGES/plural.mo ll.po || exit 1
+  ${MSGFMT} -o es/LC_MESSAGES/plural.mo ll.po || exit 1
   (for i in '' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do
      LANGUAGE= TEXTDOMAIN=plural TEXTDOMAINDIR=. \
-       $NGETTEXT --env LC_ALL=ll X Y ${i}0 ${i}1 ${i}2 ${i}3 ${i}4 ${i}5 ${i}6 ${i}7 ${i}8 ${i}9
+       $NGETTEXT --env LC_ALL=es_ES X Y ${i}0 ${i}1 ${i}2 ${i}3 ${i}4 ${i}5 ${i}6 ${i}7 ${i}8 ${i}9
    done) > dataout
   test "$dataok" = `cat dataout` || {
     echo "Formula evaluation error for language $lang" 1>&2

[-- Attachment #4: patch-3.txt --]
[-- Type: text/plain, Size: 2493 bytes --]

diff -u old/gettext-0.18.1.1/gettext-runtime/gnulib-lib/relocatable.c new/gettext-0.18.1.1/gettext-runtime/gnulib-lib/relocatable.c
--- old/gettext-0.18.1.1/gettext-runtime/gnulib-lib/relocatable.c
+++ new/gettext-0.18.1.1/gettext-runtime/gnulib-lib/relocatable.c
@@ -85,6 +85,19 @@
 # define FILE_SYSTEM_PREFIX_LEN(P) 0
 #endif
 
+/* Whether to enable the more costly support for relocatable libraries.
+   It allows libraries to be have been installed with a different original
+   prefix than the program.  But it is quite costly, especially on Cygwin
+   platforms, see below.  Therefore we enable it by default only on native
+   Win32 platforms.  */
+#ifndef ENABLE_COSTLY_RELOCATABLE
+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+#  define ENABLE_COSTLY_RELOCATABLE 1
+# else
+#  define ENABLE_COSTLY_RELOCATABLE 0
+# endif
+#endif
+
 /* Original installation prefix.  */
 static char *orig_prefix;
 static size_t orig_prefix_len;
@@ -154,7 +167,7 @@ set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg)
 #endif
 }
 
-#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
 
 /* Convenience function:
    Computes the current installation prefix, based on the original
@@ -284,7 +297,7 @@ compute_curr_prefix (const char *orig_installprefix,
 
 #endif /* !IN_LIBRARY || PIC */
 
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
 
 /* Full pathname of shared library, or NULL.  */
 static char *shared_library_fullname;
@@ -330,7 +343,9 @@ find_shared_library_fullname ()
 #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
      function.
-     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
+     Cygwin 1.7.  */
   FILE *fp;
 
   /* Open the current process' maps file.  It describes one VMA per line.  */
@@ -403,7 +418,7 @@ get_shared_library_fullname ()
 const char *
 relocate (const char *pathname)
 {
-#if defined PIC && defined INSTALLDIR
+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
   static int initialized;
 
   /* Initialization code for a shared library.  */

[-- Attachment #5: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2011-10-16 18:42 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 10:18 Voelker, Bernhard
2011-08-30 11:28 ` Charles Wilson
2011-09-08  2:31 ` Charles Wilson
2011-09-08 10:46   ` Bruno Haible
2011-09-08 10:55     ` Voelker, Bernhard
2011-09-08 11:06     ` Eric Blake
2011-09-08 12:05     ` Charles Wilson
2011-09-08 12:48       ` Andy Koppe
2011-09-08 13:13         ` Eric Blake
2011-09-08 12:51       ` Andy Koppe
2011-09-08 21:58         ` Bruno Haible
     [not found]       ` <201109082344.55506.bruno@clisp.org>
2011-09-09  9:18         ` Charles Wilson
2011-09-09 12:33           ` Andy Koppe
2011-09-09 15:00             ` Corinna Vinschen
2011-09-10 11:36               ` Thorsten Kampe
2011-09-13 18:39               ` Eric Blake
2011-09-17 21:50                 ` David Sastre
2011-09-17 22:50                   ` Ken Brown
2011-09-18  3:19                     ` David Sastre
2011-10-04 12:29                 ` Corinna Vinschen
2011-10-04 12:46                   ` Charles Wilson
2011-10-04 14:30                     ` Corinna Vinschen
2011-10-04 18:04                       ` Erwin Waterlander
2011-10-04 18:21                         ` Corinna Vinschen
2011-10-05 16:04                           ` Erwin Waterlander
2011-10-05 16:28                             ` Corinna Vinschen
2011-10-05 16:52                               ` Erwin Waterlander
2011-10-05 17:32                               ` Charles Wilson
2011-10-05 18:24                                 ` Ken Brown
2011-10-05 18:29                                   ` Corinna Vinschen
2011-10-05 18:44                                   ` Erwin Waterlander
2011-10-05 18:50                                   ` Yaakov (Cygwin/X)
2011-10-05 18:58                                     ` Christopher Faylor
2011-10-10 17:24                                   ` Corinna Vinschen
2011-10-11 15:41                                     ` Erwin Waterlander
2011-10-11 16:54                                     ` Charles Wilson
2011-10-11 17:29                                       ` Christopher Faylor
2011-10-16 18:42                                       ` Charles Wilson [this message]
2011-10-17  6:59                                         ` Corinna Vinschen
2011-10-17 13:17                                           ` Charles Wilson
2011-10-17 13:52                                             ` Corinna Vinschen
2011-10-17 13:58                                               ` Corinna Vinschen
2011-10-05 18:29                                 ` Corinna Vinschen
2011-10-06  1:35                       ` [OT] " Andrey Repin
2011-10-05 12:08                     ` Ken Brown
2011-09-09 15:13             ` Charles Wilson
2011-09-09 20:08               ` Andy Koppe
2011-09-08 13:45     ` Corinna Vinschen
2011-09-08 13:51     ` Corinna Vinschen
2011-09-08 20:57       ` Bruno Haible
2011-09-09 15:09         ` Corinna Vinschen
2011-09-09 15:58           ` Andy Koppe
2011-09-10 11:45           ` Thorsten Kampe
2011-09-10 13:50             ` Christopher Faylor
2011-09-10 16:10               ` Thorsten Kampe
2011-09-10 17:11                 ` Christopher Faylor
2011-08-31  8:39 Voelker, Bernhard
2011-08-31 14:01 ` Charles Wilson
2011-08-31 15:19   ` Charles Wilson
2011-09-01  5:30 Voelker, Bernhard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9B2585.1000409@cwilson.fastmail.fm \
    --to=cygwin@cwilson.fastmail.fm \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).