Bug 1307234 - strfmon_l does not group digits.
Summary: strfmon_l does not group digits.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Florian Weimer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1307241
TreeView+ depends on / blocked
 
Reported: 2016-02-13 12:40 UTC by Van de Bugger
Modified: 2016-05-15 04:54 UTC (History)
9 users (show)

Fixed In Version: glibc-2.22-15.fc23, glibc-2.23.1-7.fc24
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1307241 (view as bug list)
Environment:
Last Closed: 2016-05-15 04:54:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Program shows the problem. (1.19 KB, text/plain)
2016-02-13 12:40 UTC, Van de Bugger
no flags Details
Another test program. (1.31 KB, text/plain)
2016-02-13 12:55 UTC, Van de Bugger
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Sourceware 19633 0 None None None 2016-02-13 13:14:37 UTC

Description Van de Bugger 2016-02-13 12:40:18 UTC
Created attachment 1123773 [details]
Program shows the problem.

Description of problem:

strfmon_l does not group digits.

Version-Release number of selected component (if applicable):

Fedora 23 x86_64
glibc-2.22-7.fc23.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Compile attached test program: 
   $ gcc -Wall strfmon_test.c
2. Make sure there is no LC_ environment variables.
3. Run test program: 
   $ LANG=en_US.UTF-8 ./a.out

Actual results:

Current locale not set:                 # 1
         strfmon: 1000000000.00         # 2
       strfmon_l: USD 1000000000.00     # 3 <<< NOTE THIS LINE.
Current locale set:                     # 4
         strfmon: USD 1,000,000,000.00  # 5
       strfmon_l: USD 1,000,000,000.00  # 6

Line #2: Current locale is not set, so "C" locale is in use. strfmon gives correct result for "C" locale. 
Line #3: It is incorrect result. "en_US" locale has only partial effect: international currency symbol is printed before the value. however, digits of value are NOT grouped, as expected.

Expected results:

Current locale not set:
         strfmon: 1000000000.00
       strfmon_l: USD 1,000,000,000.00
Current locale set:
         strfmon: USD 1,000,000,000.00
       strfmon_l: USD 1,000,000,000.00

Both lines started with strfmon_l are expected to be the same. 

Additional info:

This behavior is not specific for en_US.UTF-8 locale. It can be reproduced with fr_FR.UTF-8, ru_RU.UTF-8, etc.

Comment 1 Van de Bugger 2016-02-13 12:55:00 UTC
One more test:

Current locale set to fr_FR, but strfmon_l called with en_US locale. Result of strfmon_l:

    USD 1 000 000 000,00

Note: strfmon_l takes currency symbol (including it position before the value) from locale argument (en_US), while grouping symbol and decimal mark (space and comma respectively) are taken from current locale (fr_FR).

(See test source in attachment strfmon_test_2.c)

Comment 2 Van de Bugger 2016-02-13 12:55:50 UTC
Created attachment 1123775 [details]
Another test program.

Comment 3 Florian Weimer 2016-02-13 13:09:53 UTC
(In reply to Van de Bugger from comment #1)
> One more test:
> 
> Current locale set to fr_FR, but strfmon_l called with en_US locale. Result
> of strfmon_l:
> 
>     USD 1 000 000 000,00
> 
> Note: strfmon_l takes currency symbol (including it position before the
> value) from locale argument (en_US), while grouping symbol and decimal mark
> (space and comma respectively) are taken from current locale (fr_FR).

Yes, ___printf_fp always operates on the global locale object, and strfmon_l calls it internally to do the formatting.

Comment 4 Fedora Update System 2016-05-07 17:20:17 UTC
glibc-2.22-15.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-68abc0be35

Comment 5 Fedora Update System 2016-05-08 16:25:51 UTC
glibc-2.22-15.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-68abc0be35

Comment 6 Florian Weimer 2016-05-09 10:03:22 UTC
New 2.23 backport:

commit 90c0f166e9fd6b2c7685437558cf7e8f8bc6876a
Author: Florian Weimer <fweimer>
Date:   Mon Apr 4 15:18:13 2016 +0200

    strfmon_l: Use specified locale for number formatting [BZ #19633]
    
    (cherry picked from commit 985fc132f23dbb83de76c5af9e783ef1b5900148)

Comment 7 Fedora Update System 2016-05-09 14:56:08 UTC
glibc-2.23.1-6.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b321728d74

Comment 8 Fedora Update System 2016-05-10 17:57:58 UTC
glibc-2.22-15.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2016-05-10 20:29:49 UTC
glibc-2.23.1-6.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b321728d74

Comment 10 Fedora Update System 2016-05-11 13:54:22 UTC
glibc-2.23.1-7.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b321728d74

Comment 11 Fedora Update System 2016-05-12 09:43:43 UTC
glibc-2.23.1-7.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b321728d74

Comment 12 Fedora Update System 2016-05-14 23:29:40 UTC
glibc-2.23.1-7.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.