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.