On 04/21/2014 03:57 PM, Pádraig Brady wrote:
On 04/21/2014 08:14 PM, Assaf Gordon wrote:
Would you be receptive to adding a tiny patch to 'stat' to clarify the 
difference between modification time and change time?

This clarification is worth making, thanks!

Perhaps, in addition, add a new FAQ ?

Let's avoid the FAQ for the moment.
Hopefully the improved docs will avoid the need.

<...>

but
if the file was just opened for reading, then access time isn't updated,
only if data is read. Also for performance reasons, modern Linux systems
only update atime if it's older than [cm]time.
I.E. with relatime enabled, it's really only an indicator
as to whether the file has been read since it was last updated.
So I think this whole block might add more ambiguity than
any additional clarification. OK to drop this block?

Attached are improved patches:
The first contains only the added words "status" and "data".

The second adds the paragraph to the docs, and can be included at your 
discretion.
I've reworded the "Access Time" sentence to make clear it depends on the 
operating system and file system configuration.
But I think at least the "data modification time" and "status change time" 
sentences are correct for all systems.

For both the FAQ and the additional paragraph, my reasoning is:
1. Expert users (who know by heart what mtime vs ctime mean) - don't need any 
of these.
2. Seasoned users - perhaps just need a reminder, in which case the words "data" vs 
"status" are enough.
3. Other (most?) users - will still look for clarification after seeing "data modification 
time" vs "status change time".

There are many answers for "what is the difference between modification time and change 
time" found on the internet, but I think it would be beneficial if there's an authoritative 
answer, from a reliable source (i.e. by "coreutils").

Regards,
 -gordon

>From 611b2b12ec7f6ae4ee276adfe74efe41602d27d7 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgor...@gmail.com>
Date: Mon, 21 Apr 2014 14:31:23 -0400
Subject: [PATCH 1/2] doc: clarify stat's mtime vs ctime in usage(), doc

Change "modification time" to "data modification time",
"change time" to "status change time".

* src/stat.c: improve usage()
* doc/coreutils.texi: ditto
---
 doc/coreutils.texi | 8 ++++----
 src/stat.c         | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 6c49385..b21a4fd 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11829,10 +11829,10 @@ The valid @var{format} directives for files with @option{--format} and
 @item %W - Time of file birth as seconds since Epoch, or @samp{0}
 @item %x - Time of last access
 @item %X - Time of last access as seconds since Epoch
-@item %y - Time of last modification
-@item %Y - Time of last modification as seconds since Epoch
-@item %z - Time of last change
-@item %Z - Time of last change as seconds since Epoch
+@item %y - Time of last data modification
+@item %Y - Time of last data modification as seconds since Epoch
+@item %z - Time of last status change
+@item %Z - Time of last status change as seconds since Epoch
 @end itemize
 
 The @samp{%t} and @samp{%T} formats operate on the st_rdev member of
diff --git a/src/stat.c b/src/stat.c
index fffebe3..7d43eb5 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -1457,10 +1457,10 @@ The valid format sequences for files (without --file-system):\n\
   %W   time of file birth, seconds since Epoch; 0 if unknown\n\
   %x   time of last access, human-readable\n\
   %X   time of last access, seconds since Epoch\n\
-  %y   time of last modification, human-readable\n\
-  %Y   time of last modification, seconds since Epoch\n\
-  %z   time of last change, human-readable\n\
-  %Z   time of last change, seconds since Epoch\n\
+  %y   time of last data modification, human-readable\n\
+  %Y   time of last data modification, seconds since Epoch\n\
+  %z   time of last status change, human-readable\n\
+  %Z   time of last status change, seconds since Epoch\n\
 \n\
 "), stdout);
 
-- 
1.9.1

>From d7757509a9248a1b2ead45433741d2ec0d4ce7d2 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgor...@gmail.com>
Date: Tue, 22 Apr 2014 11:13:02 -0400
Subject: [PATCH 2/2] doc: add paragraph about stat's %x/%y/%z

doc/coreutils.texi: added paragraph.
---
 doc/coreutils.texi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index b21a4fd..b505d1e 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11864,6 +11864,16 @@ precision:
   [1288929712.114951834]
 @end example
 
+@emph{Access time} formats (@samp{%x},@samp{%X}) output the file's access time.
+Access time is also shown with @command{ls -lu}. The precise meaning of file
+access time depends on your operating system and file system configuration.
+@emph{Data modification} format (@samp{%y}, @samp{%Y})
+outputs the time the file's content was modified (e.g. by a program writing
+to the file). Data modification time is also shown with @command{ls -l}.
+@emph{Status change} format (@samp{%z},@samp{%Z}) outputs the
+time the file's status was modified (e.g. owner, group, mode changes). Status
+change time is also shown with @command{ls -lc}.
+
 The mount point printed by @samp{%m} is similar to that output
 by @command{df}, except that:
 @itemize @bullet
-- 
1.9.1

Reply via email to