guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-52-g5de005


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-52-g5de0053
Date: Fri, 17 Feb 2012 23:04:31 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=5de0053178b4acc793ae62838175e5f3ab56c603

The branch, stable-2.0 has been updated
       via  5de0053178b4acc793ae62838175e5f3ab56c603 (commit)
      from  cac24946da089e1e1fddf9c9dc7ae7dae9e29014 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5de0053178b4acc793ae62838175e5f3ab56c603
Author: Ludovic Courtès <address@hidden>
Date:   Sat Feb 18 00:04:17 2012 +0100

    Don't fail when locale env. vars specify a dot-less locale name.
    
    Fixes <http://bugs.gnu.org/10742>.
    Reported by Alírio Eyng <address@hidden>.
    
    * gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change
      to set CODESET to "" when LOCALE lacks a dot.  Return "ISO-8859-1"
      when CODESET is the empty string.
    
    * lib/localcharset.c: Update.
    
    * test-suite/standalone/Makefile.am (check_SCRIPTS): Add
      `test-command-line-encoding2'.
      (TESTS): Likewise.
    
    * test-suite/standalone/test-command-line-encoding2: New file.

-----------------------------------------------------------------------

Summary of changes:
 gnulib-local/lib/localcharset.c.diff              |   51 ++++++++++-----------
 lib/localcharset.c                                |    8 ++--
 test-suite/standalone/Makefile.am                 |    5 ++-
 test-suite/standalone/test-command-line-encoding2 |   20 ++++++++
 4 files changed, 52 insertions(+), 32 deletions(-)
 create mode 100755 test-suite/standalone/test-command-line-encoding2

diff --git a/gnulib-local/lib/localcharset.c.diff 
b/gnulib-local/lib/localcharset.c.diff
index 2b27ee4..6f216ad 100644
--- a/gnulib-local/lib/localcharset.c.diff
+++ b/gnulib-local/lib/localcharset.c.diff
@@ -5,28 +5,10 @@ rationale.
 
 --- a/lib/localcharset.c       2011-12-14 23:10:58.000000000 +0100
 +++ b/lib/localcharset.c       2011-12-15 00:45:12.000000000 +0100
-@@ -527,6 +527,76 @@ locale_charset (void)
-     codeset = "";
+@@ -545,3 +545,74 @@ locale_charset (void)
  
-   /* Resolve alias. */
-+  for (aliases = get_charset_aliases ();
-+       *aliases != '\0';
-+       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
-+    if (strcmp (codeset, aliases) == 0
-+        || (aliases[0] == '*' && aliases[1] == '\0'))
-+      {
-+        codeset = aliases + strlen (aliases) + 1;
-+        break;
-+      }
-+
-+  /* Don't return an empty string.  GNU libc and GNU libiconv interpret
-+     the empty string as denoting "the locale's character encoding",
-+     thus GNU libiconv would call this function a second time.  */
-+  if (codeset[0] == '\0')
-+    codeset = "ASCII";
-+
-+  return codeset;
-+}
+   return codeset;
+ }
 +
 +/* A variant of the above, without calls to `setlocale', `nl_langinfo',
 +   etc.  */
@@ -71,14 +53,29 @@ rationale.
 +        strcpy (buf, "ASCII");
 +        return buf;
 +      }
-+
-+      /* Resolve through the charset.alias file.  */
-+      codeset = locale;
++      else
++      codeset = "";
 +    }
 +  else
 +    codeset = "";
 +
 +  /* Resolve alias. */
-   for (aliases = get_charset_aliases ();
-        *aliases != '\0';
-        aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
++  for (aliases = get_charset_aliases ();
++       *aliases != '\0';
++       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
++    if (strcmp (codeset, aliases) == 0
++        || (aliases[0] == '*' && aliases[1] == '\0'))
++      {
++        codeset = aliases + strlen (aliases) + 1;
++        break;
++      }
++
++  /* Don't return an empty string.  GNU libc and GNU libiconv interpret
++     the empty string as denoting "the locale's character encoding",
++     thus GNU libiconv would call this function a second time.  */
++  if (codeset[0] == '\0')
++    /* Default to Latin-1, for backward compatibility with Guile 1.8.  */
++    codeset = "ISO-8859-1";
++
++  return codeset;
++}
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 47a6e5d..2c06328 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -589,9 +589,8 @@ environ_locale_charset (void)
          strcpy (buf, "ASCII");
          return buf;
        }
-
-      /* Resolve through the charset.alias file.  */
-      codeset = locale;
+      else
+       codeset = "";
     }
   else
     codeset = "";
@@ -611,7 +610,8 @@ environ_locale_charset (void)
      the empty string as denoting "the locale's character encoding",
      thus GNU libiconv would call this function a second time.  */
   if (codeset[0] == '\0')
-    codeset = "ASCII";
+    /* Default to Latin-1, for backward compatibility with Guile 1.8.  */
+    codeset = "ISO-8859-1";
 
   return codeset;
 }
diff --git a/test-suite/standalone/Makefile.am 
b/test-suite/standalone/Makefile.am
index d8cfafa..daa3d07 100644
--- a/test-suite/standalone/Makefile.am
+++ b/test-suite/standalone/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in.
 ##
 ## Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-##   2011 Free Software Foundation, Inc.
+##   2011, 2012 Free Software Foundation, Inc.
 ##
 ## This file is part of GUILE.
 ##
@@ -85,6 +85,9 @@ EXTRA_DIST += test-import-order-a.scm test-import-order-b.scm 
\
 check_SCRIPTS += test-command-line-encoding
 TESTS += test-command-line-encoding
 
+check_SCRIPTS += test-command-line-encoding2
+TESTS += test-command-line-encoding2
+
 # test-num2integral
 test_num2integral_SOURCES = test-num2integral.c
 test_num2integral_CFLAGS = ${test_cflags}
diff --git a/test-suite/standalone/test-command-line-encoding2 
b/test-suite/standalone/test-command-line-encoding2
new file mode 100755
index 0000000..536945b
--- /dev/null
+++ b/test-suite/standalone/test-command-line-encoding2
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Choose a locale name that lacks a dot followed by the encoding name.
+# This should not confuse `environ_locale_charset'.
+# See <http://bugs.gnu.org/10742> for the original bug report.
+LC_ALL="en_US"
+export LC_ALL
+unset LANG
+unset LC_CTYPE
+
+exec guile -q -s "$0" "hello"
+!#
+
+;; Make sure our argument was suitable decoded.
+(exit (string=? (cadr (program-arguments)) "hello"))
+
+;; Local Variables:
+;; mode: scheme
+;; coding: iso-8859-1
+;; End:


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]