diff options
author | Colin Watson <cjwatson@debian.org> | 2014-09-08 23:55:19 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-09-10 22:44:11 +0100 |
commit | d9ebedad152816ea2ee8725a0ee1b0f80f7aeb46 (patch) | |
tree | 9280ed3f23f125ee13cfaed30f7f6727a580f75e /gnulib | |
parent | cfd69ae971f1b23887ace7806b4fcd8281be1d2c (diff) |
Move database mtime out of the database into file metadata
This makes the database reproducible between installations, as long
as the underlying database has predictable behaviour and the set of
installed manual pages (including their timestamps) remains
identical. As a bonus, we now use high-precision times in several
places.
Fixes Debian bug #760895.
* gnulib: Import futimens and timespec modules.
* libdb/db_btree.c (btree_get_time, btree_set_time): New functions.
* libdb/db_gdbm.c (man_gdbm_get_time, man_gdbm_set_time): New
functions.
* libdb/db_ndbm.c (ndbm_get_time, ndbm_set_time): New functions.
* libdb/mydbm.h (man_gdbm_get_time, man_gdbm_set_time,
ndbm_get_time, ndbm_set_time, btree_get_time, btree_set_time): Add
prototypes.
(MYDBM_GET_TIME, MYDBM_SET_TIME): New macros.
* src/check_mandirs.c (testmandirs, create_db, count_glob_matches,
purge_normal, purge_whatis, purge_missing): Use high-precision
times.
(update_db_time): Set file modification times rather than updating a
database row.
(create_db, purge_missing): Get database file modification times
rather than fetching a database row.
(purge_missing): If the new will_run_mandb argument is true, reset
the database mtime to its value before purging; this ensures that
mandb will still run as expected afterwards.
* src/check_mandirs.h (purge_missing): Update prototype.
* src/mandb.c (xcopy): Copy access and modification times.
(process_manpath): Work out in advance of purging whether we will
need to run mandb, and pass that to purge_missing.
* include/manconfig.h.in (VER_ID): Bump to 2.5.0.
(KEY): Remove.
* man/man8/accessdb.man8 (DESCRIPTION), man/it/man8/accessdb.man8
(DESCRIZIONE): Remove sample output, as it is of limited usefulness
compared to how awkward it is to maintain, especially in text
intended for translation.
* man/po4a/po/man-db-manpages.pot, man/po4a/po/*.po: Update.
* manual/db.me (Contents of an index database): Remove mention of
$mtime$.
(Example database): Remove $mtime$. Update $version.
* NEWS: Document this. Bump version to 2.7.0 to correspond to the
database version change.
Diffstat (limited to 'gnulib')
-rw-r--r-- | gnulib/lib/Makefile.am | 11 | ||||
-rw-r--r-- | gnulib/lib/Makefile.in | 37 | ||||
-rw-r--r-- | gnulib/lib/futimens.c | 37 | ||||
-rw-r--r-- | gnulib/m4/futimens.m4 | 59 | ||||
-rw-r--r-- | gnulib/m4/gnulib-cache.m4 | 4 | ||||
-rw-r--r-- | gnulib/m4/gnulib-comp.m4 | 8 |
6 files changed, 137 insertions, 19 deletions
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am index 742c19bb..b4519fe2 100644 --- a/gnulib/lib/Makefile.am +++ b/gnulib/lib/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat futimens getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep timespec unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects @@ -564,6 +564,15 @@ EXTRA_libgnu_la_SOURCES += at-func.c fstatat.c ## end gnulib module fstatat +## begin gnulib module futimens + + +EXTRA_DIST += futimens.c + +EXTRA_libgnu_la_SOURCES += futimens.c + +## end gnulib module futimens + ## begin gnulib module getcwd diff --git a/gnulib/lib/Makefile.in b/gnulib/lib/Makefile.in index 63868453..a89bf626 100644 --- a/gnulib/lib/Makefile.in +++ b/gnulib/lib/Makefile.in @@ -35,7 +35,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat futimens getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep timespec unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf @@ -150,6 +150,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/man-bdb.m4 \ $(top_srcdir)/gnulib/m4/fnmatch.m4 \ $(top_srcdir)/gnulib/m4/fstat.m4 \ $(top_srcdir)/gnulib/m4/fstatat.m4 \ + $(top_srcdir)/gnulib/m4/futimens.m4 \ $(top_srcdir)/gnulib/m4/getcwd-abort-bug.m4 \ $(top_srcdir)/gnulib/m4/getcwd-path-max.m4 \ $(top_srcdir)/gnulib/m4/getcwd.m4 \ @@ -1394,9 +1395,9 @@ EXTRA_DIST = alloca.c alloca.in.h areadlink.h openat-priv.h \ fchdir.c fcntl.c fcntl.in.h fd-hook.h fdopendir.c file-set.h \ filename.h filenamecat.h float.c float.in.h itold.c flock.c \ fnmatch.c fnmatch.in.h fnmatch_loop.c fstat.c at-func.c \ - fstatat.c getcwd.c getcwd-lgpl.c getdelim.c getdtablesize.c \ - getline.c getlogin_r.c getopt.c getopt.in.h getopt1.c \ - getopt_int.h $(top_srcdir)/build-aux/config.rpath \ + fstatat.c futimens.c getcwd.c getcwd-lgpl.c getdelim.c \ + getdtablesize.c getline.c getlogin_r.c getopt.c getopt.in.h \ + getopt1.c getopt_int.h $(top_srcdir)/build-aux/config.rpath \ gettimeofday.c $(top_srcdir)/build-aux/gitlog-to-changelog \ glob-libc.h glob.c glob.in.h $(top_srcdir)/build-aux/gnupload \ hash.h hash-triple.h $(top_srcdir)/build-aux/config.rpath \ @@ -1489,19 +1490,20 @@ EXTRA_libgnu_la_SOURCES = alloca.c openat-proc.c btowc.c \ canonicalize-lgpl.c chdir-long.c close.c closedir.c dirfd.c \ stripslash.c dup.c dup2.c error.c fchdir.c fcntl.c fdopendir.c \ float.c itold.c flock.c fnmatch.c fnmatch_loop.c fstat.c \ - at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdelim.c \ - getdtablesize.c getline.c getlogin_r.c getopt.c getopt1.c \ - gettimeofday.c glob.c localeconv.c lstat.c malloc.c malloc.c \ - mbrtowc.c mbsinit.c mbsrtowcs-state.c mbsrtowcs.c mbtowc.c \ - memchr.c mempcpy.c memrchr.c mkdtemp.c mkstemp.c msvc-inval.c \ - msvc-nothrow.c nl_langinfo.c open.c openat.c opendir.c raise.c \ - rawmemchr.c readdir.c readlink.c realloc.c regcomp.c regex.c \ - regex_internal.c regexec.c rename.c rewinddir.c rmdir.c \ - secure_getenv.c setenv.c sigaction.c sigprocmask.c sleep.c \ - stat.c strcasecmp.c strncasecmp.c strchrnul.c strdup.c \ - strerror.c strerror-override.c strndup.c strnlen.c strsep.c \ - unsetenv.c asnprintf.c printf-args.c printf-parse.c \ - vasnprintf.c asprintf.c vasprintf.c vsnprintf.c wcrtomb.c + at-func.c fstatat.c futimens.c getcwd.c getcwd-lgpl.c \ + getdelim.c getdtablesize.c getline.c getlogin_r.c getopt.c \ + getopt1.c gettimeofday.c glob.c localeconv.c lstat.c malloc.c \ + malloc.c mbrtowc.c mbsinit.c mbsrtowcs-state.c mbsrtowcs.c \ + mbtowc.c memchr.c mempcpy.c memrchr.c mkdtemp.c mkstemp.c \ + msvc-inval.c msvc-nothrow.c nl_langinfo.c open.c openat.c \ + opendir.c raise.c rawmemchr.c readdir.c readlink.c realloc.c \ + regcomp.c regex.c regex_internal.c regexec.c rename.c \ + rewinddir.c rmdir.c secure_getenv.c setenv.c sigaction.c \ + sigprocmask.c sleep.c stat.c strcasecmp.c strncasecmp.c \ + strchrnul.c strdup.c strerror.c strerror-override.c strndup.c \ + strnlen.c strsep.c unsetenv.c asnprintf.c printf-args.c \ + printf-parse.c vasnprintf.c asprintf.c vasprintf.c vsnprintf.c \ + wcrtomb.c libgnu_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(LIB_CLOCK_GETTIME) \ $(LTLIBINTL) $(LTLIBTHREAD) @@ -1637,6 +1639,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnmatch_loop.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/futimens.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdelim.Plo@am__quote@ diff --git a/gnulib/lib/futimens.c b/gnulib/lib/futimens.c new file mode 100644 index 00000000..96c0b73e --- /dev/null +++ b/gnulib/lib/futimens.c @@ -0,0 +1,37 @@ +/* Set the access and modification time of an open fd. + Copyright (C) 2009-2014 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 + (at your option) 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/>. */ + +/* written by Eric Blake */ + +#include <config.h> + +#include <sys/stat.h> + +#include "utimens.h" + +/* Set the access and modification time stamps of FD to be + TIMESPEC[0] and TIMESPEC[1], respectively. + Fail with ENOSYS on systems without futimes (or equivalent). + If TIMESPEC is null, set the time stamps to the current time. + Return 0 on success, -1 (setting errno) on failure. */ +int +futimens (int fd, struct timespec const times[2]) +{ + /* fdutimens also works around bugs in native futimens, when running + with glibc compiled against newer headers but on a Linux kernel + older than 2.6.32. */ + return fdutimens (fd, NULL, times); +} diff --git a/gnulib/m4/futimens.m4 b/gnulib/m4/futimens.m4 new file mode 100644 index 00000000..39798137 --- /dev/null +++ b/gnulib/m4/futimens.m4 @@ -0,0 +1,59 @@ +# serial 6 +# See if we need to provide futimens replacement. + +dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Written by Eric Blake. + +AC_DEFUN([gl_FUNC_FUTIMENS], +[ + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_FUNCS_ONCE([futimens]) + if test $ac_cv_func_futimens = no; then + HAVE_FUTIMENS=0 + else + AC_CACHE_CHECK([whether futimens works], + [gl_cv_func_futimens_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> +#include <errno.h> +]], [[struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } }; + int fd = creat ("conftest.file", 0600); + struct stat st; + if (fd < 0) return 1; + errno = 0; + if (futimens (AT_FDCWD, NULL) == 0) return 2; + if (errno != EBADF) return 3; + if (futimens (fd, ts)) return 4; + sleep (1); + ts[0].tv_nsec = UTIME_NOW; + ts[1].tv_nsec = UTIME_OMIT; + if (futimens (fd, ts)) return 5; + if (fstat (fd, &st)) return 6; + if (st.st_ctime < st.st_atime) return 7; + ]])], +dnl FIXME: simplify this in 2012, when file system bugs are no longer common + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef __linux__ +/* The Linux kernel added futimens in 2.6.22, but has bugs with UTIME_OMIT + in several file systems as recently as 2.6.32. Always replace futimens + to support older kernels. */ +choke me +#endif + ]])], + [gl_cv_func_futimens_works=yes], + [gl_cv_func_futimens_works="needs runtime check"])], + [gl_cv_func_futimens_works=no], + [gl_cv_func_futimens_works="guessing no"]) + rm -f conftest.file]) + if test "$gl_cv_func_futimens_works" != yes; then + REPLACE_FUTIMENS=1 + fi + fi +]) diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4 index af265ab8..40df1e59 100644 --- a/gnulib/m4/gnulib-cache.m4 +++ b/gnulib/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf +# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --po-base=gnulib/po --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl --po-domain=man-db --no-vc-files argp canonicalize closedir dirname error flock fnmatch-gnu fstat futimens getline getopt-gnu gettext gitlog-to-changelog glob gnupload idpriv-drop idpriv-droptemp lib-ignore localcharset lock minmax mkdtemp mkstemp opendir regex rename setenv sigaction signal sigprocmask stat-time strerror strsep timespec unsetenv utimens warnings xalloc xgetcwd xstrndup xvasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -40,6 +40,7 @@ gl_MODULES([ flock fnmatch-gnu fstat + futimens getline getopt-gnu gettext @@ -64,6 +65,7 @@ gl_MODULES([ stat-time strerror strsep + timespec unsetenv utimens warnings diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4 index e6fd7a01..1463c38f 100644 --- a/gnulib/m4/gnulib-comp.m4 +++ b/gnulib/m4/gnulib-comp.m4 @@ -87,6 +87,7 @@ AC_DEFUN([gl_EARLY], # Code from module fnmatch-gnu: # Code from module fstat: # Code from module fstatat: + # Code from module futimens: # Code from module getcwd: # Code from module getcwd-lgpl: # Code from module getdelim: @@ -371,6 +372,11 @@ AC_SUBST([LTALLOCA]) AC_LIBOBJ([fstatat]) fi gl_SYS_STAT_MODULE_INDICATOR([fstatat]) + gl_FUNC_FUTIMENS + if test $HAVE_FUTIMENS = 0 || test $REPLACE_FUTIMENS = 1; then + AC_LIBOBJ([futimens]) + fi + gl_SYS_STAT_MODULE_INDICATOR([futimens]) gl_FUNC_GETCWD if test $REPLACE_GETCWD = 1; then AC_LIBOBJ([getcwd]) @@ -972,6 +978,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/fnmatch_loop.c lib/fstat.c lib/fstatat.c + lib/futimens.c lib/getcwd-lgpl.c lib/getcwd.c lib/getdelim.c @@ -1179,6 +1186,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/fnmatch.m4 m4/fstat.m4 m4/fstatat.m4 + m4/futimens.m4 m4/getcwd-abort-bug.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 |