From 95907a5453ae53daeeea0efab8e37904568c1844 Mon Sep 17 00:00:00 2001 From: Jim Meyering 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 6a5c340a2..8a4fcc7cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-03-04 Jim Meyering + + 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-05 Simon Josefsson * modules/exit (License): Relax license to LGPLv2+. diff --git a/MODULES.html.sh b/MODULES.html.sh index b3b912264..080c60a52 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 f50af81e1..7ffffc789 100644 --- a/doc/posix-functions/utime.texi +++ b/doc/posix-functions/utime.texi @@ -4,18 +4,18 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/utime.html} -Gnulib module: utime +Gnulib module: --- Portability problems 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. @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. +@item 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 b5d3aa56d..000000000 --- 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 . */ - -/* derived from a function in touch.c */ - -#include -#undef utime - -#include - -#ifdef HAVE_UTIME_H -# include -#endif - -#if !HAVE_UTIMES_NULL -# include -# include -#endif - -#include -#include - -#include "full-write.h" -#include "safe-read.h" - -/* Some systems (even some that do have ) 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 08caa4e70..000000000 --- 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 - #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 bcb5eb1f4..000000000 --- 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 -#include -#include -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 56ed8ef3c..000000000 --- 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 -#else -# include -#endif - -License: -GPL - -Maintainer: -Jim Meyering -- 2.11.0