bug-gnulib
[Top][All Lists]
Advanced

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

Re: utime


From: Jim Meyering
Subject: Re: utime
Date: Thu, 04 Mar 2010 15:54:51 +0100

Simon Josefsson wrote:
> Jim, the utime module says:
>
> Notice:
> This module is obsolete. It can be removed on 2010-01-01.
>
> Why is it obsolete?  Should we remove it now?  The code looks useful to
> me, but I may be missing something.  I cannot find anything in NEWS or
> doc/posix-functions/utime.texi to explain this either.

Hi Simon,

It's marked obsolete because it is no longer useful on any
reasonable porting target.

Bruno proposed to remove it outright about 10 months ago,
but ended up just marking it obsolete.  The topic arose here:

    http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/16569/focus=16579

Given that coreutils stopped using it then (no problems), and that
gnulib-tool has been warning anyone who uses it, outright removal
should be safe, now.  Here's a patch to do that.
I'll push tomorrow if no one objects.

>From 38f9736292bd1a902fb8eb767de538af76fafc18 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 4 Mar 2010 15:36:51 +0100
Subject: [PATCH] utime: remove obsolete module

This module, like autoconf's AC_FUNC_UTIME_NULL macro, has been
unnecessary for years, and has been marked as obsolete for 10 months.
* modules/utime: Remove file.
* lib/utime.c: Remove file.
* m4/utime.m4: Remove file.
* m4/utimes-null.m4: Remove file.
* doc/posix-functions/utime.texi (utime): Remove reference to
the module.  Move the sole "fixed by gnulib" item into the
"problems not fixed by Gnulib" list.
* MODULES.html.sh (func_all_modules): Remove reference to "utime".
---
 ChangeLog                      |   14 +++++
 MODULES.html.sh                |    1 -
 doc/posix-functions/utime.texi |    8 ++--
 lib/utime.c                    |  108 ----------------------------------------
 m4/utime.m4                    |   62 -----------------------
 m4/utimes-null.m4              |   41 ---------------
 modules/utime                  |   38 --------------
 7 files changed, 18 insertions(+), 254 deletions(-)
 delete mode 100644 lib/utime.c
 delete mode 100644 m4/utime.m4
 delete mode 100644 m4/utimes-null.m4
 delete mode 100644 modules/utime

diff --git a/ChangeLog b/ChangeLog
index 12dc75c..914a544 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-03-04  Jim Meyering  <address@hidden>
+
+       utime: remove obsolete module
+       This module, like autoconf's AC_FUNC_UTIME_NULL macro, has been
+       unnecessary for years, and has been marked as obsolete for 10 months.
+       * modules/utime: Remove file.
+       * lib/utime.c: Remove file.
+       * m4/utime.m4: Remove file.
+       * m4/utimes-null.m4: Remove file.
+       * doc/posix-functions/utime.texi (utime): Remove reference to
+       the module.  Move the sole "fixed by gnulib" item into the
+       "problems not fixed by Gnulib" list.
+       * MODULES.html.sh (func_all_modules): Remove reference to "utime".
+
 2010-03-02  Ralf Wildenhues  <address@hidden>

        fts-lgpl: remove unused module
diff --git a/MODULES.html.sh b/MODULES.html.sh
index b3b9122..080c60a 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2370,7 +2370,6 @@ func_all_modules ()
   func_module tsearch
   func_module unistd
   func_module unlink
-  func_module utime
   func_module utimensat
   func_module vasnprintf-posix
   func_module vasprintf-posix
diff --git a/doc/posix-functions/utime.texi b/doc/posix-functions/utime.texi
index f50af81..7ffffc7 100644
--- a/doc/posix-functions/utime.texi
+++ b/doc/posix-functions/utime.texi
@@ -4,18 +4,18 @@ utime

 POSIX specification: 
@url{http://www.opengroup.org/onlinepubs/9699919799/functions/utime.html}

-Gnulib module: utime
+Gnulib module: ---

 Portability problems fixed by Gnulib:
 @itemize
address@hidden
-On some old platforms (Sequent), @code{utime (file, NULL)} fails to set the
-file's timestamp to the current time.
 @end itemize

 Portability problems not fixed by Gnulib:
 @itemize
 @item
+On some old platforms (Sequent), @code{utime (file, NULL)} fails to set the
+file's timestamp to the current time.
address@hidden
 On some platforms, this function mis-handles trailing slash:
 Solaris 9.
 @item
diff --git a/lib/utime.c b/lib/utime.c
deleted file mode 100644
index b5d3aa5..0000000
--- a/lib/utime.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1998, 2001-2004, 2006, 2009-2010 Free Software Foundation,
- * Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 3 of the License, or any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* derived from a function in touch.c */
-
-#include <config.h>
-#undef utime
-
-#include <sys/types.h>
-
-#ifdef HAVE_UTIME_H
-# include <utime.h>
-#endif
-
-#if !HAVE_UTIMES_NULL
-# include <sys/stat.h>
-# include <fcntl.h>
-#endif
-
-#include <unistd.h>
-#include <errno.h>
-
-#include "full-write.h"
-#include "safe-read.h"
-
-/* Some systems (even some that do have <utime.h>) don't declare this
-   structure anywhere.  */
-#ifndef HAVE_STRUCT_UTIMBUF
-struct utimbuf
-{
-  long actime;
-  long modtime;
-};
-#endif
-
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
-/* Emulate utime (file, NULL) for systems (like 4.3BSD) that do not
-   interpret it to set the access and modification times of FILE to
-   the current time.  Return 0 if successful, -1 if not. */
-
-static int
-utime_null (const char *file)
-{
-#if HAVE_UTIMES_NULL
-  return utimes (file, 0);
-#else
-  int fd;
-  char c;
-  int status = 0;
-  struct stat st;
-  int saved_errno = 0;
-
-  fd = open (file, O_RDWR);
-  if (fd < 0
-      || fstat (fd, &st) < 0
-      || safe_read (fd, &c, sizeof c) == SAFE_READ_ERROR
-      || lseek (fd, (off_t) 0, SEEK_SET) < 0
-      || full_write (fd, &c, sizeof c) != sizeof c
-      /* Maybe do this -- it's necessary on SunOS 4.1.3 with some combination
-         of patches, but that system doesn't use this code: it has utimes.
-         || fsync (fd) < 0
-      */
-      || (st.st_size == 0 && ftruncate (fd, st.st_size) < 0))
-    {
-      saved_errno = errno;
-      status = -1;
-    }
-
-  if (0 <= fd)
-    {
-      if (close (fd) < 0)
-        status = -1;
-
-      /* If there was a prior failure, use the saved errno value.
-         But if the only failure was in the close, don't change errno.  */
-      if (saved_errno)
-        errno = saved_errno;
-    }
-
-  return status;
-#endif
-}
-
-int
-rpl_utime (const char *file, const struct utimbuf *times)
-{
-  if (times)
-    return utime (file, times);
-
-  return utime_null (file);
-}
diff --git a/m4/utime.m4 b/m4/utime.m4
deleted file mode 100644
index 08caa4e..0000000
--- a/m4/utime.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-# serial 9
-
-dnl From Jim Meyering
-dnl Replace the utime function on systems that need it.
-
-# Copyright (C) 1998, 2000-2001, 2003-2004, 2009-2010 Free Software Foundation,
-# Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl FIXME
-
-AC_DEFUN([gl_FUNC_UTIME],
-[
-  AC_REQUIRE([AC_FUNC_UTIME_NULL])
-  if test $ac_cv_func_utime_null = no; then
-    AC_LIBOBJ([utime])
-    AC_DEFINE([utime], [rpl_utime],
-      [Define to rpl_utime if the replacement function should be used.])
-    gl_PREREQ_UTIME
-  fi
-])
-
-# Prerequisites of lib/utime.c.
-AC_DEFUN([gl_PREREQ_UTIME],
-[
-  AC_CHECK_HEADERS_ONCE([utime.h])
-  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF])
-  gl_FUNC_UTIMES_NULL
-])
-
-# Use the definition of AC_FUNC_UTIME_NULL from autoconf 2.64 or newer.
-# Remove this macro when we can assume autoconf >= 2.64.
-m4_version_prereq([2.64], [], [
-AC_DEFUN([AC_FUNC_UTIME_NULL],
-[AC_CHECK_HEADERS_ONCE([utime.h])
-AC_CACHE_CHECK([whether utime accepts a null argument], 
[ac_cv_func_utime_null],
-[rm -f conftest.data; >conftest.data
-# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
-AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
-               #ifdef HAVE_UTIME_H
-               # include <utime.h>
-               #endif],
-[[struct stat s, t;
-  return ! (stat ("conftest.data", &s) == 0
-            && utime ("conftest.data", 0) == 0
-            && stat ("conftest.data", &t) == 0
-            && t.st_mtime >= s.st_mtime
-            && t.st_mtime - s.st_mtime < 120);]])],
-              ac_cv_func_utime_null=yes,
-              ac_cv_func_utime_null=no,
-              ac_cv_func_utime_null='guessing yes')])
-if test "x$ac_cv_func_utime_null" != xno; then
-  ac_cv_func_utime_null=yes
-  AC_DEFINE([HAVE_UTIME_NULL], [1],
-            [Define to 1 if `utime(file, NULL)' sets file's timestamp to the
-             present.])
-fi
-rm -f conftest.data
-])
-])
diff --git a/m4/utimes-null.m4 b/m4/utimes-null.m4
deleted file mode 100644
index bcb5eb1..0000000
--- a/m4/utimes-null.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-# serial 9
-
-# Copyright (C) 1998-1999, 2001, 2003-2004, 2006, 2009-2010 Free Software
-# Foundation, Inc.
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
-dnl then do case-insensitive s/utime/utimes/.
-
-AC_DEFUN([gl_FUNC_UTIMES_NULL],
-[AC_CACHE_CHECK([whether utimes accepts a null argument], 
[ac_cv_func_utimes_null],
-[rm -f conftest.data; > conftest.data
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-/* In case stat has been defined to rpl_stat, undef it here.  */
-#undef stat
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-int
-main () {
-struct stat s, t;
-return ! (stat ("conftest.data", &s) == 0
-          && utimes ("conftest.data", 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
-  ]
-)
diff --git a/modules/utime b/modules/utime
deleted file mode 100644
index 56ed8ef..0000000
--- a/modules/utime
+++ /dev/null
@@ -1,38 +0,0 @@
-Description:
-utime() function: change access and/or modification times of a file.
-
-Status:
-obsolete
-
-Notice:
-This module is obsolete. It can be removed on 2010-01-01.
-
-Files:
-lib/utime.c
-m4/utimbuf.m4
-m4/utime.m4
-m4/utimes.m4
-m4/utimes-null.m4
-
-Depends-on:
-open
-full-write
-safe-read
-
-configure.ac:
-gl_FUNC_UTIME
-
-Makefile.am:
-
-Include:
-#if HAVE_UTIME_H
-# include <utime.h>
-#else
-# include <sys/utime.h>
-#endif
-
-License:
-GPL
-
-Maintainer:
-Jim Meyering
--
1.7.0.1.475.gaf89b




reply via email to

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