Re: small fix for lib/sh/snprintf.c

2012-04-16 Thread Petr Sumbera
I have found one more problem: I'm getting following: bash -c 'printf "x%+fx\n" -0' x+0.00x where it should be: x-0.00x This is cause by: /* round off to the precision */ #define ROUND(d, p) \ (d < 0.) ? \ d - pow_10(-(p)->precision) * 0.5 : \ d +

Re: small fix for lib/sh/snprintf.c

2012-04-15 Thread Chet Ramey
On 4/13/12 9:57 AM, Petr Sumbera wrote: > On 04/13/12 03:18 PM, Petr Sumbera wrote: > >> Problem 2: >> == >> >> bash -c 'printf "x%+010.0fx\n" 123' >> x00+123x >> >> where it should be: >> x+00123x >> >> Fixed in chunk #3 (but the problem is there also for other types!). > > My fi

Re: small fix for lib/sh/snprintf.c

2012-04-13 Thread Petr Sumbera
On 04/13/12 03:18 PM, Petr Sumbera wrote: Problem 2: == bash -c 'printf "x%+010.0fx\n" 123' x00+123x where it should be: x+00123x Fixed in chunk #3 (but the problem is there also for other types!). My fix breaks following case: bash -c 'printf "x%+10.0fx\n" 123' x+ 123

Re: small fix for lib/sh/snprintf.c

2012-04-13 Thread Petr Sumbera
Your change is ok for my original test case. But I have realized that there are several other problems. Please see attached new version of the patch. Problem 1: == bash -c 'printf "x%-010.0fx\n" 123' x123000x where it should be: x123 x Fixed in chunk #6. Problem 2: ===

Re: small fix for lib/sh/snprintf.c

2012-04-12 Thread Chet Ramey
On 4/12/12 12:25 PM, Petr Sumbera wrote: > Hi, > > we are running Bash 3.2.38 on Solaris 10 where asprintf() isn't available. > Thus code in snprintf.c is used. > > There is a problem with following command: > > bash -c 'printf "x%10.0fx\n" 123' > x000123x > > Where correct output should be

Re: small fix for lib/sh/snprintf.c

2012-04-12 Thread Joachim Schmitz
Petr Sumbera wrote: Hi, we are running Bash 3.2.38 on Solaris 10 where asprintf() isn't available. Thus code in snprintf.c is used. There is a problem with following command: bash -c 'printf "x%10.0fx\n" 123' x000123x Where correct output should be: x 123x It seems that '0' after '