coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ls: support --time=creation to show/sort birth time


From: Assaf Gordon
Subject: Re: [PATCH] ls: support --time=creation to show/sort birth time
Date: Thu, 2 Jan 2020 13:29:00 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hello Pádraig and all,


On 2020-01-02 10:48 a.m., Pádraig Brady wrote:
+  ls now supports the --time=birth option to display and sort by
+  file creation time, where available.

+1

Patch looks good, builds and passes the test on Debian 10/x86_64,
OpenBSD 6.6, FreeBSD 12.1, Alpine Linux, and Cygwin-10/64bit on Windows7/NTFS.

A suggestion:

  static char const *const time_args[] =
  {
-  "atime", "access", "use", "ctime", "status", NULL
+  "atime", "access", "use",
+  "ctime", "status",
+  "birth", "creation",
+  NULL
  };
  static enum time_type const time_types[] =
  {
-  time_atime, time_atime, time_atime, time_ctime, time_ctime
+  time_atime, time_atime, time_atime,
+  time_ctime, time_ctime,
+  time_btime, time_btime,
  };

Perhaps add "btime" and "crtime" as aliases to birth time?
"btime" is for completion with atime/ctime.
"crtime" is used/mentioned in some contexts (e.g. in "debugfs").

+/* Return the platform birthtime member of the stat structure,
+   or fallback to the mtime member, which we have populated
+   from the statx structure where supported.  */

Regarding "fall back to mtime", I'm seeing the following results
on some systems - not necessarily a bug, but perhaps it's worth
knowing what to expect:

* Debian 10/x86_64, Linux Kernel 4.19.0, glibc 2.28-10,
with ext2 file system (not supporting birthtime):

  $ ./src/ls -l --time=birth /tmp/dummy-ext2/2
  -rw-r--r-- 1 root root 0 Dec 31  1969 /tmp/dummy-ext2/2

(I guess this is unix-epoch adjusted for my local time zone)


* Alpine Linux, Kernel 4.19.80, musl-libc 1.1.22:

    $ ./src/ls -l --time=birth README
    -rw-r--r-- 1 miles miles 10778            ? README


* OpenBSD 6.6 on "ffs" type file system:

    $ ./src/ls -l --time=birth README
   -rw-r--r-- 1 miles miles 10778            ? README


On all the above systems, running "./src/stat" correctly
shows "birth: -" .

regards,
 - assaf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]