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

2011-01-13 Thread Jim Meyering
Bruno Haible wrote: > 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: ... > 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" 99

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

2011-01-13 Thread Jim Meyering
Bruno Haible wrote: > 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 \"%'.5gn\" 999.996" > 1000 > $ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.4gn\" .996" > Segmentation fault > $ L

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

2011-01-12 Thread Bruno Haible
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 \"%'.5gn\" 999.996" 1000 $ LC_ALL=en_US.UTF-8 bash -c "printf \"%'.4gn\" .996" Segmentation fault $ LC_ALL=en_US.UTF-8 bash -c "printf \"

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

2011-01-12 Thread Andrew J. Schorr
Thanks for the confirmation. I opened a glibc bug on this. http://sourceware.org/bugzilla/show_bug.cgi?id=12394 Here is some sample code to demonstrate the problem (attached to the bug report): #include #include int main(void) { double x; setlocale(LC_NUMERIC, ""); while (scanf("%l

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

2011-01-12 Thread Jim Meyering
Eric Blake wrote: > [adding bug-gnulib] > > On 01/11/2011 08:40 PM, Andrew J. Schorr wrote: >> On Tue, Jan 11, 2011 at 10:31:26PM -0500, Andrew J. Schorr wrote: >>> Using gawk 3.1.8 on Fedora 13 64-bit linux, I see this: >>> >>> bash-4.1$ (echo 100; echo 99.9998071828) | gawk -v "sq='" >>>

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

2011-01-12 Thread Eric Blake
[adding bug-gnulib] On 01/11/2011 08:40 PM, Andrew J. Schorr wrote: > On Tue, Jan 11, 2011 at 10:31:26PM -0500, Andrew J. Schorr wrote: >> Using gawk 3.1.8 on Fedora 13 64-bit linux, I see this: >> >> bash-4.1$ (echo 100; echo 99.9998071828) | gawk -v "sq='" '{printf >> "%" sq ".2f\n", $1