NetBSD-Bugs archive

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

lib/56967: Buggy implementation of strfmon()

>Number:         56967
>Category:       lib
>Synopsis:       Buggy implementation of strfmon()
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 17 03:00:00 +0000 2022
>Originator:     John Zaitseff
>Release:        9.3
The ZAP Group Australia
NetBSD 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022 amd64
The implementation of strfmon() on NetBSD is unfortunately very buggy when grouping characters are involved.  The implementation used in FreeBSD seems to be free of these problems.
Run the following on a NetBSD installation:

  $ wget -N
  $ cc -o strfmon strfmon.c

  $ ./strfmon 1234.56 en_US.UTF-8

The output on NetBSD is garbled:


The output on FreeBSD is correct:

  USD 1,234.56

Furthermore, non-ASCII characters for the grouping character cause additional problems (truncated UTF-8 strings):

  $ ./strfmon 1234,56 ru_RU.UTF-8

gives, on NetBSD:

  1�234,5�234,56 руб.
  1�234,5�234,56 RUB

whereas FreeBSD gives the correct output:

  1 234,56 ₽
  1 234,56 RUB 

Note also that the correct local currency symbol for ru_RU.UTF-8 is "₽", not "руб." -- a separate bug in the locale data.
If possible, copy the latest version of <monetary.h>, strfmon() and strfmon_l() from FreeBSD.

Home | Main Index | Thread Index | Old Index