public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
* [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit
@ 2011-01-12 17:40 ajschorr at alumni dot princeton.edu
  2011-01-12 17:40 ` [Bug localedata/12394] " ajschorr at alumni dot princeton.edu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ajschorr at alumni dot princeton.edu @ 2011-01-12 17:40 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=12394

           Summary: thousands grouping bug when rounding requires an extra
                    leading digit
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: localedata
        AssignedTo: libc-locales@sources.redhat.com
        ReportedBy: ajschorr@alumni.princeton.edu


Created attachment 5191
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5191
C code to demonstrate the bug

The attached program printthou.c gives buggy results:

bash-4.1$ echo 999.999 999999.999 | printthou
1000.00
,000,000.00

The program is using printf with the format "%'.2f".  As you can
see, those inputs expose bugs in the logic.

These inputs give the expected results:

bash-4.1$ echo 1000 1000000 | printthou
1,000.00
1,000,000.00

Regards,
Andy

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug localedata/12394] thousands grouping bug when rounding requires an extra leading digit
  2011-01-12 17:40 [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit ajschorr at alumni dot princeton.edu
@ 2011-01-12 17:40 ` ajschorr at alumni dot princeton.edu
  2011-01-12 17:41 ` eblake at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ajschorr at alumni dot princeton.edu @ 2011-01-12 17:40 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=12394

--- Comment #1 from Andrew J. Schorr <ajschorr at alumni dot princeton.edu> 2011-01-12 16:17:45 UTC ---
Oops, I should mention that I see the problem with LC_NUMERIC="en_US.UTF-8".
It works fine in C locale:

bash-4.1$ echo 999.999 999999.999 | LC_NUMERIC=C printthou
1000.00
1000000.00
bash-4.1$ echo 999.999 999999.999 | LC_NUMERIC=en_US.UTF-8 printthou
1000.00
,000,000.00

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug localedata/12394] thousands grouping bug when rounding requires an extra leading digit
  2011-01-12 17:40 [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit ajschorr at alumni dot princeton.edu
  2011-01-12 17:40 ` [Bug localedata/12394] " ajschorr at alumni dot princeton.edu
@ 2011-01-12 17:41 ` eblake at redhat dot com
  2011-01-12 22:18 ` bruno at clisp dot org
  2011-01-12 22:19 ` [Bug libc/12394] " bruno at clisp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: eblake at redhat dot com @ 2011-01-12 17:41 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=12394

Eric Blake <eblake at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eblake at redhat dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug localedata/12394] thousands grouping bug when rounding requires an extra leading digit
  2011-01-12 17:40 [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit ajschorr at alumni dot princeton.edu
  2011-01-12 17:40 ` [Bug localedata/12394] " ajschorr at alumni dot princeton.edu
  2011-01-12 17:41 ` eblake at redhat dot com
@ 2011-01-12 22:18 ` bruno at clisp dot org
  2011-01-12 22:19 ` [Bug libc/12394] " bruno at clisp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2011-01-12 22:18 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=12394

--- Comment #2 from Bruno Haible <bruno at clisp dot org> 2011-01-12 22:14:31 UTC ---
Created attachment 5192
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5192
test case for the bugs with %f and %g

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/12394] thousands grouping bug when rounding requires an extra leading digit
  2011-01-12 17:40 [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit ajschorr at alumni dot princeton.edu
                   ` (2 preceding siblings ...)
  2011-01-12 22:18 ` bruno at clisp dot org
@ 2011-01-12 22:19 ` bruno at clisp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2011-01-12 22:19 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=12394

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bruno at clisp dot org
          Component|localedata                  |libc
         AssignedTo|libc-locales at sources dot |drepper.fsp at gmail dot
                   |redhat.com                  |com

--- Comment #3 from Bruno Haible <bruno at clisp dot org> 2011-01-12 22:16:47 UTC ---
The bug affects not only the %f directive, but also the %g directive,
and can lead to a segmentation fault in the latter case.

Find attached the test case. How to reproduce:
$ gcc -Wall bug12394.c
$ ./a.out 
Segmentation fault (core dumped)
$ gdb a.out core
(gdb) where
#0  0x00007f70364aeaa4 in __printf_fp () from /lib64/libc.so.6
#1  0x00007f70364a9b4d in vfprintf () from /lib64/libc.so.6
#2  0x00007f70364cbee9 in vsprintf () from /lib64/libc.so.6
#3  0x00007f70364b2118 in sprintf () from /lib64/libc.so.6
#4  0x0000000000400819 in main ()

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-12 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 17:40 [Bug localedata/12394] New: thousands grouping bug when rounding requires an extra leading digit ajschorr at alumni dot princeton.edu
2011-01-12 17:40 ` [Bug localedata/12394] " ajschorr at alumni dot princeton.edu
2011-01-12 17:41 ` eblake at redhat dot com
2011-01-12 22:18 ` bruno at clisp dot org
2011-01-12 22:19 ` [Bug libc/12394] " bruno at clisp dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).