This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: mon_grouping bug
- From: Gerhard Tonn <GerhardTonn at gammatau dot de>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 14 Mar 2003 18:56:40 +0100
- Subject: Re: mon_grouping bug
- References: <03031417175200.00765@tau> <jefzppgaja.fsf@sykes.suse.de>
On Friday 14 March 2003 17:47, you wrote:
> Gerhard Tonn <GerhardTonn at gammatau dot de> writes:
> |> Hi,
> |>
> |> running the LSB 1.3 testsuite on a platform that has unsigned char as
> |> default, gives a failure during the localisation tests. The mon_grouping
> |> parameter of the LOCALE being tested is defined as 1;2;-1. After
> |> installation of the LOCALE the command 'locale -k mon_grouping' returns
> |> mon_grouping=1;2;127.
> |>
> |> This seems to be a bug in the glibc. The following code fragment in
> |> ld-monetary.c maps the '-1' to 127 which is the value of SCHAR_MAX which
> |> is equal to CHAR_MAX, if char is signed per default.
> |>
> |> if (now->tok == tok_minus1)
> |> {
> |> if (!ignore_content)
> |> grouping[act++] = '\177';
> |> }
> |>
> |> The following code fragment in locale.c prints '-1' only if the value
> |> equals CHAR_MAX which is not true on platforms that have unsigned char
> |> as default.
> |>
> |> printf ("%d", *val == CHAR_MAX ? -1 : *val);
>
> IMHO the right fix is to change CHAR_MAX to '\177' since that's what's
> actually being stored.
>
The description of the grouping and mon_grouping members says
"An element value of CHAR_MAX ends any further grouping (and hence ends the
string)".
The best solution would probably be the substitution of '\177' by CHAR_MAX in
ld-monetary, but I am not sure what the implications are. Therefore I decided
not to change any running code but only to add a code path.
Gerhard