bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: locale-related printf bug when using formats with thousands grouping


From: Bruno Haible
Subject: Re: locale-related printf bug when using formats with thousands grouping character
Date: Wed, 12 Jan 2011 23:19:22 +0100
User-agent: KMail/1.9.9

The bug affects not only %f but also %g, and it can lead to a SIGSEGV.

Reproduce with the bash 3.2.1 built-in:

$ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.5g\\\\n\" 999.996"
1000
$ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.4g\\\\n\" 9999.996"
Segmentation fault
$ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.5g\\\\n\" 99999.996"
Segmentation fault
$ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.6g\\\\n\" 999999.996"
Segmentation fault
$ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.7g\\\\n\" 9999999.996"
Segmentation fault

or with the printf program from coreutils 8.4:

$ env LC_ALL=en_US.UTF-8 printf "%'.5g\\n" 999.996
1000
$ env LC_ALL=en_US.UTF-8 printf "%'.4g\\n" 9999.996
Segmentation fault
$ env LC_ALL=en_US.UTF-8 printf "%'.5g\\n" 99999.996
Segmentation fault
$ env LC_ALL=en_US.UTF-8 printf "%'.6g\\n" 999999.996
Segmentation fault
$ env LC_ALL=en_US.UTF-8 printf "%'.7g\\n" 9999999.996
Segmentation fault

I've added a second test program to your bug report at
<http://sourceware.org/bugzilla/show_bug.cgi?id=12394>.

Bruno

Attachment: bug12394.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]