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