bug-coreutils
[Top][All Lists]
Advanced

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

Re: printf produces no output for %f directive


From: Bruno Haible
Subject: Re: printf produces no output for %f directive
Date: Fri, 19 Oct 2007 13:45:07 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote:
> On both fedora rawhide- and debian-unstable-based systems,
> with coreutils-6.9 and the latest sources, I get this:
> 
>   $ ./printf %.100000000f 17 |wc -c
>   100000003
> 
> maybe your libc is responsible?

Here are more details:

$ ltrace /packages/gnu/bin/printf %.100000000f 17
__libc_start_main(0x0804a000, 3, 0xbfffe6e4, 0x0804bd20, 0x0804bd80 <unfinished 
...>
setlocale(6, "")                                  = 
"LC_CTYPE=de_DE.UTF-8;LC_NUMERIC="...
bindtextdomain("coreutils", "/packages/gnu/share/locale") = 
"/packages/gnu/share/locale"
textdomain("coreutils")                           = "coreutils"
__cxa_atexit(0x0804a530, 0, 0, 3, 0xbfffe698)     = 0
getenv("POSIXLY_CORRECT")                         = NULL
memset(0xbfffe550, '\000', 256)                   = 0xbfffe550
malloc(14)                                        = 0x0804efa0
__mempcpy(0x0804efa0, 0xbfffe93b, 11, 0x4000bd88, 0x400196f4) = 0x0804efab
__mempcpy(0x0804efab, 0x0804c8fc, 1, 0x4000bd88, 0x400196f4) = 0x0804efac
__errno_location()                                = 0x4022f360
newlocale(8127, 0x0804ca6d, 0, 1, 0)              = 0x4022e4e0
strtold_l(0xbfffe948, 0xbfffe4ac, 0x4022e4e0, 1, 0) = 0x88000000
freelocale(0x4022e4e0, 0xbfffe4ac, 0x4022e4e0, 1, 0) = 0x4012ddeb
__errno_location()                                = 0x4022f360
printf("%.100000000Lf", ...)                      = -1
free(0x0804efa0)                                  = <void>
exit(0 <unfinished ...>
__fpending(0x4022e7c0, 1, 0xbfffe650, 0x4000bd88, 0x400196f4) = 0
fclose(0x4022e7c0)                                = 0
__fpending(0x4022e660, 1, 0xbfffe650, 0x4000bd88, 38644) = 0
fclose(0x4022e660)                                = 0
+++ exited (status 0) +++

Indeed you see that the libc's printf() call is returning -1. So if you have
a different libc, I can understand that you cannot reproduce it.

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.

Bruno





reply via email to

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