Opened 14 months ago

Closed 13 months ago

Last modified 13 months ago

#18345 closed bug (fixed)

duplocale does not work on a mixed locale

Reported by: bhaible Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: System/POSIX Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Using duplocale and then uselocale does not produce the expected results, when the locale was constructed by several setlocale calls, each affecting different categories, and duplocale is used with argument LC_GLOBAL_LOCALE. This should be supported, since POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/duplocale.html> says: "If the locobj argument is LC_GLOBAL_LOCALE, duplocale() shall create a new locale object containing a copy of the global locale determined by the setlocale() function."

The test case is attached. It is known to work fine on glibc, FreeBSD, OpenBSD, Solaris 11.4, Cygwin 2.9.0. On Haiku:

$ gcc -ggdb -Wall test-duplocale.c
$ ./a.out
monetary value:
  Expected: $123.75
  Actual:   123.75
numeric value:
  Expected: 3,5
  Actual:   3.5
time value:
  Expected: janvier
  Actual:   January

Attachments (1)

test-duplocale.c (3.9 KB ) - added by bhaible 14 months ago.
test case

Download all attachments as: .zip

Change History (4)

by bhaible, 14 months ago

Attachment: test-duplocale.c added

test case

comment:1 by jessicah, 13 months ago

Resolution: fixed
Status: newclosed

Fixed in hrev56932.

comment:2 by pulkomandy, 13 months ago

Milestone: UnscheduledR1/beta5

Should this fix be backported to the r1beta4 branch as well?

in reply to:  2 comment:3 by jessicah, 13 months ago

Yes, it's probably a good candidate for backporting.

Note: See TracTickets for help on using tickets.