Mercurial > hg > octave-lyh > gnulib-hg
changeset 12909:86f1ff71881a
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".
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Thu, 04 Mar 2010 15:36:51 +0100 |
parents | 13e6892eb21b |
children | 78fe2e4f8745 |
files | ChangeLog MODULES.html.sh doc/posix-functions/utime.texi lib/utime.c m4/utime.m4 m4/utimes-null.m4 modules/utime |
diffstat | 7 files changed, 19 insertions(+), 255 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-03-04 Jim Meyering <meyering@redhat.com> + + 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 <simon@josefsson.org> * modules/exit (License): Relax license to LGPLv2+.
--- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2370,7 +2370,6 @@ func_module tsearch func_module unistd func_module unlink - func_module utime func_module utimensat func_module vasnprintf-posix func_module vasprintf-posix
--- a/doc/posix-functions/utime.texi +++ b/doc/posix-functions/utime.texi @@ -4,17 +4,17 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/utime.html} -Gnulib module: utime +Gnulib module: --- Portability problems fixed by Gnulib: @itemize +@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. -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item On some platforms, this function mis-handles trailing slash: Solaris 9.
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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 -]) -])
deleted file mode 100644 --- 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 - ] -)
deleted file mode 100644 --- 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