GNU bug report logs - #7325
new test failure due to non-portability of printf formats like %05.3s

Previous Next

Package: coreutils;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Wed, 3 Nov 2010 18:56:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, Eric Blake <eblake <at> redhat.com>, 7325 <at> debbugs.gnu.org
Subject: bug#7325: new test failure due to non-portability of printf formats like %05.3s
Date: Fri, 12 Nov 2010 12:22:53 +0100
Pádraig Brady wrote:
> On 11/11/10 17:54, Paul Eggert wrote:
...
>> It's
>> not a big deal, but I still mildly prefer the * notation.

Same here.

However, here's an argument for using a different method, perhaps
with a hard-coded mapping from common FS types to known precision:

Running these two commands with different ordering prints
different results.  When the file with NS%10 == 0 comes first,
stat suppresses the trailing 0(s):

    $ stat -c '%4n %.*Z' 3 9
       3 1289555520.29981438
       9 1289555520.300814502

After the first non-multiple-of-10 nanoseconds value,
stat prints all trailing 0's:

    $ stat -c '%4n %.*Z' 9 3
       9 1289555520.300814502
       3 1289555520.299814380

It's easy to create files like that via e.g.,

  seq 10000|xargs touch -d '1970-01-01 18:43:33.5000000000'




This bug report was last modified 14 years and 191 days ago.

Previous Next


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