bug-guile
[Top][All Lists]
Advanced

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

Re: i18n test fail, guile-2.0.0


From: Ludovic Courtès
Subject: Re: i18n test fail, guile-2.0.0
Date: Thu, 24 Feb 2011 15:48:43 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Hi,

Bruno Haible <address@hidden> writes:

> Ludovic Courtès wrote:
>> >    263:19  1 (%number-integer-part "123456" (-1 -1 -1 -1 -1 -1 . #) "")
>> 
>> That’s the problem: the locale contains erroneous digit grouping
>> information.  It should be a circular list of ‘3’, like this:
>
> You may be misunderstanding the glibc format of the grouping information
> returned by the nl_langinfo function. As you can see
>   - from glibc/stdio-common/printf_fp.c, function __guess_grouping,
>   - from glibc/stdio-common/vfprintf.c, function group_number,
> when the first value in the array is zero or negative or 127, it means
> "no grouping should be done".

David: can you try this patch?

diff --git a/libguile/i18n.c b/libguile/i18n.c
index 14dc9b9..c51df4a 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -1564,11 +1564,14 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
          {
            char *p;
 
-           /* In this cases, the result is to be interpreted as a list of
-              numbers.  If the last item is `CHARS_MAX', it has the special
-              meaning "no more grouping".  */
+           /* In this cases, the result is to be interpreted as a list
+              of numbers.  If the last item is `CHAR_MAX' or a negative
+              number, it has the special meaning "no more grouping"
+              (negative numbers aren't specified in POSIX but can be
+              used by glibc; see
+              
<http://lists.gnu.org/archive/html/bug-guile/2011-02/msg00159.html>).  */
            result = SCM_EOL;
-           for (p = c_result; (*p != '\0') && (*p != CHAR_MAX); p++)
+           for (p = c_result; (*p > 0) && (*p != CHAR_MAX); p++)
              result = scm_cons (SCM_I_MAKINUM ((int) *p), result);
 
            {
@@ -1576,7 +1579,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
 
              result = scm_reverse_x (result, SCM_EOL);
 
-             if (*p != CHAR_MAX)
+             if (*p == 0)
                {
                  /* Cyclic grouping information.  */
                  if (last_pair != SCM_EOL)
The i18n.test tests that used to raise an error should now fail (because
glibc provides invalid locale data anyway.)

Thanks,
Ludo’.

reply via email to

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