GNU bug report logs - #73068
printf: please implement POSIX:2024 argument reordering

Previous Next

Package: coreutils;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Fri, 6 Sep 2024 14:07:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #28 received at 73068 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>,
 Collin Funk <collin.funk1 <at> gmail.com>, 73068 <at> debbugs.gnu.org
Cc: bruno <at> clisp.org
Subject: Re: bug#73068: printf: please implement POSIX:2024 argument reordering
Date: Thu, 12 Sep 2024 12:33:07 -0700
On 2024-09-12 12:03, Pádraig Brady wrote:


> This is tricky enough, that we should be as restrictive as possible here,
> so I may resort to strspn(f, "0123456789") to parse instead.
> I'll think a bit about it.

The code's also assuming INT_MAX < INTMAX_MAX, which POSIX doesn't 
require. You could put in a static_assert to that effect, I suppose, to 
document the assumption.

More important, though, if you're not in the C locale all bets are off 
as far as what strtoimax will also parse.

When I ran into this problem with GNU tar, I ended by giving up on 
strtoimax and did my own little integer parser. It does exactly what I 
want and I don't have to fire up the strtoimax complexity+locale engine.




This bug report was last modified 252 days ago.

Previous Next


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