[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] merged sub-second file system changes from GNU tar to gnulib a
From: |
Paul Eggert |
Subject: |
[Bug-tar] merged sub-second file system changes from GNU tar to gnulib and back |
Date: |
Fri, 16 Sep 2005 00:08:54 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
I merged some of the sub-second file system changes from GNU tar into
gnulib and back, so that coreutils can use these changes. This
resulted in the following minor changes to GNU tar proper. A
bootstrap is needed after applying these changes.
2005-09-16 Paul Eggert <address@hidden>
Merge changes from gnulib for file system sub-second time stamps.
* configure.ac: Remove checks for struct stat.st_spare1, struct
stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct
stat.st_atimensec, as gnulib now does this for us.
Similarly for LIB_CLOCK_GETTIME.
* paxutils/configure.ac: Likewise.
* gnulib.modules: Add stat-time.
* lib/.cvsignore: Add stat-time.h.
* src/common.h: Include stat-time.h.
(timespec_lt): Remove. All callers changed to use timespec_cmp.
(get_stat_atime, get_stat_ctime, get_stat_mtime):
(set_stat_atime, set_stat_ctime, set_stat_mtime):
Remove; now defined by stat-time.h.
Index: configure.ac
===================================================================
RCS file: /cvsroot/tar/tar/configure.ac,v
retrieving revision 1.59
diff -p -u -r1.59 configure.ac
--- configure.ac 13 Jun 2005 12:53:25 -0000 1.59
+++ configure.ac 16 Sep 2005 07:02:55 -0000
@@ -88,27 +88,6 @@ tar_GNULIB
# paxutils modules
tar_PAXUTILS
-AC_CHECK_MEMBERS([struct stat.st_spare1, struct stat.st_atim.tv_nsec, struct
stat.st_atimespec.tv_nsec, struct stat.st_atimensec], , ,
- [
-#include <sys/types.h>
-#include <sys/stat.h>])
-
-# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
-# programs in the package would end up linked with that potentially-shared
-# library, inducing unnecessary run-time overhead.
-
-# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
-# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-tar_save_LIBS=$LIBS
- LIB_CLOCK_GETTIME=
- AC_SEARCH_LIBS(clock_gettime, [rt posix4])
- case "$ac_cv_search_clock_gettime" in
- -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
- esac
- AC_SUBST(LIB_CLOCK_GETTIME)
- AC_CHECK_FUNCS(clock_gettime)
-LIBS=$tar_save_LIBS
-
AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
Index: gnulib.modules
===================================================================
RCS file: /cvsroot/tar/tar/gnulib.modules,v
retrieving revision 1.4
diff -p -u -r1.4 gnulib.modules
--- gnulib.modules 3 Sep 2005 10:24:45 -0000 1.4
+++ gnulib.modules 16 Sep 2005 07:02:55 -0000
@@ -32,6 +32,7 @@ safe-read
save-cwd
savedir
setenv
+stat-time
stdbool
stpcpy
strdup
Index: lib/.cvsignore
===================================================================
RCS file: /cvsroot/tar/tar/lib/.cvsignore,v
retrieving revision 1.24
diff -p -u -r1.24 .cvsignore
--- lib/.cvsignore 12 Sep 2005 18:46:26 -0000 1.24
+++ lib/.cvsignore 16 Sep 2005 07:02:55 -0000
@@ -132,6 +132,7 @@ setenv.c
setenv.h
size_max.h
stat-macros.h
+stat-time.h
stdbool.h
stdbool_.h
stpcpy.c
Index: src/common.h
===================================================================
RCS file: /cvsroot/tar/tar/src/common.h,v
retrieving revision 1.57
diff -p -u -r1.57 common.h
--- src/common.h 14 Sep 2005 13:25:41 -0000 1.57
+++ src/common.h 16 Sep 2005 07:02:55 -0000
@@ -55,6 +55,7 @@
#include <modechange.h>
#include <quote.h>
#include <safe-read.h>
+#include <stat-time.h>
#include <timespec.h>
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@@ -188,15 +189,7 @@ GLOBAL struct timespec newer_mtime_optio
/* Return true if the struct stat ST's M time is less than
newer_mtime_option. */
#define OLDER_STAT_TIME(st, m) \
- timespec_lt (get_stat_##m##time (&st), newer_mtime_option)
-
-/* Return true if A < B. */
-static inline bool
-timespec_lt (struct timespec a, struct timespec b)
-{
- return (a.tv_sec < b.tv_sec
- || (a.tv_sec == b.tv_sec && a.tv_nsec < b.tv_nsec));
-}
+ (timespec_cmp (get_stat_##m##time (&st), newer_mtime_option) < 0)
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
GLOBAL int recursion_option;
@@ -646,120 +639,3 @@ bool sparse_diff_file (int, struct tar_s
/* Module utf8.c */
bool string_ascii_p (const char *str);
bool utf8_convert (bool to_utf, char const *input, char **output);
-
-
-/* FIXME: The following should get moved into gnulib. */
-
-static inline struct timespec
-get_stat_atime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_atim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_atimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_atime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_atimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline struct timespec
-get_stat_ctime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_ctim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_ctimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_ctime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_ctimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline struct timespec
-get_stat_mtime (struct stat const *st)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- return st->st_mtim;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- return st->st_mtimespec;
-#else
- struct timespec t;
- t.tv_sec = st->st_mtime;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- t.tv_nsec = st->stat.st_mtimensec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- t.tv_nsec = st->stat.st_spare1 * 1000;
-# else
- t.tv_nsec = 0;
-# endif
- return t;
-#endif
-}
-
-static inline void
-set_stat_atime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_atim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_atimespec = t;
-#else
- st->st_atime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_atimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}
-
-static inline void
-set_stat_ctime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_ctim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_ctimespec = t;
-#else
- st->st_ctime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_ctimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}
-
-static inline void
-set_stat_mtime (struct stat *st, struct timespec t)
-{
-#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
- st->st_mtim = t;
-#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
- st->st_mtimespec = t;
-#else
- st->st_mtime = t.tv_sec;
-# if defined HAVE_STRUCT_STAT_ST_ATIMENSEC
- st->stat.st_mtimensec = t.tv_nsec;
-# elif defined HAVE_STRUCT_STAT_ST_SPARE1
- st->stat.st_spare1 = t.tv_nsec / 1000;
-# endif
-#endif
-}
Index: src/extract.c
===================================================================
RCS file: /cvsroot/tar/tar/src/extract.c,v
retrieving revision 1.79
diff -p -u -r1.79 extract.c
--- src/extract.c 12 Sep 2005 18:45:59 -0000 1.79
+++ src/extract.c 16 Sep 2005 07:02:55 -0000
@@ -200,11 +200,11 @@ check_time (char const *file_name, struc
if (t.tv_sec <= 0)
WARN ((0, 0, _("%s: implausibly old time stamp %s"),
file_name, tartime (t, true)));
- else if (timespec_lt (start_time, t))
+ else if (timespec_cmp (start_time, t) < 0)
{
struct timespec now;
gettime (&now);
- if (timespec_lt (now, t))
+ if (timespec_cmp (now, t) < 0)
{
unsigned long int ds = t.tv_sec - now.tv_sec;
int dns = t.tv_nsec - now.tv_nsec;
Index: paxutils/configure.ac
===================================================================
RCS file: /cvsroot/paxutils/paxutils/configure.ac,v
retrieving revision 1.2
diff -p -u -r1.2 configure.ac
--- paxutils/configure.ac 15 May 2005 06:34:48 -0000 1.2
+++ paxutils/configure.ac 16 Sep 2005 07:03:01 -0000
@@ -90,27 +90,6 @@ PU_RMT
PU_RTAPELIB
PU_SYSTEM
-AC_CHECK_MEMBERS([struct stat.st_spare1, struct stat.st_atim.tv_nsec, struct
stat.st_atimespec.tv_nsec, struct stat.st_atimensec], , ,
- [
-#include <sys/types.h>
-#include <sys/stat.h>])
-
-# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
-# programs in the package would end up linked with that potentially-shared
-# library, inducing unnecessary run-time overhead.
-
-# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
-# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-tar_save_LIBS=$LIBS
- LIB_CLOCK_GETTIME=
- AC_SEARCH_LIBS(clock_gettime, [rt posix4])
- case "$ac_cv_search_clock_gettime" in
- -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
- esac
- AC_SUBST(LIB_CLOCK_GETTIME)
- AC_CHECK_FUNCS(clock_gettime)
-LIBS=$tar_save_LIBS
-
AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
@@ -238,7 +217,7 @@ AM_GNU_GETTEXT_VERSION(0.12.1)
# Initialize the test suite.
# AC_CONFIG_TESTDIR(tests)
-# AC_CONFIG_FILES([tests/Makefile tests/atlocal])
+# AC_CONFIG_FILES([tests/Makefile tests/atlocal])
AM_MISSING_PROG([AUTOM4TE], [autom4te])
AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
@@ -265,4 +244,3 @@ AC_OUTPUT([Makefile\
paxlib/Makefile\
po/Makefile.in\
paxtest/Makefile])
-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-tar] merged sub-second file system changes from GNU tar to gnulib and back,
Paul Eggert <=