GNU bug report logs - #7829
locale-related printf bug when using formats with thousands grouping character

Previous Next

Package: coreutils;

Reported by: Eric Blake <eblake <at> redhat.com>

Date: Wed, 12 Jan 2011 13:51:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7829 in the body.
You can then email your comments to 7829 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7829; Package coreutils. (Wed, 12 Jan 2011 13:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eric Blake <eblake <at> redhat.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 12 Jan 2011 13:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: bug-coreutils <bug-coreutils <at> gnu.org>
Subject: Re: locale-related printf bug when using formats with thousands
	grouping character
Date: Wed, 12 Jan 2011 06:58:19 -0700
[Message part 1 (text/plain, inline)]
[redirecting to bug-coreutils]

On 01/12/2011 06:52 AM, Eric Blake wrote:
>> bash-4.1$ printf "%'.2f\n" 999999.9998071828
>> ,000,000.00
>>
> It appears that glibc fails to account for the fact that rounding may
> increase the number of result characters by 2 instead of 1 when %' is in
> effect (going from 999 to 1,000, at any power of 10*3).
> 
> Please file a glibc bug, and in the meantime, gnulib should consider
> modifying the printf-posix family of modules to work around this
> rounding bug.

Ouch - coreutils' printf is also affected:

$ /usr/bin/printf %\'.2f\\n 999.9998 999999.9998 1000000
1000.00
,000,000.00
1,000,000.00

At least printf(1) already uses the xprintf-posix module, so hopefully
this gets fixed once gnulib works around the glibc bug.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#7829; Package coreutils. (Fri, 19 Oct 2018 01:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 7829 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 7829 <at> debbugs.gnu.org
Subject: Re: bug#7829: locale-related printf bug when using formats with
 thousands grouping character
Date: Thu, 18 Oct 2018 19:51:24 -0600
tags 7829 fixed
close 7829
stop

(triaging old bugs)

On 12/01/11 06:58 AM, Eric Blake wrote:
> Ouch - coreutils' printf is also affected:
> 
> $ /usr/bin/printf %\'.2f\\n 999.9998 999999.9998 1000000
> 1000.00
> ,000,000.00
> 1,000,000.00
> 
> At least printf(1) already uses the xprintf-posix module, so hopefully
> this gets fixed once gnulib works around the glibc bug.

I just verified this works fine with recent coreutils version, so closing.

-assaf





Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 01:52:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 7829 <at> debbugs.gnu.org and Eric Blake <eblake <at> redhat.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 01:52:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 16 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.