public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug locale/28847] New: Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc
@ 2022-02-01 16:11 carlos at redhat dot com
  2022-02-01 17:09 ` [Bug locale/28847] " carlos at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: carlos at redhat dot com @ 2022-02-01 16:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28847

            Bug ID: 28847
           Summary: Empty mon_decimal_point in LC_MONETARY results in
                    non-empty mon_decimal_point_wc
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: carlos at redhat dot com
  Target Milestone: ---

A locale that species an LC_MONETARY with an empty string e.g. "" for
mon_decimal_point will be correctly compiled, but the mon_decimal_point_wc will
be set to a default value of "." that doesn't match the source locale.

The defect is in ld-monetary.c where we unconditionally set
mon_decimal_point_wc if the value is L'\0' which is always the case for an
empty string mon_decimal_point. The solution is to set both mon_decimal_point
and mon_decimal_point_wc at the same time to the expected defaults.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug locale/28847] Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc
  2022-02-01 16:11 [Bug locale/28847] New: Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc carlos at redhat dot com
@ 2022-02-01 17:09 ` carlos at redhat dot com
  2022-02-04  9:35 ` xry111 at mengyan1223 dot wang
  2022-02-04  9:37 ` xry111 at mengyan1223 dot wang
  2 siblings, 0 replies; 4+ messages in thread
From: carlos at redhat dot com @ 2022-02-01 17:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28847

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.35
         Resolution|---                         |FIXED

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
Fixed in glibc 2.35.

commit 1d8e3a2c6636cf0b1b8fa2f869cef6ec10726933
Author: Carlos O'Donell <carlos@redhat.com>
Date:   Mon Jan 31 00:34:41 2022 -0500

    localedef: Fix handling of empty mon_decimal_point (Bug 28847)

    The handling of mon_decimal_point is incorrect when it comes to
    handling the empty "" value.  The existing parser in monetary_read()
    will correctly handle setting the non-wide-character value and the
    wide-character value e.g. STR_ELEM_WC(mon_decimal_point) if they are
    set in the locale definition.  However, in monetary_finish() we have
    conflicting TEST_ELEM() which sets a default value (if the locale
    definition doesn't include one), and subsequent code which looks for
    mon_decimal_point to be NULL to issue a specific error message and set
    the defaults. The latter is unused because TEST_ELEM() always sets a
    default.  The simplest solution is to remove the TEST_ELEM() check,
    and allow the existing check to look to see if mon_decimal_point is
    NULL and set an appropriate default.  The final fix is to move the
    setting of mon_decimal_point_wc so it occurs only when
    mon_decimal_point is being set to a default, keeping both values
    consistent. There is no way to tell the difference between
    mon_decimal_point_wc having been set to the empty string and not
    having been defined at all, for that distinction we must use
    mon_decimal_point being NULL or "", and so we must logically set
    the default together with mon_decimal_point.

    Lastly, there are more fixes similar to this that could be made to
    ld-monetary.c, but we avoid that in order to fix just the code
    required for mon_decimal_point, which impacts the ability for C.UTF-8
    to set mon_decimal_point to "", since without this fix we end up with
    an inconsistent setting of mon_decimal_point set to "", but
    mon_decimal_point_wc set to "." which is incorrect.

    Tested on x86_64 and i686 without regression.
    Reviewed-by: Florian Weimer <fweimer@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug locale/28847] Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc
  2022-02-01 16:11 [Bug locale/28847] New: Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc carlos at redhat dot com
  2022-02-01 17:09 ` [Bug locale/28847] " carlos at redhat dot com
@ 2022-02-04  9:35 ` xry111 at mengyan1223 dot wang
  2022-02-04  9:37 ` xry111 at mengyan1223 dot wang
  2 siblings, 0 replies; 4+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-02-04  9:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28847

Xi Ruoyao <xry111 at mengyan1223 dot wang> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xry111 at mengyan1223 dot wang

--- Comment #2 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Carlos O'Donell from comment #1)
> Fixed in glibc 2.35.
> 
> commit 1d8e3a2c6636cf0b1b8fa2f869cef6ec10726933
> Author: Carlos O'Donell <carlos@redhat.com>
> Date:   Mon Jan 31 00:34:41 2022 -0500
> 
>     localedef: Fix handling of empty mon_decimal_point (Bug 28847)

This commit is in master, but not releases/2.35/master.  So I think you meant
"fixed in glibc 2.36"?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug locale/28847] Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc
  2022-02-01 16:11 [Bug locale/28847] New: Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc carlos at redhat dot com
  2022-02-01 17:09 ` [Bug locale/28847] " carlos at redhat dot com
  2022-02-04  9:35 ` xry111 at mengyan1223 dot wang
@ 2022-02-04  9:37 ` xry111 at mengyan1223 dot wang
  2 siblings, 0 replies; 4+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-02-04  9:37 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28847

--- Comment #3 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Xi Ruoyao from comment #2)
> (In reply to Carlos O'Donell from comment #1)
> > Fixed in glibc 2.35.
> > 
> > commit 1d8e3a2c6636cf0b1b8fa2f869cef6ec10726933
> > Author: Carlos O'Donell <carlos@redhat.com>
> > Date:   Mon Jan 31 00:34:41 2022 -0500
> > 
> >     localedef: Fix handling of empty mon_decimal_point (Bug 28847)
> 
> This commit is in master, but not releases/2.35/master.  So I think you
> meant "fixed in glibc 2.36"?

Sorry, I misunderstood that this was for 28845.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-04  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 16:11 [Bug locale/28847] New: Empty mon_decimal_point in LC_MONETARY results in non-empty mon_decimal_point_wc carlos at redhat dot com
2022-02-01 17:09 ` [Bug locale/28847] " carlos at redhat dot com
2022-02-04  9:35 ` xry111 at mengyan1223 dot wang
2022-02-04  9:37 ` xry111 at mengyan1223 dot wang

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).