Bug 1307234 - strfmon_l does not group digits.
strfmon_l does not group digits.
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Florian Weimer
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 1307241
  Show dependency treegraph
 
Reported: 2016-02-13 07:40 EST by Van de Bugger
Modified: 2016-05-15 00:54 EDT (History)
9 users (show)

See Also:
Fixed In Version: glibc-2.22-15.fc23, glibc-2.23.1-7.fc24
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1307241 (view as bug list)
Environment:
Last Closed: 2016-05-15 00:54:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 19633 None None None 2016-02-13 08:14 EST

  None (edit)
Description Van de Bugger 2016-02-13 07:40:18 EST
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 07:55:00 EST
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 07:55 EST
Created attachment 1123775 [details]
Another test program.
Comment 3 Florian Weimer 2016-02-13 08:09:53 EST
(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 13:20:17 EDT
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 12:25:51 EDT
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 06:03:22 EDT
New 2.23 backport:

commit 90c0f166e9fd6b2c7685437558cf7e8f8bc6876a
Author: Florian Weimer <fweimer@redhat.com>
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 10:56:08 EDT
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 13:57:58 EDT
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 16:29:49 EDT
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 09:54:22 EDT
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 05:43:43 EDT
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 19:29:40 EDT
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.