GNU bug report logs - #7365
stat bug: %Z appends .000000000

Previous Next

Package: coreutils;

Reported by: IgnorantGuru <ignorantguru <at> users.sourceforge.net>

Date: Wed, 10 Nov 2010 16:30:03 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7365 in the body.
You can then email your comments to 7365 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7365; Package coreutils. (Wed, 10 Nov 2010 16:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to IgnorantGuru <ignorantguru <at> users.sourceforge.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 10 Nov 2010 16:30:04 GMT) Full text and rfc822 format available.

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

From: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
To: bug-coreutils <at> gnu.org
Cc: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
Subject: stat bug: %Z appends .000000000
Date: Wed, 10 Nov 2010 07:59:13 -0700
$ stat -c %Z examplefile 
1289397609.000000000

stat (GNU coreutils) 8.6 installed from Arch Linux repos, executing in a bash shell.

This behavior changed recently - didn't used to have the .000000000 which breaks scripts that use stat.  eg
line 297: ((: 1289301692.000000000: syntax error: invalid arithmetic operator (error token is ".000000000")




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7365; Package coreutils. (Wed, 10 Nov 2010 17:58:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
Cc: 7365 <at> debbugs.gnu.org
Subject: Re: bug#7365: stat bug: %Z appends .000000000
Date: Wed, 10 Nov 2010 11:02:30 -0700
[Message part 1 (text/plain, inline)]
On 11/10/2010 07:59 AM, IgnorantGuru wrote:
> $ stat -c %Z examplefile 
> 1289397609.000000000
> 
> stat (GNU coreutils) 8.6 installed from Arch Linux repos, executing in a bash shell.
> 
> This behavior changed recently - didn't used to have the .000000000 which breaks scripts that use stat.  eg
> line 297: ((: 1289301692.000000000: syntax error: invalid arithmetic operator (error token is ".000000000")

Technically, this is not a bug, since it was documented in NEWS:

  stat now outputs the full sub-second resolution for the atime,
  mtime, and ctime values since the Epoch, when using the %X, %Y, and
  %Z directives of the --format option.  This matches the fact that
  %x, %y, and %z were already doing so for the human-readable variant.

However, it has already been discussed (extensively!) on this list that
it was somewhat an undesirable change, so for the soon-to-be-released
8.7, the behavior is changing yet again:

http://lists.gnu.org/archive/html/bug-coreutils/2010-11/msg00076.html

  stat's %X, %Y, and %Z directives once again print only the integer
  part of seconds since the epoch.  This reverts a change from
  coreutils-8.6, that was deemed unnecessarily disruptive.  To obtain
  a full resolution time stamp for %X, use %.X; if you want (say) just
  3 fractional digits, use %.3X.  Likewise for %Y and %Z.

  stat's new %W format directive would print floating point seconds.
  However, with the above change to %X, %Y and %Z, we've made %W work
  the same way as the others.

so that %Z will once again omit nanoseconds, %.Z will print 9
nanoseconds, %#.Z will print as many non-zero fractional seconds as
supported by the fs, and %#.3Z will truncate to milliseconds.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7365; Package coreutils. (Wed, 10 Nov 2010 18:20:03 GMT) Full text and rfc822 format available.

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

From: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
To: Eric Blake <eblake <at> redhat.com>
Cc: 7365 <at> debbugs.gnu.org
Subject: Re: bug#7365: stat bug: %Z appends .000000000
Date: Wed, 10 Nov 2010 11:24:01 -0700
Thanks for the explanation - I definitely think maintaining backward compatibility is a better approach.  There is far too much breakage of software in linux as it is.


On Wed, 10 Nov 2010 11:02:30 -0700
Eric Blake <eblake <at> redhat.com> wrote:

> On 11/10/2010 07:59 AM, IgnorantGuru wrote:
> > $ stat -c %Z examplefile 
> > 1289397609.000000000
> > 
> > stat (GNU coreutils) 8.6 installed from Arch Linux repos, executing
> > in a bash shell.
> > 
> > This behavior changed recently - didn't used to have the .000000000
> > which breaks scripts that use stat.  eg line 297: ((:
> > 1289301692.000000000: syntax error: invalid arithmetic operator
> > (error token is ".000000000")
> 
> Technically, this is not a bug, since it was documented in NEWS:
> 
>   stat now outputs the full sub-second resolution for the atime,
>   mtime, and ctime values since the Epoch, when using the %X, %Y, and
>   %Z directives of the --format option.  This matches the fact that
>   %x, %y, and %z were already doing so for the human-readable variant.
> 
> However, it has already been discussed (extensively!) on this list
> that it was somewhat an undesirable change, so for the
> soon-to-be-released 8.7, the behavior is changing yet again:
> 
> http://lists.gnu.org/archive/html/bug-coreutils/2010-11/msg00076.html
> 
>   stat's %X, %Y, and %Z directives once again print only the integer
>   part of seconds since the epoch.  This reverts a change from
>   coreutils-8.6, that was deemed unnecessarily disruptive.  To obtain
>   a full resolution time stamp for %X, use %.X; if you want (say) just
>   3 fractional digits, use %.3X.  Likewise for %Y and %Z.
> 
>   stat's new %W format directive would print floating point seconds.
>   However, with the above change to %X, %Y and %Z, we've made %W work
>   the same way as the others.
> 
> so that %Z will once again omit nanoseconds, %.Z will print 9
> nanoseconds, %#.Z will print as many non-zero fractional seconds as
> supported by the fs, and %#.3Z will truncate to milliseconds.
> 





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7365; Package coreutils. (Thu, 11 Nov 2010 13:48:01 GMT) Full text and rfc822 format available.

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

From: James Youngman <jay <at> gnu.org>
To: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
Cc: Eric Blake <eblake <at> redhat.com>, 7365 <at> debbugs.gnu.org
Subject: Re: bug#7365: stat bug: %Z appends .000000000
Date: Thu, 11 Nov 2010 13:52:04 +0000
On Wed, Nov 10, 2010 at 6:24 PM, IgnorantGuru
<ignorantguru <at> users.sourceforge.net> wrote:
> Thanks for the explanation - I definitely think maintaining backward compatibility is a better approach.  There is far too much breakage of software in linux as it is.

FWIW, GNU findutils does the same thing.   I don't think anybody
complained about this.

James.




Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Sun, 14 Nov 2010 18:05:02 GMT) Full text and rfc822 format available.

Notification sent to IgnorantGuru <ignorantguru <at> users.sourceforge.net>:
bug acknowledged by developer. (Sun, 14 Nov 2010 18:05:02 GMT) Full text and rfc822 format available.

Message #19 received at 7365-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: IgnorantGuru <ignorantguru <at> users.sourceforge.net>
Cc: Eric Blake <eblake <at> redhat.com>, 7365-done <at> debbugs.gnu.org
Subject: Re: bug#7365: stat bug: %Z appends .000000000
Date: Sun, 14 Nov 2010 19:09:07 +0100
IgnorantGuru wrote:
> Thanks for the explanation - I definitely think maintaining backward
> compatibility is a better approach.  There is far too much breakage of
> software in linux as it is.

coreutils-8.7 (just released) is better in this respect.
I'm marking this issue as "done".




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Dec 2010 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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