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
View this message in rfc822 format
On 01/26/2013 01:41 AM, Marcel Böhme wrote:
> $old/printf "%hi\n" 0xFFFF
> -1
> $printf "%hi\n" 0xFFFF
> 65535
None of these length modifiers are specified by POSIX,
so we're talking about what it's more useful for printf
to do, rather than whether this is a violation of
a standard. coreutils printf should agree
with Bash printf, and Bash printf ignores the modifiers,
so if we change coreutils we should change Bash too.
I suppose that 'printf' could change its behavior, and
use (say) 32-bit int for '%li' on a x86 but 64-bit int
on x86-64, thus exposing the native machine widths to
the user. However, for shell scripts I expect that more
people prefer portability to exposing the machine widths,
so the current behavior is better.
This bug report was last modified 6 years and 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.