bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-stat-time failure on FreeBSD 6


From: James Youngman
Subject: Re: test-stat-time failure on FreeBSD 6
Date: Tue, 3 Apr 2007 10:13:58 +0100

On 4/3/07, Bruno Haible <address@hidden> wrote:
Hello James,

On FreeBSD/x86 6.1, on a NFS mount, the test-stat-time test fails:

Sorry.   For some reason the sanity check on the value of
st_birthtim.tv_sec ended up in the wrong arm of an #if and was
therefore not performed.   Here is a patch which should fix it (tested
on Linux and FreeBSD (with and without st_birthtime).   I have no
access to FreeBSD (since it doesn't support Xen yet).



2007-04-03  James Youngman  <address@hidden>

        * lib/stat-time.h: (get_stat_birthtime): Check for zero-valued
        birthtime on all systems, not just those which use
        st_birthtimensec rather than st_birthtim.  Putting zero in
        st_bithtim.tv_sec is how (for example) FreeBSD/x86 6.1
       indicates that the birth time is not available for files on
        an NFS mount.

Index: lib/stat-time.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/stat-time.h,v
retrieving revision 1.7
diff -u -p -r1.7 stat-time.h
--- lib/stat-time.h     27 Mar 2007 20:03:47 -0000      1.7
+++ lib/stat-time.h     3 Apr 2007 09:05:01 -0000
@@ -153,16 +153,6 @@ get_stat_birthtime (struct stat const *s
#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
  t.tv_sec = st->st_birthtime;
  t.tv_nsec = st->st_birthtimensec;
-
-  /* NetBSD sometimes signals the absence of knowledge by using zero.
-     Attempt to work around this bug.  This sometimes reports failure
-     even for valid time stamps.  Also, sometimes NetBSD returns junk
-     in the birth time fields; work around this bug if it it is
-     detected.  There's no need to detect negative tv_nsec junk as
-     negative tv_nsec already indicates an error.  */
-  if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
-    t.tv_nsec = -1;
-
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
  /* Woe32 native platforms (but not Cygwin) put the "file creation
     time" in st_ctime (!).  See
@@ -175,6 +165,15 @@ get_stat_birthtime (struct stat const *s
  t.tv_nsec = -1;
#endif

+  /* NetBSD sometimes signals the absence of knowledge by using zero.
+     Attempt to work around this bug.  This sometimes reports failure
+     even for valid time stamps.  Also, sometimes NetBSD returns junk
+     in the birth time fields; work around this bug if it it is
+     detected.  There's no need to detect negative tv_nsec junk as
+     negative tv_nsec already indicates an error.  */
+  if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
+    t.tv_nsec = -1;
+
  return t;
}




reply via email to

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