GNU bug report logs -
#13555
printf ignores length modifier
Previous Next
Reported by: "Marcel Böhme" <hawkie <at> web.de>
Date: Sat, 26 Jan 2013 10:36:02 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Dear all,
I've been looking into the semantic changes introduced to printf with the commit 62e1d5259df82155ae52201678093381a35d898e (08.07.2004) and found besides a lot of progression (conformance to C99 etc.) the following oddities:
The tool printf ignores length modifiers (cf. http://linux.die.net/man/3/printf)
In fact, any (combination of) length modifier is substituted by "ll" as length modifier. Is this intended?
$old/printf "%hi\n" 0xFFFF
-1
$printf "%hi\n" 0xFFFF
65535
$old/printf "%hi\n" 0xFFF
4095
$old/printf "%hhLljtzllhi\n" 0xFFF
printf: %h: invalid directive
$printf "%hhLljtzllhi\n" 0xFFF
4095
On the on hand the comment reads:
332 /* Create a null-terminated copy of the % directive, with an
333 intmax_t-wide length modifier substituted for any existing
334 integer length modifier. */
On the other hand the commit comment reads:
> Add support for C99 'j', 't', 'z' length modifiers (like Bash).
Best regards,
Marcel
PS: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=62e1d5259df82155ae52201678093381a35d898e
This bug report was last modified 6 years and 204 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.