[Bug 12041] New: /bin/stat always prints zero fractional seconds

bugzilla at busybox.net bugzilla at busybox.net
Thu Jul 18 09:27:43 UTC 2019


https://bugs.busybox.net/show_bug.cgi?id=12041

            Bug ID: 12041
           Summary: /bin/stat always prints zero fractional seconds
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: roman.perepelitsa at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

This came from https://gitlab.alpinelinux.org/alpine/aports/issues/10542.

/bin/stat from Busybox prints zero fractional seconds for mtime, atime and
ctime. For example, on default install of Alpine Linux:

    touch /tmp/test
    stat /tmp/test

Output:

    File: /tmp/test
    Size: 0 Blocks: 0 IO Block: 4096 regular empty file
    Device: 7ah/122d Inode: 2909137 Links: 1
    Access: (0644/-rw-r—r—) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2019-06-07 12:14:02.000000000
    Modify: 2019-06-07 12:14:02.000000000
    Change: 2019-06-07 12:14:02.000000000

Compare to /bin/stat from coreutils on the same system:

    File: /tmp/test
    Size: 0 Blocks: 0 IO Block: 4096 regular empty file
    Device: 7ah/122d Inode: 2909137 Links: 1
    Access: (0644/-rw-r—r—) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2019-06-07 12:14:02.906502175 +0000
    Modify: 2019-06-07 12:14:02.906502175 +0000
    Change: 2019-06-07 12:14:02.906502175 +0000
    Birth: -

Apparently, Busybox deliberately prints zeros instead of the real fractional
seconds:
https://git.busybox.net/busybox/tree/coreutils/stat.c?id=e2026381bed88e79b6f7657eef8319e60ff83041#n166.
Is it possible to fix this? This is confusing since the output isn't just
missing data but contains incorrect data. When seeing the output with 000000000
for fractional seconds, one can reasonably take this to mean that fractional
seconds are zero.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list