Re: [PATCH APR 1.0] crtime v.s. intime

2004-07-14 Thread William A. Rowe, Jr.
Ping list - 12 days elapsed.  No interest?  Only comment was from Branko, 
and not in response to this patch.

Since we've floated about this for a year with only a few interested parties
- I suppose it's time to kill the proposal and just document the inconsistency.

Attached are two patches, one introduces intime/crtime (I missed adding 
the actual apr_time_t intime member in the last patch - this fixes it.)
The doc_fix patch just documents the deficiency.  Let's pick one or the other.

Bill

At 03:06 PM 7/2/2004, William A. Rowe, Jr. wrote:
Here's the patch for those interested, which splits ctime into crtime
and intime.

An interesting side effect, neither crtime nor intime stay part of the
APR_FINFO_MIN set of information - one bit or the other would be
toggled.

Index: include/apr_file_info.h
===
RCS file: /home/cvs/apr/include/apr_file_info.h,v
retrieving revision 1.47
diff -u -r1.47 apr_file_info.h
--- include/apr_file_info.h 25 Jun 2004 15:28:42 -  1.47
+++ include/apr_file_info.h 14 Jul 2004 20:22:03 -
@@ -133,7 +133,7 @@
 
 #define APR_FINFO_LINK   0x0001 /** Stat the link not the file itself if 
it is a link */
 #define APR_FINFO_MTIME  0x0010 /** Modification Time */
-#define APR_FINFO_CTIME  0x0020 /** Creation Time */
+#define APR_FINFO_CTIME  0x0020 /** Creation or inode-changed time */
 #define APR_FINFO_ATIME  0x0040 /** Access Time */
 #define APR_FINFO_SIZE   0x0100 /** Size of the file */
 #define APR_FINFO_CSIZE  0x0200 /** Storage size consumed by the file */
@@ -191,7 +191,7 @@
 apr_time_t atime;
 /** The time the file was last modified */
 apr_time_t mtime;
-/** The time the file was last changed */
+/** The time the file was created, or the inode was last changed */
 apr_time_t ctime;
 /** The pathname of the file (possibly unrooted) */
 const char *fname;
Index: file_io/netware/filestat.c
===
RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
retrieving revision 1.34
diff -u -r1.34 filestat.c
--- file_io/netware/filestat.c  29 Mar 2004 17:53:28 -  1.34
+++ file_io/netware/filestat.c  14 Jul 2004 20:13:39 -
@@ -55,8 +55,9 @@
 static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info,
apr_int32_t wanted)
 { 
-finfo-valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK 
-| APR_FINFO_OWNER | APR_FINFO_PROT;
+finfo-valid = APR_FINFO_MIN   | APR_FINFO_INTIME 
+ | APR_FINFO_IDENT | APR_FINFO_NLINK 
+ | APR_FINFO_OWNER | APR_FINFO_PROT;
 finfo-protection = apr_unix_mode2perms(info-st_mode);
 finfo-filetype = filetype_from_mode(info-st_mode);
 finfo-user = info-st_uid;
@@ -67,7 +68,8 @@
 finfo-nlink = info-st_nlink;
 apr_time_ansi_put(finfo-atime, info-st_atime.tv_sec);
 apr_time_ansi_put(finfo-mtime, info-st_mtime.tv_sec);
-apr_time_ansi_put(finfo-ctime, info-st_ctime.tv_sec);
+/* XXX Is this intime (or actually cr time?) */
+apr_time_ansi_put(finfo-intime, info-st_ctime.tv_sec);
 /* ### needs to be revisited  
  * if (wanted  APR_FINFO_CSIZE) {
  *   finfo-csize = info-st_blocks * 512;
Index: file_io/os2/dir.c
===
RCS file: /home/cvs/apr/file_io/os2/dir.c,v
retrieving revision 1.36
diff -u -r1.36 dir.c
--- file_io/os2/dir.c   13 Feb 2004 09:38:24 -  1.36
+++ file_io/os2/dir.c   14 Jul 2004 20:13:39 -
@@ -101,12 +101,12 @@
  thedir-entry.ftimeLastWrite);
 apr_os2_time_to_apr_time(finfo-atime, thedir-entry.fdateLastAccess,
  thedir-entry.ftimeLastAccess);
-apr_os2_time_to_apr_time(finfo-ctime, thedir-entry.fdateCreation,
+apr_os2_time_to_apr_time(finfo-crtime, thedir-entry.fdateCreation,
  thedir-entry.ftimeCreation);
 
 finfo-name = thedir-entry.achName;
 finfo-valid = APR_FINFO_NAME | APR_FINFO_MTIME | APR_FINFO_ATIME |
-APR_FINFO_CTIME | APR_FINFO_TYPE | APR_FINFO_SIZE |
+APR_FINFO_CRTIME | APR_FINFO_TYPE | APR_FINFO_SIZE |
 APR_FINFO_CSIZE;
 
 return APR_SUCCESS;
Index: file_io/os2/filestat.c
===
RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
retrieving revision 1.41
diff -u -r1.41 filestat.c
--- file_io/os2/filestat.c  22 May 2004 07:26:10 -  1.41
+++ file_io/os2/filestat.c  14 Jul 2004 20:13:39 -
@@ -42,11 +42,11 @@
  fstatus-ftimeLastAccess );
 apr_os2_time_to_apr_time(finfo-mtime, fstatus-fdateLastWrite,  
  fstatus-ftimeLastWrite );
-apr_os2_time_to_apr_time(finfo-ctime, fstatus-fdateCreation,   
+

Re: [PATCH APR 1.0] crtime v.s. intime

2004-07-14 Thread Noah Misch
On Wed, Jul 14, 2004 at 03:21:33PM -0500, William A. Rowe, Jr. wrote:
 Ping list - 12 days elapsed.  No interest?  Only comment was from Branko, 
 and not in response to this patch.
 
 Since we've floated about this for a year with only a few interested parties
 - I suppose it's time to kill the proposal and just document the 
 inconsistency.
 
 Attached are two patches, one introduces intime/crtime (I missed adding 
 the actual apr_time_t intime member in the last patch - this fixes it.)
 The doc_fix patch just documents the deficiency.  Let's pick one or the other.
 
 Bill

Splitting ctime does improve representational correctness, but as I think about
it, I doubt it helps folks write more portable programs.  It does not presently
make more information available; each OS either fills intime or fills crtime.
Library users will need to modify their code to cope with this change, albeit
trivially, and I'm not seeing what they will then have the new ability to do.

For better or worse, ctime just isn't very useful.  On Windows, it lets you
smile about the fact that you have your very own file from 1988.  On Unix, it's
a (weak) auditing tool; one can change a file's mtime to anything, but doing so
advances ctime, and one cannot arbitrarily set ctime.  As such, assuming the
integrity of the kernel and the filesystem backing store, a file will not have
changed since the later of its ctime or mtime.

It might be useful to define e.g. APR_CTIME_IS_CREATE_TIME on systems where that
is the case.  This would not prompt changes to programs that use ctime casually,
and programs that do care could test for that and behave accordingly.

I would (unofficially, of course) vote for the comments patch.  Should APR ever
support an OS that makes both crtime and intime available, I think your change
would be excellent.  If such an OS is mainstream now and we just don't support
it yet, then your proposal may be good to incorporate so APR can support both
values later without such an API change.

Hopefully that is of some value to the discussion.


Re: [PATCH APR 1.0] crtime v.s. intime

2004-07-14 Thread Noah Misch
On Wed, Jul 14, 2004 at 02:46:41PM -0700, Noah Misch wrote:

  Attached are two patches, one introduces intime/crtime (I missed adding 
  the actual apr_time_t intime member in the last patch - this fixes it.)
  The doc_fix patch just documents the deficiency.  Let's pick one or the 
  other.
  
  Bill

 I would (unofficially, of course) vote for the comments patch.  Should APR 
 ever
 support an OS that makes both crtime and intime available, I think your change
 would be excellent.  If such an OS is mainstream now and we just don't support
 it yet, then your proposal may be good to incorporate so APR can support both
 values later without such an API change.

Well, there is such an OS discreetly marketed as FreeBSD.  Let's implement
your proposal so we can populate both fields there.  Other BSDs supporting UFS2
may also expose st_birthtime.


[PATCH APR 1.0] crtime v.s. intime

2004-07-02 Thread William A. Rowe, Jr.
Here's the patch for those interested, which splits ctime into crtime
and intime.

An interesting side effect, neither crtime nor intime stay part of the
APR_FINFO_MIN set of information - one bit or the other would be
toggled.

BillIndex: file_io/netware/filestat.c
===
RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
retrieving revision 1.34
diff -u -r1.34 filestat.c
--- file_io/netware/filestat.c  29 Mar 2004 17:53:28 -  1.34
+++ file_io/netware/filestat.c  2 Jul 2004 20:01:09 -
@@ -55,8 +55,9 @@
 static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info,
apr_int32_t wanted)
 { 
-finfo-valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK 
-| APR_FINFO_OWNER | APR_FINFO_PROT;
+finfo-valid = APR_FINFO_MIN   | APR_FINFO_INTIME 
+ | APR_FINFO_IDENT | APR_FINFO_NLINK 
+ | APR_FINFO_OWNER | APR_FINFO_PROT;
 finfo-protection = apr_unix_mode2perms(info-st_mode);
 finfo-filetype = filetype_from_mode(info-st_mode);
 finfo-user = info-st_uid;
@@ -67,7 +68,8 @@
 finfo-nlink = info-st_nlink;
 apr_time_ansi_put(finfo-atime, info-st_atime.tv_sec);
 apr_time_ansi_put(finfo-mtime, info-st_mtime.tv_sec);
-apr_time_ansi_put(finfo-ctime, info-st_ctime.tv_sec);
+/* XXX Is this intime (or actually cr time?) */
+apr_time_ansi_put(finfo-intime, info-st_ctime.tv_sec);
 /* ### needs to be revisited  
  * if (wanted  APR_FINFO_CSIZE) {
  *   finfo-csize = info-st_blocks * 512;
Index: file_io/os2/dir.c
===
RCS file: /home/cvs/apr/file_io/os2/dir.c,v
retrieving revision 1.36
diff -u -r1.36 dir.c
--- file_io/os2/dir.c   13 Feb 2004 09:38:24 -  1.36
+++ file_io/os2/dir.c   2 Jul 2004 20:01:10 -
@@ -101,12 +101,12 @@
  thedir-entry.ftimeLastWrite);
 apr_os2_time_to_apr_time(finfo-atime, thedir-entry.fdateLastAccess,
  thedir-entry.ftimeLastAccess);
-apr_os2_time_to_apr_time(finfo-ctime, thedir-entry.fdateCreation,
+apr_os2_time_to_apr_time(finfo-crtime, thedir-entry.fdateCreation,
  thedir-entry.ftimeCreation);
 
 finfo-name = thedir-entry.achName;
 finfo-valid = APR_FINFO_NAME | APR_FINFO_MTIME | APR_FINFO_ATIME |
-APR_FINFO_CTIME | APR_FINFO_TYPE | APR_FINFO_SIZE |
+APR_FINFO_CRTIME | APR_FINFO_TYPE | APR_FINFO_SIZE |
 APR_FINFO_CSIZE;
 
 return APR_SUCCESS;
Index: file_io/os2/filestat.c
===
RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
retrieving revision 1.41
diff -u -r1.41 filestat.c
--- file_io/os2/filestat.c  22 May 2004 07:26:10 -  1.41
+++ file_io/os2/filestat.c  2 Jul 2004 20:01:10 -
@@ -42,11 +42,11 @@
  fstatus-ftimeLastAccess );
 apr_os2_time_to_apr_time(finfo-mtime, fstatus-fdateLastWrite,  
  fstatus-ftimeLastWrite );
-apr_os2_time_to_apr_time(finfo-ctime, fstatus-fdateCreation,   
+apr_os2_time_to_apr_time(finfo-crtime, fstatus-fdateCreation,   
  fstatus-ftimeCreation );
 finfo-valid = APR_FINFO_TYPE | APR_FINFO_PROT | APR_FINFO_SIZE
  | APR_FINFO_CSIZE | APR_FINFO_MTIME 
- | APR_FINFO_CTIME | APR_FINFO_ATIME | APR_FINFO_LINK;
+ | APR_FINFO_CRTIME | APR_FINFO_ATIME | APR_FINFO_LINK;
 }
 
 
Index: file_io/unix/filestat.c
===
RCS file: /home/cvs/apr/file_io/unix/filestat.c,v
retrieving revision 1.72
diff -u -r1.72 filestat.c
--- file_io/unix/filestat.c 27 Mar 2004 13:11:17 -  1.72
+++ file_io/unix/filestat.c 2 Jul 2004 20:01:10 -
@@ -69,7 +69,8 @@
 static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info,
apr_int32_t wanted)
 { 
-finfo-valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK
+finfo-valid = APR_FINFO_MIN   | APR_FINFO_INTIME 
+ | APR_FINFO_IDENT | APR_FINFO_NLINK
  | APR_FINFO_OWNER | APR_FINFO_PROT;
 finfo-protection = apr_unix_mode2perms(info-st_mode);
 finfo-filetype = filetype_from_mode(info-st_mode);
@@ -81,7 +82,7 @@
 finfo-nlink = info-st_nlink;
 apr_time_ansi_put(finfo-atime, info-st_atime);
 apr_time_ansi_put(finfo-mtime, info-st_mtime);
-apr_time_ansi_put(finfo-ctime, info-st_ctime);
+apr_time_ansi_put(finfo-intime, info-st_ctime);
 /* ### needs to be revisited  
  * if (wanted  APR_FINFO_CSIZE) {
  *   finfo-csize = info-st_blocks * 512;
Index: file_io/win32/filestat.c
===
RCS file: /home/cvs/apr/file_io/win32/filestat.c,v