glibc/locale/programs
Carlos O'Donell 1d8e3a2c66 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>
2022-02-01 11:12:17 -05:00
..
3level.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
charmap-dir.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
charmap-dir.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
charmap-kw.gperf Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
charmap-kw.h Update automatically-generated copyright dates 2022-01-01 11:42:26 -08:00
charmap.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
charmap.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
config.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-address.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-collate.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-ctype.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-identification.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-measurement.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-messages.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-monetary.c localedef: Fix handling of empty mon_decimal_point (Bug 28847) 2022-02-01 11:12:17 -05:00
ld-name.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-numeric.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-paper.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-telephone.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ld-time.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
linereader.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
linereader.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locale-spec.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locale.c Update copyright dates not handled by scripts/update-copyrights. 2022-01-01 11:42:26 -08:00
localedef.c Update copyright dates not handled by scripts/update-copyrights. 2022-01-01 11:42:26 -08:00
localedef.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locarchive.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locfile-kw.gperf Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locfile-kw.h Update automatically-generated copyright dates 2022-01-01 11:42:26 -08:00
locfile-token.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locfile.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
locfile.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
record-status.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
record-status.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
repertoire.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
repertoire.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
simple-hash.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
simple-hash.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
xasprintf.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
xmalloc.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
xstrdup.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00