[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf produces no output for %f directive
From: |
Jim Meyering |
Subject: |
Re: printf produces no output for %f directive |
Date: |
Fri, 19 Oct 2007 15:02:06 +0200 |
Pádraig Brady <address@hidden> wrote:
> Jim Meyering wrote:
>> Bruno Haible <address@hidden> wrote:
>>> But my libc's printf() returned -1, signalling failure. coreutils
>>> interpreted
>>> that as "was empty output, ok". I would have expected an error message and
>>> an
>>> exit status of 1.
>>
>> Strange indeed.
>> Could it be a bug in printf for failing, yet not setting the
>> stream-failure indicator that is checked by close_stdout's ferror?
>
> I would think the stream failure indicator would only be set
> on failures related to the actual output. A little googling
> also suggests that SUSv3 says that for *printf()
> possible reasons for failure which doesn't set the
> streams error indicator, are EILSEQ, EINVAL, and ENOMEM.
Thanks. You're right.
I reproduced it like this:
$ (ulimit -v 10000; /cu/src/printf %.10000000f 17 | wc -c)
0
So it's a bug in coreutils' printf.c program.
I'll fix that.
- POSIX requires checking all *printf return values?!?, (continued)
- Re: POSIX requires checking all *printf return values?!?, Andreas Schwab, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Eric Blake, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Jim Meyering, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Eric Blake, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Nick Stoughton, 2007/10/19
- Re: POSIX requires checking all *printf return values?!?, Bruce Korb, 2007/10/22
- Re: printf produces no output for %f directive, Pádraig Brady, 2007/10/19
- Re: printf produces no output for %f directive,
Jim Meyering <=