[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] utimes.m4 merge from coreutils
From: |
Paul Eggert |
Subject: |
[bug-gnulib] utimes.m4 merge from coreutils |
Date: |
Tue, 18 Jan 2005 15:53:15 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this to detect yet another bug in glibc utimes:
2005-01-18 Jim Meyering <address@hidden>
* utimes.m4: Work around tests/touch/empty-file failure on a system
(sparc64, Linux-2.4.28, glibc-2.3.3) that didn't honor utimes'
NULL-means-set-to-current-time semantics.
Remove temporary file immediately, rather than waiting
for configure's at-exit trap code to do it.
Index: utimes.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/utimes.m4,v
retrieving revision 1.10
retrieving revision 1.11
diff -p -u -r1.10 -r1.11
--- utimes.m4 27 Sep 2003 15:46:21 -0000 1.10
+++ utimes.m4 18 Jan 2005 23:52:18 -0000 1.11
@@ -1,8 +1,17 @@
+# Detect some bugs in glibc's implementation of utimes.
+
+dnl Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
# See if we need to work around bugs in glibc's implementation of
# utimes from 2003-07-12 to 2003-09-17.
# First, there was a bug that would make utimes set mtime
# and atime to zero (1970-01-01) unconditionally.
# Then, there was code to round rather than truncate.
+# Then, there was an implementation (sparc64, Linux-2.4.28, glibc-2.3.3)
+# that didn't honor the NULL-means-set-to-current-time semantics.
#
# From Jim Meyering, with suggestions from Paul Eggert.
@@ -15,6 +24,7 @@ AC_DEFUN([gl_FUNC_UTIMES],
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -27,13 +37,29 @@ main ()
struct stat sbuf;
char const *file = "conftest.utimes";
FILE *f;
+ time_t now;
- exit ( ! ((f = fopen (file, "w"))
+ int ok = ((f = fopen (file, "w"))
&& fclose (f) == 0
&& utimes (file, timeval) == 0
&& lstat (file, &sbuf) == 0
&& sbuf.st_atime == timeval[0].tv_sec
- && sbuf.st_mtime == timeval[1].tv_sec) );
+ && sbuf.st_mtime == timeval[1].tv_sec);
+ unlink (file);
+ if (!ok)
+ exit (1);
+
+ ok =
+ ((f = fopen (file, "w"))
+ && fclose (f) == 0
+ && time (&now) != (time_t)-1
+ && utimes (file, NULL) == 0
+ && lstat (file, &sbuf) == 0
+ && now - sbuf.st_atime <= 2
+ && now - sbuf.st_mtime <= 2);
+ unlink (file);
+
+ exit (!ok);
}
]])],
[gl_cv_func_working_utimes=yes],
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gnulib] utimes.m4 merge from coreutils,
Paul Eggert <=