[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] utimes.m4 -> utimes-null.m4; new utimes.m4 (merge from core
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] utimes.m4 -> utimes-null.m4; new utimes.m4 (merge from coreutils) |
Date: |
16 Aug 2003 20:07:03 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I installed the following changes from coreutils. This change renames
utimes.m4 to utimes-null.m4, substituting a new utimes.m4 in its place.
2003-08-16 Paul Eggert <address@hidden>
* modules/utime: Add m4/utimes-null.m4.
2003-08-16 Jim Meyering <address@hidden>
* utimes.m4 (gl_FUNC_UTIMES): New file.
* utimes.m4: Removed.
* utimes-null.m4: Renamed from utimes.m4.
Index: modules/utime
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/utime,v
retrieving revision 1.3
diff -p -u -r1.3 utime
--- modules/utime 20 Jan 2003 10:02:38 -0000 1.3
+++ modules/utime 17 Aug 2003 02:56:37 -0000
@@ -4,8 +4,9 @@ utime() function: change access and/or m
Files:
lib/utime.c
m4/utimbuf.m4
-m4/utimes.m4
m4/utime.m4
+m4/utimes.m4
+m4/utimes-null.m4
Depends-on:
safe-read
Index: m4/utimes.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/utimes.m4,v
retrieving revision 1.8
diff -p -u -r1.8 utimes.m4
--- m4/utimes.m4 17 Sep 2001 21:44:03 -0000 1.8
+++ m4/utimes.m4 17 Aug 2003 02:56:37 -0000
@@ -1,32 +1,46 @@
-#serial 4
+# See if we need to work around bugs in glibc's implementation of
+# utimes from around July/August 2003.
+# First, there was a bug that would make utimes set mtime
+# and atime to zero (1970-01-01) unconditionally.
+# Then, there is/was code to round rather than truncate.
+#
+# From Jim Meyering, with suggestions from Paul Eggert.
-dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
-dnl then do case-insensitive s/utime/utimes/.
-
-AC_DEFUN([jm_FUNC_UTIMES_NULL],
-[AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
-[rm -f conftest.data; > conftest.data
-AC_TRY_RUN([
-/* In case stat has been defined to rpl_stat, undef it here. */
-#undef stat
+AC_DEFUN([gl_FUNC_UTIMES],
+[
+ AC_CACHE_CHECK([determine whether the utimes function works],
+ gl_cv_func_working_utimes,
+ [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/stat.h>
-main() {
-struct stat s, t;
-exit(!(stat ("conftest.data", &s) == 0
- && utimes("conftest.data", (long *)0) == 0
- && stat("conftest.data", &t) == 0
- && t.st_mtime >= s.st_mtime
- && t.st_mtime - s.st_mtime < 120));
-}],
- ac_cv_func_utimes_null=yes,
- ac_cv_func_utimes_null=no,
- ac_cv_func_utimes_null=no)
-rm -f core core.* *.core])
+#include <sys/time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <utime.h>
+
+int
+main ()
+{
+ static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+ struct stat sbuf;
+ char const *file = "conftest.utimes";
+ FILE *f;
+
+ exit ( ! ((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) );
+}
+ ]])],
+ [gl_cv_func_working_utimes=yes],
+ [gl_cv_func_working_utimes=no],
+ [gl_cv_func_working_utimes=no])])
- if test $ac_cv_func_utimes_null = yes; then
- AC_DEFINE(HAVE_UTIMES_NULL, 1,
- [Define if utimes accepts a null argument])
- fi
- ]
-)
+ if test $gl_cv_func_working_utimes = yes; then
+ AC_DEFINE([HAVE_WORKING_UTIMES], 1, [Define if utimes works properly. ])
+ fi
+])
--- /dev/null Tue Mar 18 13:55:57 2003
+++ m4/utimes-null.m4 Sat Aug 16 18:12:39 2003
@@ -0,0 +1,32 @@
+#serial 4
+
+dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
+dnl then do case-insensitive s/utime/utimes/.
+
+AC_DEFUN([jm_FUNC_UTIMES_NULL],
+[AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
+[rm -f conftest.data; > conftest.data
+AC_TRY_RUN([
+/* In case stat has been defined to rpl_stat, undef it here. */
+#undef stat
+#include <sys/types.h>
+#include <sys/stat.h>
+main() {
+struct stat s, t;
+exit(!(stat ("conftest.data", &s) == 0
+ && utimes("conftest.data", (long *)0) == 0
+ && stat("conftest.data", &t) == 0
+ && t.st_mtime >= s.st_mtime
+ && t.st_mtime - s.st_mtime < 120));
+}],
+ ac_cv_func_utimes_null=yes,
+ ac_cv_func_utimes_null=no,
+ ac_cv_func_utimes_null=no)
+rm -f core core.* *.core])
+
+ if test $ac_cv_func_utimes_null = yes; then
+ AC_DEFINE(HAVE_UTIMES_NULL, 1,
+ [Define if utimes accepts a null argument])
+ fi
+ ]
+)
- [Bug-gnulib] utimes.m4 -> utimes-null.m4; new utimes.m4 (merge from coreutils),
Paul Eggert <=