GNU bug report logs - #13555
printf ignores length modifier

Previous Next

Package: coreutils;

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 #11 received at 13555 <at> debbugs.gnu.org (full text, mbox):

From: Marcel Boehme <hawkie <at> web.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: "13555 <at> debbugs.gnu.org" <13555 <at> debbugs.gnu.org>
Subject: Re: bug#13555: printf ignores length modifier
Date: Sun, 27 Jan 2013 08:55:26 +0800
Dear Paul,

Then, I suppose, the observed semantic change for the mentioned version pair was _intended_. Found it odd that I didn't find documented that / why length modifiers are 'suddenly' ignored.

Thanks for your follow-up!

Best regards,
Marcel



On 27 Jan, 2013, at 12:37 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> 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 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.