Imported Upstream version 2.7.4 upstream/2.7.4
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 20 Jan 2022 05:18:05 +0000 (14:18 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 20 Jan 2022 05:18:05 +0000 (14:18 +0900)
428 files changed:
.tarball-version
ChangeLog
GNUmakefile
INSTALL
Makefile.in
NEWS
TODO [new file with mode: 0644]
aclocal.m4
build-aux/config.guess
build-aux/config.sub
build-aux/depcomp
build-aux/git-version-gen
build-aux/gitlog-to-changelog
build-aux/mdate-sh
build-aux/snippet/arg-nonnull.h
build-aux/snippet/c++defs.h
build-aux/snippet/warn-on-use.h
build-aux/texinfo.tex
build-aux/update-copyright
build-aux/useless-if-before-free
build-aux/vc-list-files
config.hin
configure
lib/Makefile.in
lib/alloca.in.h
lib/argmatch.c
lib/argmatch.h
lib/asnprintf.c
lib/asprintf.c
lib/assure.h [new file with mode: 0644]
lib/at-func.c [new file with mode: 0644]
lib/at-func2.c [new file with mode: 0644]
lib/backupfile.c
lib/backupfile.h
lib/basename-lgpl.c
lib/basename.c
lib/bitrotate.h
lib/c-ctype.c
lib/c-ctype.h
lib/c-strcase.h
lib/c-strcasecmp.c
lib/c-strcaseeq.h
lib/c-strncasecmp.c
lib/canonicalize-lgpl.c
lib/chdir-long.c [new file with mode: 0644]
lib/chdir-long.h [new file with mode: 0644]
lib/chmodat.c [new file with mode: 0644]
lib/chown.c [new file with mode: 0644]
lib/chownat.c [new file with mode: 0644]
lib/cloexec.c [new file with mode: 0644]
lib/cloexec.h [new file with mode: 0644]
lib/close.c
lib/closedir.c
lib/config.charset
lib/diffseq.h
lib/dirent--.h
lib/dirent-private.h
lib/dirent-safer.h
lib/dirent.in.h
lib/dirfd.c
lib/dirname-lgpl.c
lib/dirname.c
lib/dirname.h
lib/dosname.h
lib/dup-safer.c
lib/dup2.c
lib/errno.in.h
lib/error.c
lib/error.h
lib/exitfail.c
lib/exitfail.h
lib/fchdir.c [new file with mode: 0644]
lib/fchmodat.c [new file with mode: 0644]
lib/fchown-stub.c [new file with mode: 0644]
lib/fchownat.c [new file with mode: 0644]
lib/fcntl.c
lib/fcntl.in.h
lib/fd-hook.c
lib/fd-hook.h
lib/fd-safer.c
lib/filename.h
lib/filenamecat-lgpl.c [new file with mode: 0644]
lib/filenamecat.h [new file with mode: 0644]
lib/float+.h
lib/float.c
lib/float.in.h
lib/fstat.c
lib/fstatat.c [new file with mode: 0644]
lib/full-write.c
lib/full-write.h
lib/getcwd-lgpl.c [new file with mode: 0644]
lib/getdtablesize.c
lib/getopt.c
lib/getopt.in.h
lib/getopt1.c
lib/getopt_int.h
lib/gettext.h
lib/gettime.c
lib/gettimeofday.c
lib/gl_anylinked_list1.h
lib/gl_anylinked_list2.h
lib/gl_linked_list.c
lib/gl_linked_list.h
lib/gl_list.h
lib/gl_xlist.h
lib/gnulib.mk
lib/hash.c
lib/hash.h
lib/ignore-value.h
lib/intprops.h
lib/itold.c
lib/lchown.c [new file with mode: 0644]
lib/localcharset.c
lib/localcharset.h
lib/lstat.c
lib/malloc.c
lib/malloca.c
lib/malloca.h
lib/mbrtowc.c
lib/mbsinit.c
lib/memchr.c
lib/mempcpy.c [new file with mode: 0644]
lib/memrchr.c [new file with mode: 0644]
lib/minmax.h
lib/mkdir.c
lib/mkdirat.c [new file with mode: 0644]
lib/mktime.c
lib/msvc-inval.c
lib/msvc-inval.h
lib/msvc-nothrow.c
lib/msvc-nothrow.h
lib/open.c [new file with mode: 0644]
lib/openat-die.c [new file with mode: 0644]
lib/openat-priv.h [new file with mode: 0644]
lib/openat-proc.c [new file with mode: 0644]
lib/openat.c [new file with mode: 0644]
lib/openat.h [new file with mode: 0644]
lib/opendir-safer.c
lib/opendir.c
lib/parse-datetime.c
lib/parse-datetime.h
lib/parse-datetime.y
lib/pathmax.h
lib/pipe-safer.c
lib/printf-args.c
lib/printf-args.h
lib/printf-parse.c
lib/printf-parse.h
lib/progname.c
lib/progname.h
lib/quote.h
lib/quotearg.c
lib/quotearg.h
lib/raise.c
lib/readdir.c
lib/readlink.c
lib/readlinkat.c [new file with mode: 0644]
lib/realloc.c
lib/ref-add.sin
lib/ref-del.sin
lib/rename.c
lib/renameat.c [new file with mode: 0644]
lib/rmdir.c
lib/safe-read.c
lib/safe-write.c
lib/safe-write.h
lib/same-inode.h
lib/save-cwd.c [new file with mode: 0644]
lib/save-cwd.h [new file with mode: 0644]
lib/secure_getenv.c
lib/setenv.c
lib/signal.in.h
lib/size_max.h
lib/stat-time.h
lib/stat.c
lib/statat.c [new file with mode: 0644]
lib/stdarg.in.h
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/strdup.c [new file with mode: 0644]
lib/streq.h
lib/strerror-override.c
lib/strerror-override.h
lib/strerror.c
lib/string.in.h
lib/stripslash.c
lib/strndup.c
lib/strnlen.c
lib/symlink.c
lib/symlinkat.c [new file with mode: 0644]
lib/sys_stat.in.h
lib/sys_time.in.h
lib/sys_types.in.h
lib/tempname.c
lib/tempname.h
lib/time.in.h
lib/time_r.c
lib/timespec.h
lib/unistd--.h
lib/unistd-safer.h
lib/unistd.in.h
lib/unlink.c
lib/unlinkat.c [new file with mode: 0644]
lib/unsetenv.c
lib/utimens.c
lib/utimens.h
lib/utimensat.c [new file with mode: 0644]
lib/vasnprintf.c
lib/vasnprintf.h
lib/vasprintf.c
lib/verify.h
lib/verror.c
lib/verror.h
lib/wchar.in.h
lib/wctype.in.h
lib/write.c
lib/xalloc-die.c
lib/xalloc-oversized.h
lib/xalloc.h
lib/xasprintf.c
lib/xmalloc.c
lib/xmemdup0.c
lib/xmemdup0.h
lib/xsize.h
lib/xstrndup.c
lib/xstrndup.h
lib/xvasprintf.c
lib/xvasprintf.h
m4/00gnulib.m4
m4/absolute-header.m4
m4/alloca.m4
m4/backupfile.m4
m4/bison.m4
m4/canonicalize.m4
m4/chdir-long.m4 [new file with mode: 0644]
m4/chown.m4 [new file with mode: 0644]
m4/clock_time.m4
m4/close.m4
m4/closedir.m4
m4/codeset.m4
m4/configmake.m4
m4/d-ino.m4
m4/dirent-safer.m4
m4/dirent_h.m4
m4/dirfd.m4
m4/dirname.m4
m4/double-slash-root.m4
m4/dup2.m4
m4/eealloc.m4
m4/environ.m4
m4/errno_h.m4
m4/error.m4
m4/exponentd.m4
m4/extensions.m4
m4/extern-inline.m4
m4/fchdir.m4 [new file with mode: 0644]
m4/fchmodat.m4 [new file with mode: 0644]
m4/fchownat.m4 [new file with mode: 0644]
m4/fcntl-o.m4
m4/fcntl.m4
m4/fcntl_h.m4
m4/filenamecat.m4 [new file with mode: 0644]
m4/float_h.m4
m4/fstat.m4
m4/fstatat.m4 [new file with mode: 0644]
m4/getcwd.m4 [new file with mode: 0644]
m4/getdtablesize.m4
m4/getopt.m4
m4/gettime.m4
m4/gettimeofday.m4
m4/glibc21.m4
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/include_next.m4
m4/intmax_t.m4
m4/inttypes_h.m4
m4/largefile.m4
m4/lchmod.m4 [deleted file]
m4/lchown.m4 [new file with mode: 0644]
m4/localcharset.m4
m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/longlong.m4
m4/lstat.m4
m4/malloc.m4
m4/malloca.m4
m4/manywarnings.m4
m4/mbrtowc.m4
m4/mbsinit.m4
m4/mbstate_t.m4
m4/memchr.m4
m4/mempcpy.m4 [new file with mode: 0644]
m4/memrchr.m4 [new file with mode: 0644]
m4/minmax.m4
m4/mkdir.m4
m4/mkdirat.m4 [new file with mode: 0644]
m4/mktime.m4
m4/mmap-anon.m4
m4/mode_t.m4 [new file with mode: 0644]
m4/msvc-inval.m4
m4/msvc-nothrow.m4
m4/multiarch.m4
m4/nocrash.m4
m4/off_t.m4
m4/open.m4 [new file with mode: 0644]
m4/openat.m4 [new file with mode: 0644]
m4/opendir.m4
m4/parse-datetime.m4
m4/pathmax.m4
m4/printf.m4
m4/quote.m4
m4/quotearg.m4
m4/raise.m4
m4/readdir.m4
m4/readlink.m4
m4/readlinkat.m4 [new file with mode: 0644]
m4/realloc.m4
m4/rename.m4
m4/renameat.m4 [new file with mode: 0644]
m4/rmdir.m4
m4/safe-read.m4
m4/safe-write.m4
m4/save-cwd.m4 [new file with mode: 0644]
m4/secure_getenv.m4
m4/setenv.m4
m4/signal_h.m4
m4/size_max.m4
m4/ssize_t.m4
m4/stat-time.m4
m4/stat.m4
m4/stdarg.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdint_h.m4
m4/stdio_h.m4
m4/stdlib_h.m4
m4/strdup.m4 [new file with mode: 0644]
m4/strerror.m4
m4/string_h.m4
m4/strndup.m4
m4/strnlen.m4
m4/symlink.m4
m4/symlinkat.m4 [new file with mode: 0644]
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
m4/sys_types_h.m4
m4/tempname.m4
m4/time_h.m4
m4/time_r.m4
m4/timespec.m4
m4/tm_gmtoff.m4
m4/unistd-safer.m4
m4/unistd_h.m4
m4/unlink.m4
m4/unlinkat.m4 [new file with mode: 0644]
m4/utimbuf.m4
m4/utimens.m4
m4/utimensat.m4 [new file with mode: 0644]
m4/utimes.m4
m4/vasnprintf.m4
m4/vasprintf.m4
m4/warn-on-use.m4
m4/warnings.m4
m4/wchar_h.m4
m4/wchar_t.m4
m4/wctype_h.m4
m4/wint_t.m4
m4/write.m4
m4/xalloc.m4
m4/xsize.m4
m4/xstrndup.m4
m4/xvasprintf.m4
maint.mk
src/Makefile.am
src/Makefile.in
src/inp.c
src/patch.c
src/pch.c
src/safe.c [new file with mode: 0644]
src/safe.h [new file with mode: 0644]
src/util.c
src/util.h
tests/Makefile.am
tests/Makefile.in
tests/asymmetric-hunks
tests/backup-prefix-suffix
tests/bad-usage
tests/concat-git-diff
tests/copy-rename
tests/corrupt-reject-files
tests/create-delete
tests/criss-cross
tests/crlf-handling
tests/dash-o-append
tests/deep-directories [new file with mode: 0755]
tests/empty-files
tests/fifo
tests/file-modes
tests/filename-choice
tests/garbage [new file with mode: 0644]
tests/git-binary-diff
tests/global-reject-files
tests/inname
tests/line-numbers
tests/mangled-numbers-abort
tests/merge
tests/mixed-patch-types
tests/munged-context-format
tests/need-filename
tests/no-mode-change-git-diff [new file with mode: 0644]
tests/no-newline-triggers-assert
tests/preserve-c-function-names
tests/preserve-mode-and-timestamp
tests/quoted-filenames
tests/read-only-files
tests/reject-format
tests/remember-backup-files
tests/remember-reject-files
tests/remove-directories
tests/symlinks
tests/test-lib.sh
tests/unmodified-files

index 2c9b4ef42ecbc54d7c946c9ad26424b89d1f792d..a4dd9dba4fbfc56b9de647bc31ed848d9f65885f 100644 (file)
@@ -1 +1 @@
-2.7.3
+2.7.4
index c21081a8cd01e9484bed684e5cc595d7eceff09f..21e051e3d98b4196d37e87d45ba7c4f53306ec96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,85 @@
+2015-01-31  Andreas Gruenbacher  <agruen@gnu.org>
+
+       Upate NEWS
+
+       Fix indentation heuristic for context diffs
+       Diffs can be indented by a variable number of spaces, tabs, or X characters.
+       Make sure that intuit_diff_type() only accepts context diffs where the first
+       and second line are indented identically, or else another_hunk() will fail.
+       * src/pch.c (intuit_diff_type): Remember the indentation of the last line. Only
+       recognize context diff hunks with the same amount of indentation on the first
+       and second line.
+       * tests/garbage: New test case.
+       * tests/Makefile.am (TESTS): Add test case.
+
+2015-01-31  Quentin Casasnovas  <quentin.casasnovas@oracle.com>
+
+       patch: git-diff mode: do not change permissions if there isn't an explicit mode change.
+
+       tests: add a test case for unwanted mode changes.
+
+       test-lib.sh: factorize require_* functions
+       Since the code is identical when just checking if a utility is present on
+       the system or not, we can factorize it.
+
+2015-01-31  Andreas Gruenbacher  <agruen@gnu.org>
+
+       Add test case for patch behind symlink
+       * tests/symlinks: Add a test case where the patch file itself is in a path that
+       follows a symbolic link; we want to continue allowing that.
+
+2015-01-31  Tim Waugh  <twaugh@redhat.com>
+
+       Allow arbitrary symlink targets again
+       * src/util.c (symlink_target_is_valid): Remove.
+       (move_file): Remove symlink target checking.
+       * tests/symlinks: Update test case.
+
+2015-01-31  Andreas Gruenbacher  <agruen@gnu.org>
+
+       Update list of gnulib modules used
+       * bootstrap.conf (gnulib_modules): Remove lchmod, lstat, mkdir, readlink,
+       rename, mkdir, symlink, unlink, utimens. Add fchownat, fchmodat, fstatat,
+       mkdirat, openat, readlinkat, renameat, symlinkat, unlinkat, utimensat.
+       * src/util.h: Don't include <utimens.h> anymore.
+
+       Use symlink-safe system call replacements
+       Use the symlink-safe replacements for system calls in many places throughout
+       the code: In some places this makes patch safe against path traversal attacks;
+       in other places, it saves the kernel from having to re-traverse the pathnames.
+       * src/inp.c (plan_b): Use safe_open() + fdopen() instead of fopen().
+       * src/util.c (copy_attr): Document why we are safe here.
+       (create_backup): Use safe_open() instead of creat().
+
+2015-01-31  Tim Waugh  <twaugh@redhat.com>
+
+       Add symlink-safe system call replacements
+       Add wrappers around system calls that traverse relative pathnames without
+       following symlinks. Written by Tim Waugh <twaugh@redhat.com> and Andreas
+       Gruenbacher <agruenba@redhat.com>.
+       * src/safe.h: Declare functions here.
+       * src/safe.c: Implement safe_* system call replacements that do not follow
+       symlinks along pathnames. Pathname components are resolved with openat().
+       Lookup results are cached to keep the overhead reasonably low.
+       * tests/deep-directories: New path traversal cache test.
+       * src/Makefile.am (patch_SOURCES): Add safe.[ch].
+       * tests/Makefile.am (TESTS): Add new test.
+
+2015-01-31  Andreas Gruenbacher  <agruen@gnu.org>
+
+       build: update gnulib submodule to latest
+
+2015-01-31  Tim Waugh  <twaugh@redhat.com>
+
+       Avoid closing file descriptor twice
+       * src/patch.c (main): Make sure we don't close() outfd after passing it on to
+       fdopen(): the file descriptor might have been reused in the meantime.
+
+2015-01-29  Andreas Gruenbacher  <agruen@gnu.org>
+
+       Remove unused variable
+       * src/pch.c (name_is_valid): Remove unused variable.
+
 2015-01-22  Andreas Gruenbacher  <agruen@gnu.org>
 
        Fix the fix for CVE-2015-1196
index 4ab642943f3ba3042db4659829a77806c1c93a5a..6617eec2e82ea2ef579986953cf71dfbf75e144f 100644 (file)
@@ -5,7 +5,7 @@
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
-# Copyright (C) 2001, 2003, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2015 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
diff --git a/INSTALL b/INSTALL
index 2099840756e6302d837dcd51b5dcd6262f7adb16..dadea5c1ce2e2bd256c8746d99d7e267ccdd3c77 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
-Inc.
+   Copyright (C) 1994-1996, 1999-2002, 2004-2015 Free Software
+Foundation, Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -12,97 +12,96 @@ without warranty of any kind.
 Basic Installation
 ==================
 
-   Briefly, the shell command `./configure && make && make install'
+   Briefly, the shell command './configure && make && make install'
 should configure, build, and install this package.  The following
-more-detailed instructions are generic; see the `README' file for
+more-detailed instructions are generic; see the 'README' file for
 instructions specific to this package.  Some packages provide this
-`INSTALL' file but do not implement all of the features documented
+'INSTALL' file but do not implement all of the features documented
 below.  The lack of an optional feature in a given package is not
 necessarily a bug.  More recommendations for GNU packages can be found
 in *note Makefile Conventions: (standards)Makefile Conventions.
 
-   The `configure' shell script attempts to guess correct values for
+   The 'configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
+those values to create a 'Makefile' in each directory of the package.
+It may also create one or more '.h' files containing system-dependent
+definitions.  Finally, it creates a shell script 'config.status' that
 you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
+file 'config.log' containing compiler output (useful mainly for
+debugging 'configure').
 
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
+   It can also use an optional file (typically called 'config.cache' and
+enabled with '--cache-file=config.cache' or simply '-C') that saves the
+results of its tests to speed up reconfiguring.  Caching is disabled by
+default to prevent problems with accidental use of stale cache files.
 
    If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
+to figure out how 'configure' could check whether to do them, and mail
+diffs or instructions to the address given in the 'README' so they can
 be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
+some point 'config.cache' contains results you don't want to keep, you
 may remove or edit it.
 
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
+   The file 'configure.ac' (or 'configure.in') is used to create
+'configure' by a program called 'autoconf'.  You need 'configure.ac' if
+you want to change it or regenerate 'configure' using a newer version of
+'autoconf'.
 
    The simplest way to compile this package is:
 
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.
+  1. 'cd' to the directory containing the package's source code and type
+     './configure' to configure the package for your system.
 
-     Running `configure' might take a while.  While running, it prints
+     Running 'configure' might take a while.  While running, it prints
      some messages telling which features it is checking for.
 
-  2. Type `make' to compile the package.
+  2. Type 'make' to compile the package.
 
-  3. Optionally, type `make check' to run any self-tests that come with
+  3. Optionally, type 'make check' to run any self-tests that come with
      the package, generally using the just-built uninstalled binaries.
 
-  4. Type `make install' to install the programs and any data files and
+  4. Type 'make install' to install the programs and any data files and
      documentation.  When installing into a prefix owned by root, it is
      recommended that the package be configured and built as a regular
-     user, and only the `make install' phase executed with root
+     user, and only the 'make install' phase executed with root
      privileges.
 
-  5. Optionally, type `make installcheck' to repeat any self-tests, but
+  5. Optionally, type 'make installcheck' to repeat any self-tests, but
      this time using the binaries in their final installed location.
      This target does not install anything.  Running this target as a
-     regular user, particularly if the prior `make install' required
+     regular user, particularly if the prior 'make install' required
      root privileges, verifies that the installation completed
      correctly.
 
   6. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
+     source code directory by typing 'make clean'.  To also remove the
+     files that 'configure' created (so you can compile the package for
+     a different kind of computer), type 'make distclean'.  There is
+     also a 'make maintainer-clean' target, but that is intended mainly
      for the package's developers.  If you use it, you may have to get
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
-  7. Often, you can also type `make uninstall' to remove the installed
+  7. Often, you can also type 'make uninstall' to remove the installed
      files again.  In practice, not all packages have tested that
      uninstallation works correctly, even though it is required by the
      GNU Coding Standards.
 
-  8. Some packages, particularly those that use Automake, provide `make
+  8. Some packages, particularly those that use Automake, provide 'make
      distcheck', which can by used by developers to test that all other
-     targets like `make install' and `make uninstall' work correctly.
+     targets like 'make install' and 'make uninstall' work correctly.
      This target is generally not run by end users.
 
 Compilers and Options
 =====================
 
    Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  Run `./configure --help'
+the 'configure' script does not know about.  Run './configure --help'
 for details on some of the pertinent environment variables.
 
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
+   You can give 'configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here is
+an example:
 
      ./configure CC=c99 CFLAGS=-g LIBS=-lposix
 
@@ -113,21 +112,21 @@ Compiling For Multiple Architectures
 
    You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
-own directory.  To do this, you can use GNU `make'.  `cd' to the
+own directory.  To do this, you can use GNU 'make'.  'cd' to the
 directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.  This
-is known as a "VPATH" build.
+the 'configure' script.  'configure' automatically checks for the source
+code in the directory that 'configure' is in and in '..'.  This is known
+as a "VPATH" build.
 
-   With a non-GNU `make', it is safer to compile the package for one
+   With a non-GNU 'make', it is safer to compile the package for one
 architecture at a time in the source code directory.  After you have
-installed the package for one architecture, use `make distclean' before
+installed the package for one architecture, use 'make distclean' before
 reconfiguring for another architecture.
 
    On MacOS X 10.5 and later systems, you can create libraries and
 executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor.  Like
+"universal" binaries--by specifying multiple '-arch' options to the
+compiler but only a single '-arch' option to the preprocessor.  Like
 this:
 
      ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
@@ -136,105 +135,104 @@ this:
 
    This is not guaranteed to produce working output in all cases, you
 may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
+using the 'lipo' tool if you have problems.
 
 Installation Names
 ==================
 
-   By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
+   By default, 'make install' installs the package's commands under
+'/usr/local/bin', include files under '/usr/local/include', etc.  You
+can specify an installation prefix other than '/usr/local' by giving
+'configure' the option '--prefix=PREFIX', where PREFIX must be an
 absolute file name.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
 PREFIX as the prefix for installing programs and libraries.
 Documentation and other data files still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.  In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
+options like '--bindir=DIR' to specify different values for particular
+kinds of files.  Run 'configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the default
+for these options is expressed in terms of '${prefix}', so that
+specifying just '--prefix' will affect all of the other directory
 specifications that were not explicitly provided.
 
    The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
+correct locations to 'configure'; however, many packages provide one or
 both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
+'make install' command line to change installation locations without
 having to reconfigure or recompile.
 
    The first method involves providing an override variable for each
-affected directory.  For example, `make install
+affected directory.  For example, 'make install
 prefix=/alternate/directory' will choose an alternate location for all
 directory configuration variables that were expressed in terms of
-`${prefix}'.  Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated.  The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
-   The second method involves providing the `DESTDIR' variable.  For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names.  The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
+'${prefix}'.  Any directories that were specified during 'configure',
+but not in terms of '${prefix}', must each be overridden at install time
+for the entire installation to be relocated.  The approach of makefile
+variable overrides for each directory variable is required by the GNU
+Coding Standards, and ideally causes no recompilation.  However, some
+platforms have known limitations with the semantics of shared libraries
+that end up requiring recompilation when using this method, particularly
+noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the 'DESTDIR' variable.  For
+example, 'make install DESTDIR=/alternate/directory' will prepend
+'/alternate/directory' before all installation names.  The approach of
+'DESTDIR' overrides is not required by the GNU Coding Standards, and
 does not work on platforms that have drive letters.  On the other hand,
 it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
+when some directory options were not specified in terms of '${prefix}'
+at 'configure' time.
 
 Optional Features
 =================
 
    If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
+with an extra prefix or suffix on their names by giving 'configure' the
+option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
+
+   Some packages pay attention to '--enable-FEATURE' options to
+'configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to '--with-PACKAGE' options, where PACKAGE
+is something like 'gnu-as' or 'x' (for the X Window System).  The
+'README' should mention any '--enable-' and '--with-' options that the
 package recognizes.
 
-   For packages that use the X Window System, `configure' can usually
+   For packages that use the X Window System, 'configure' can usually
 find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
+you can use the 'configure' options '--x-includes=DIR' and
+'--x-libraries=DIR' to specify their locations.
 
    Some packages offer the ability to configure how verbose the
-execution of `make' will be.  For these packages, running `./configure
+execution of 'make' will be.  For these packages, running './configure
 --enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
+overridden with 'make V=1'; while running './configure
 --disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
+overridden with 'make V=0'.
 
 Particular systems
 ==================
 
-   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
-CC is not installed, it is recommended to use the following options in
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC
+is not installed, it is recommended to use the following options in
 order to use an ANSI C compiler:
 
      ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
-   HP-UX `make' updates targets which have the same time stamps as
-their prerequisites, which makes it generally unusable when shipped
-generated files such as `configure' are involved.  Use GNU `make'
-instead.
+   HP-UX 'make' updates targets which have the same time stamps as their
+prerequisites, which makes it generally unusable when shipped generated
+files such as 'configure' are involved.  Use GNU 'make' instead.
 
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
-a workaround.  If GNU CC is not installed, it is therefore recommended
-to try
+parse its '<wchar.h>' header file.  The option '-nodtk' can be used as a
+workaround.  If GNU CC is not installed, it is therefore recommended to
+try
 
      ./configure CC="cc"
 
@@ -242,26 +240,26 @@ and if that doesn't work, try
 
      ./configure CC="cc -nodtk"
 
-   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+   On Solaris, don't put '/usr/ucb' early in your 'PATH'.  This
 directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
+these programs are available in '/usr/bin'.  So, if you need '/usr/ucb'
+in your 'PATH', put it _after_ '/usr/bin'.
 
-   On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'.  It is recommended to use the following options:
+   On Haiku, software installed for all users goes in '/boot/common',
+not '/usr/local'.  It is recommended to use the following options:
 
      ./configure --prefix=/boot/common
 
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' cannot figure out
+   There may be some features 'configure' cannot figure out
 automatically, but needs to determine by the type of machine the package
 will run on.  Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
+_same_ architectures, 'configure' can figure that out, but if it prints
 a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
+'--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as 'sun4', or a canonical name which has the form:
 
      CPU-COMPANY-SYSTEM
 
@@ -270,101 +268,101 @@ where SYSTEM can have one of these forms:
      OS
      KERNEL-OS
 
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
+   See the file 'config.sub' for the possible values of each field.  If
+'config.sub' isn't included in this package, then this package doesn't
 need to know the machine type.
 
    If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
+use the option '--target=TYPE' to select the type of system they will
 produce code for.
 
    If you want to _use_ a cross compiler, that generates code for a
 platform different from the build platform, you should specify the
 "host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
+eventually be run) with '--host=TYPE'.
 
 Sharing Defaults
 ================
 
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
+   If you want to set default values for 'configure' scripts to share,
+you can create a site shell script called 'config.site' that gives
+default values for variables like 'CC', 'cache_file', and 'prefix'.
+'configure' looks for 'PREFIX/share/config.site' if it exists, then
+'PREFIX/etc/config.site' if it exists.  Or, you can set the
+'CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all 'configure' scripts look for a site script.
 
 Defining Variables
 ==================
 
    Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
+environment passed to 'configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
+them in the 'configure' command line, using 'VAR=value'.  For example:
 
      ./configure CC=/usr/local2/bin/gcc
 
-causes the specified `gcc' to be used as the C compiler (unless it is
+causes the specified 'gcc' to be used as the C compiler (unless it is
 overridden in the site shell script).
 
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf limitation.  Until the limitation is lifted, you can use
-this workaround:
+Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
+Autoconf limitation.  Until the limitation is lifted, you can use this
+workaround:
 
      CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
 
-`configure' Invocation
+'configure' Invocation
 ======================
 
-   `configure' recognizes the following options to control how it
+   'configure' recognizes the following options to control how it
 operates.
 
-`--help'
-`-h'
-     Print a summary of all of the options to `configure', and exit.
+'--help'
+'-h'
+     Print a summary of all of the options to 'configure', and exit.
 
-`--help=short'
-`--help=recursive'
+'--help=short'
+'--help=recursive'
      Print a summary of the options unique to this package's
-     `configure', and exit.  The `short' variant lists options used
-     only in the top level, while the `recursive' variant lists options
-     also present in any nested packages.
+     'configure', and exit.  The 'short' variant lists options used only
+     in the top level, while the 'recursive' variant lists options also
+     present in any nested packages.
 
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
+'--version'
+'-V'
+     Print the version of Autoconf used to generate the 'configure'
      script, and exit.
 
-`--cache-file=FILE'
+'--cache-file=FILE'
      Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     traditionally 'config.cache'.  FILE defaults to '/dev/null' to
      disable caching.
 
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
+'--config-cache'
+'-C'
+     Alias for '--cache-file=config.cache'.
 
-`--quiet'
-`--silent'
-`-q'
+'--quiet'
+'--silent'
+'-q'
      Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
+     suppress all normal output, redirect it to '/dev/null' (any error
      messages will still be shown).
 
-`--srcdir=DIR'
+'--srcdir=DIR'
      Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
+     'configure' can determine that directory automatically.
 
-`--prefix=DIR'
-     Use DIR as the installation prefix.  *note Installation Names::
-     for more details, including other options available for fine-tuning
-     the installation locations.
+'--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names:: for
+     more details, including other options available for fine-tuning the
+     installation locations.
 
-`--no-create'
-`-n'
+'--no-create'
+'-n'
      Run the configure checks, but stop before creating any output
      files.
 
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.
+'configure' also accepts some other, not widely useful, options.  Run
+'configure --help' for more details.
index 6ee448ecf02c0f41a08914bd7d729df28774f55d..bc6329c82a4397df425275f6b3a7d454ce1bfcf8 100644 (file)
@@ -97,7 +97,7 @@ subdir = .
 DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
        $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(top_srcdir)/configure $(am__configure_deps) \
-       $(srcdir)/config.hin $(dist_man1_MANS) COPYING \
+       $(srcdir)/config.hin $(dist_man1_MANS) COPYING TODO \
        build-aux/ar-lib build-aux/compile build-aux/config.guess \
        build-aux/config.sub build-aux/depcomp build-aux/install-sh \
        build-aux/mdate-sh build-aux/missing build-aux/texinfo.tex \
@@ -112,6 +112,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
        $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
+       $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
        $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
        $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
        $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
@@ -121,52 +122,61 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
        $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
        $(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
-       $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+       $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+       $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+       $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
        $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+       $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
        $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
        $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/gnulib-comp.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
        $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
-       $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
        $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
        $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
        $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
        $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
        $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
        $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
        $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+       $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+       $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
        $(top_srcdir)/m4/msvc-inval.m4 \
        $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
        $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+       $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
        $(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
        $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
        $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
        $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
-       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
-       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+       $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+       $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
        $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
-       $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
-       $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
-       $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
-       $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
-       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
-       $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+       $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+       $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+       $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
        $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
        $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
-       $(top_srcdir)/m4/sys_socket_h.m4 \
+       $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
        $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
        $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
        $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
        $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
        $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
-       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+       $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+       $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
        $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
        $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
        $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
@@ -690,6 +700,7 @@ HAVE_LINK = @HAVE_LINK@
 HAVE_LINKAT = @HAVE_LINKAT@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
 HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBRLEN = @HAVE_MBRLEN@
 HAVE_MBRTOWC = @HAVE_MBRTOWC@
 HAVE_MBSINIT = @HAVE_MBSINIT@
@@ -1046,6 +1057,7 @@ STRIP = @STRIP@
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
 UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 VERSION = @VERSION@
diff --git a/NEWS b/NEWS
index d79cead94d5b4d675c41e9970e06d4a9318dd360..9fafde479eff5f6c5271da1a8d657890580b78e9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,14 @@
+Changes until version 2.7.4:
+
 * When a file isn't being deleted because the file contents don't match the
   patch, the resulting message is now "Not deleting file ... as content
   differs from patch" instead of "File ... is not empty after patch; not
   deleting".
 * Function names in hunks (from diff -p) are now preserved in reject files.
-* With git-style patches, symlinks that point outside the working directory
-  will no longer be created (CVE-2015-1196).
+* Patch no longer follows symbolic links to input and output files.  This
+  ensures that symbolic links created by git-style patches cannot cause
+  patch to write outside the working directory (CVE-2015-1196).
+* Various fixes.
 
 Changes in version 2.7.1:
 
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..41324ab
--- /dev/null
+++ b/TODO
@@ -0,0 +1,12 @@
+* Add instrumentation code for the path traversal functions !!!
+
+access() !!!
+Apply the mode fix!
+Alpha release ?!
+Announcement ...
+
+* Fix Savannah patches.
+* Reduce the number of unnecessary syscalls: for example, stat is often called
+  repeatedly. 
+* Call makedirs() before creating files inside the directory; with the dirfd
+  cache, this causes no extra syscalls anymore.
index f4d61b6d18b75e02d488bec5515f6efdd4e999ad..e2807fb1a8f614db8877c7ff072bf7e86339ad10 100644 (file)
@@ -1213,6 +1213,8 @@ m4_include([m4/alloca.m4])
 m4_include([m4/backupfile.m4])
 m4_include([m4/bison.m4])
 m4_include([m4/canonicalize.m4])
+m4_include([m4/chdir-long.m4])
+m4_include([m4/chown.m4])
 m4_include([m4/clock_time.m4])
 m4_include([m4/close.m4])
 m4_include([m4/closedir.m4])
@@ -1232,11 +1234,17 @@ m4_include([m4/error.m4])
 m4_include([m4/exponentd.m4])
 m4_include([m4/extensions.m4])
 m4_include([m4/extern-inline.m4])
+m4_include([m4/fchdir.m4])
+m4_include([m4/fchmodat.m4])
+m4_include([m4/fchownat.m4])
 m4_include([m4/fcntl-o.m4])
 m4_include([m4/fcntl.m4])
 m4_include([m4/fcntl_h.m4])
+m4_include([m4/filenamecat.m4])
 m4_include([m4/float_h.m4])
 m4_include([m4/fstat.m4])
+m4_include([m4/fstatat.m4])
+m4_include([m4/getcwd.m4])
 m4_include([m4/getdtablesize.m4])
 m4_include([m4/getopt.m4])
 m4_include([m4/gettime.m4])
@@ -1248,7 +1256,7 @@ m4_include([m4/include_next.m4])
 m4_include([m4/intmax_t.m4])
 m4_include([m4/inttypes_h.m4])
 m4_include([m4/largefile.m4])
-m4_include([m4/lchmod.m4])
+m4_include([m4/lchown.m4])
 m4_include([m4/localcharset.m4])
 m4_include([m4/locale-fr.m4])
 m4_include([m4/locale-ja.m4])
@@ -1262,15 +1270,21 @@ m4_include([m4/mbrtowc.m4])
 m4_include([m4/mbsinit.m4])
 m4_include([m4/mbstate_t.m4])
 m4_include([m4/memchr.m4])
+m4_include([m4/mempcpy.m4])
+m4_include([m4/memrchr.m4])
 m4_include([m4/minmax.m4])
 m4_include([m4/mkdir.m4])
+m4_include([m4/mkdirat.m4])
 m4_include([m4/mktime.m4])
 m4_include([m4/mmap-anon.m4])
+m4_include([m4/mode_t.m4])
 m4_include([m4/msvc-inval.m4])
 m4_include([m4/msvc-nothrow.m4])
 m4_include([m4/multiarch.m4])
 m4_include([m4/nocrash.m4])
 m4_include([m4/off_t.m4])
+m4_include([m4/open.m4])
+m4_include([m4/openat.m4])
 m4_include([m4/opendir.m4])
 m4_include([m4/parse-datetime.m4])
 m4_include([m4/pathmax.m4])
@@ -1280,11 +1294,14 @@ m4_include([m4/quotearg.m4])
 m4_include([m4/raise.m4])
 m4_include([m4/readdir.m4])
 m4_include([m4/readlink.m4])
+m4_include([m4/readlinkat.m4])
 m4_include([m4/realloc.m4])
 m4_include([m4/rename.m4])
+m4_include([m4/renameat.m4])
 m4_include([m4/rmdir.m4])
 m4_include([m4/safe-read.m4])
 m4_include([m4/safe-write.m4])
+m4_include([m4/save-cwd.m4])
 m4_include([m4/secure_getenv.m4])
 m4_include([m4/setenv.m4])
 m4_include([m4/setmode.m4])
@@ -1300,11 +1317,13 @@ m4_include([m4/stdint.m4])
 m4_include([m4/stdint_h.m4])
 m4_include([m4/stdio_h.m4])
 m4_include([m4/stdlib_h.m4])
+m4_include([m4/strdup.m4])
 m4_include([m4/strerror.m4])
 m4_include([m4/string_h.m4])
 m4_include([m4/strndup.m4])
 m4_include([m4/strnlen.m4])
 m4_include([m4/symlink.m4])
+m4_include([m4/symlinkat.m4])
 m4_include([m4/sys_socket_h.m4])
 m4_include([m4/sys_stat_h.m4])
 m4_include([m4/sys_time_h.m4])
@@ -1317,8 +1336,10 @@ m4_include([m4/tm_gmtoff.m4])
 m4_include([m4/unistd-safer.m4])
 m4_include([m4/unistd_h.m4])
 m4_include([m4/unlink.m4])
+m4_include([m4/unlinkat.m4])
 m4_include([m4/utimbuf.m4])
 m4_include([m4/utimens.m4])
+m4_include([m4/utimensat.m4])
 m4_include([m4/utimes.m4])
 m4_include([m4/vasnprintf.m4])
 m4_include([m4/vasprintf.m4])
index 6c32c8645c8b2edba2b8fe66c2b1f06c68613c23..dbfb9786cb6f9b8003367505d49dcadb2145610a 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-11-04'
+timestamp='2015-01-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
index 7cc68ba113fe7b4bd94d4e61d5767bb56229087d..6d2e94c8bf9ea6925b96846aade1fd64074985d3 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-09-26'
+timestamp='2015-01-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -260,7 +260,7 @@ case $basic_machine in
        | c4x | c8051 | clipper \
        | d10v | d30v | dlx | dsp16xx \
        | epiphany \
-       | fido | fr30 | frv \
+       | fido | fr30 | frv | ft32 \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | hexagon \
        | i370 | i860 | i960 | ia64 \
@@ -313,6 +313,7 @@ case $basic_machine in
        | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
        | ubicom32 \
        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | visium \
        | we32k \
        | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
@@ -440,6 +441,7 @@ case $basic_machine in
        | ubicom32-* \
        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
        | vax-* \
+       | visium-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
index 31788017b8f041f1d63dfb80ace66a4aa6b1c1d6..fda2463f383d20627d7fc33888fc95ac1f8d7f76 100755 (executable)
@@ -3,7 +3,7 @@
 
 scriptversion=2013-05-30.07; # UTC
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2015 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
index 47d657674d2c097ff21eba2667cf32dd3882459c..8e92c0ad8e3db950ef1cc1a3a19fee68cdddb77f 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2014-06-19.19; # UTC
+scriptversion=2014-12-02.19; # UTC
 
-# Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007-2015 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
@@ -215,7 +215,7 @@ if test "x$v_from_git" != x; then
 fi
 
 # Omit the trailing newline, so that m4_esyscmd can use the result directly.
-echo "$v" | tr -d "$nl"
+printf %s "$v"
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
index 190f7b5dbe2ac97ce8b4682402d751a03efca7a6..de934c2daa009791f35b60d704eab5d138c77e21 100755 (executable)
@@ -9,7 +9,7 @@ my $VERSION = '2014-11-20 17:25'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2008-2015 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
index b3719cf76191aefd6a48f36c27b8275e268677d0..b793600a128923f385f8ff1a1cc6df0c4bd8cf43 100755 (executable)
@@ -3,7 +3,7 @@
 
 scriptversion=2010-08-21.06; # UTC
 
-# Copyright (C) 1995-2013 Free Software Foundation, Inc.
+# Copyright (C) 1995-2015 Free Software Foundation, Inc.
 # written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
 #
 # This program is free software; you can redistribute it and/or modify
index 9ee8b155508af4c174c84ef7a9fdf3e8f33085ab..0d55e2bced4586de924df039f8aa5efd0b54fbf2 100644 (file)
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index 67b12335d0fc25f9b52273a5e3b436d160480ccd..585b38ab39a3e877f66160043ae6fae9907a1e48 100644 (file)
@@ -1,5 +1,5 @@
 /* C++ compatible function declaration macros.
-   Copyright (C) 2010-2014 Free Software Foundation, Inc.
+   Copyright (C) 2010-2015 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
index 1c4d7bd4ed55870134343748561a83fa36297824..90f4985ce1ee38c77fd46643d6d95c64a6797e73 100644 (file)
@@ -1,5 +1,5 @@
 /* A C macro for emitting warnings if a function is used.
-   Copyright (C) 2010-2014 Free Software Foundation, Inc.
+   Copyright (C) 2010-2015 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
index 54cf66787d59510ce9153e591dd3863744c19c64..7f5f357549119e11f27ab51427df15f4bb4a9446 100644 (file)
@@ -3,11 +3,12 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2014-11-14.07}
+\def\texinfoversion{2015-01-30.16}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
+% Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
@@ -96,7 +97,9 @@
 \let\ptexraggedright=\raggedright
 \let\ptexrbrace=\}
 \let\ptexslash=\/
+\let\ptexsp=\sp
 \let\ptexstar=\*
+\let\ptexsup=\sup
 \let\ptext=\t
 \let\ptextop=\top
 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
@@ -2081,12 +2084,9 @@ end
  \endgroup
 }
 
-
 % In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families.  Since
-% texinfo doesn't allow for producing subscripts and superscripts except
-% in the main text, we don't bother to reset \scriptfont and
-% \scriptscriptfont (which would also require loading a lot more fonts).
+% we have to define the \textfont of the standard families.  We don't
+% bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
 %
 \def\resetmathfonts{%
   \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
@@ -2100,8 +2100,8 @@ end
 % \tenSTYLE to set the current font.
 %
 % Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower).  These relative commands are used in
-% the LaTeX logo and acronyms.
+% and \lllsize (three sizes lower).  These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
 %
 % This all needs generalizing, badly.
 %
@@ -2842,6 +2842,8 @@ end
   \let\v=\check
   \let\~=\tilde
   \let\dotaccent=\dot
+  % have to provide another name for sup operator
+  \let\mathopsup=\sup
   $\finishmath
 }
 \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
@@ -2865,6 +2867,18 @@ end
   }
 }
 
+% for @sub and @sup, if in math mode, just do a normal sub/superscript.
+% If in text, use math to place as sub/superscript, but switch
+% into text mode, with smaller fonts.  This is a different font than the
+% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
+% fix it (significant additions to font machinery) until someone notices.
+%
+\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
+\def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
+%
+\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
+\def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
+
 % ctrl is no longer a Texinfo command, but leave this definition for fun.
 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
 
@@ -6335,6 +6349,7 @@ end
   % other math active characters (just in case), to plain's definitions.
   \mathactive
   %
+  % Inverse of the list at the beginning of the file.
   \let\b=\ptexb
   \let\bullet=\ptexbullet
   \let\c=\ptexc
@@ -6350,7 +6365,9 @@ end
   \let\+=\tabalign
   \let\}=\ptexrbrace
   \let\/=\ptexslash
+  \let\sp=\ptexsp
   \let\*=\ptexstar
+  %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
   \let\t=\ptext
   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
   \let\frenchspacing=\plainfrenchspacing
@@ -7416,7 +7433,6 @@ end
 %
 % \anythingelse will almost certainly be an error of some kind.
 
-
 % \mbodybackslash is the definition of \ in @macro bodies.
 % It maps \foo\ => \csname macarg.foo\endcsname => #N
 % where N is the macro parameter number.
@@ -7525,8 +7541,7 @@ end
 % the catcode regime underwhich the body was input).
 %
 % If you compile with TeX (not eTeX), and you have macros with 10 or more
-% arguments, you need that no macro has more than 256 arguments, otherwise an
-% error is produced.
+% arguments, no macro can have more than 256 arguments (else error).
 \def\parsemargdef#1;{%
   \paramno=0\def\paramlist{}%
   \let\hash\relax
@@ -8938,6 +8953,7 @@ directory should work if nowhere else does.}
       \catcode\count255=#1\relax
       \advance\count255 by 1
    \repeat
+
 }
 
 % @documentencoding sets the definition of non-ASCII characters
@@ -8975,7 +8991,7 @@ directory should work if nowhere else does.}
      \utfeightchardefs
   %
   \else
-    \message{Unknown document encoding #1, ignoring.}%
+    \message{Ignoring unknown document encoding: #1.}%
   %
   \fi % utfeight
   \fi % latnine
@@ -8984,10 +9000,11 @@ directory should work if nowhere else does.}
   \fi % ascii
 }
 
+% emacs-page
 % A message to be logged when using a character that isn't available
 % the default font encoding (OT1).
 %
-\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
+\def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
 
 % Take account of \c (plain) vs. \, (Texinfo) difference.
 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
@@ -9023,12 +9040,10 @@ directory should work if nowhere else does.}
   \gdef^^b4{\'{}}
   \gdef^^b5{$\mu$}
   \gdef^^b6{\P}
-  %
-  \gdef^^b7{$^.$}
+  \gdef^^b7{\ifmmode\cdot\else $\cdot$\fi}
   \gdef^^b8{\cedilla\ }
   \gdef^^b9{$^1$}
   \gdef^^ba{\ordm}
-  %
   \gdef^^bb{\guillemetright}
   \gdef^^bc{$1\over4$}
   \gdef^^bd{$1\over2$}
@@ -9283,6 +9298,18 @@ directory should work if nowhere else does.}
   \UTFviiiLoop
 \endgroup
 
+\def\globallet{\global\let} % save some \expandafter's below
+
+% @U{xxxx} to produce U+xxxx, if we support it.
+\def\U#1{%
+  \expandafter\ifx\csname uni:#1\endcsname \relax
+    \errhelp = \EMsimple       
+    \errmessage{Unicode character U+#1 not supported, sorry}%
+  \else
+    \csname uni:#1\endcsname
+  \fi
+}
+
 \begingroup
   \catcode`\"=12
   \catcode`\<=12
@@ -9291,7 +9318,6 @@ directory should work if nowhere else does.}
   \catcode`\;=12
   \catcode`\!=12
   \catcode`\~=13
-
   \gdef\DeclareUnicodeCharacter#1#2{%
     \countUTFz = "#1\relax
     %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
@@ -9306,6 +9332,13 @@ directory should work if nowhere else does.}
       \expandafter\expandafter\expandafter\expandafter
        \expandafter\expandafter\expandafter
        \gdef\UTFviiiTmp{#2}%
+      % 
+      \expandafter\ifx\csname uni:#1\endcsname \relax \else
+       \errmessage{Internal error, already defined: #1}%
+      \fi
+      %
+      % define an additional control sequence for this code point.
+      \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
     \endgroup}
 
   \gdef\parseXMLCharref{%
@@ -9343,23 +9376,49 @@ directory should work if nowhere else does.}
     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
 \endgroup
 
+% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
+% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
+% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
+% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
+% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
+% 
+% Many of our renditions are less than wonderful, and all the missing
+% characters are available somewhere.  Loading the necessary fonts
+% awaits user request.  We can't truly support Unicode without
+% reimplementing everything that's been done in LaTeX for many years,
+% plus probably using luatex or xetex, and who knows what else.
+% We won't be doing that here in this simple file.  But we can try to at
+% least make most of the characters not bomb out.
+%
 \def\utfeightchardefs{%
   \DeclareUnicodeCharacter{00A0}{\tie}
   \DeclareUnicodeCharacter{00A1}{\exclamdown}
   \DeclareUnicodeCharacter{00A3}{\pounds}
+  \DeclareUnicodeCharacter{00A7}{\S}
   \DeclareUnicodeCharacter{00A8}{\"{ }}
   \DeclareUnicodeCharacter{00A9}{\copyright}
   \DeclareUnicodeCharacter{00AA}{\ordf}
   \DeclareUnicodeCharacter{00AB}{\guillemetleft}
+  \DeclareUnicodeCharacter{00AC}{\ifmmode\lnot\else $\lnot$\fi}
   \DeclareUnicodeCharacter{00AD}{\-}
   \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
   \DeclareUnicodeCharacter{00AF}{\={ }}
 
   \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
+  \DeclareUnicodeCharacter{00B1}{\ifmmode\pm\else $\pm$\fi}
+  \DeclareUnicodeCharacter{00B2}{$^2$}
+  \DeclareUnicodeCharacter{00B3}{$^3$}
   \DeclareUnicodeCharacter{00B4}{\'{ }}
+  \DeclareUnicodeCharacter{00B5}{$\mu$}
+  \DeclareUnicodeCharacter{00B6}{\P}
+  \DeclareUnicodeCharacter{00B7}{\ifmmode\cdot\else $\cdot$\fi}
   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
+  \DeclareUnicodeCharacter{00B9}{$^1$}
   \DeclareUnicodeCharacter{00BA}{\ordm}
   \DeclareUnicodeCharacter{00BB}{\guillemetright}
+  \DeclareUnicodeCharacter{00BC}{$1\over4$}
+  \DeclareUnicodeCharacter{00BD}{$1\over2$}
+  \DeclareUnicodeCharacter{00BE}{$3\over4$}
   \DeclareUnicodeCharacter{00BF}{\questiondown}
 
   \DeclareUnicodeCharacter{00C0}{\`A}
@@ -9386,6 +9445,7 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{00D4}{\^O}
   \DeclareUnicodeCharacter{00D5}{\~O}
   \DeclareUnicodeCharacter{00D6}{\"O}
+  \DeclareUnicodeCharacter{00D7}{\ifmmode\times\else $\times$\fi}
   \DeclareUnicodeCharacter{00D8}{\O}
   \DeclareUnicodeCharacter{00D9}{\`U}
   \DeclareUnicodeCharacter{00DA}{\'U}
@@ -9419,6 +9479,7 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{00F4}{\^o}
   \DeclareUnicodeCharacter{00F5}{\~o}
   \DeclareUnicodeCharacter{00F6}{\"o}
+  \DeclareUnicodeCharacter{00F7}{\ifmmode\div\else $\div$\fi}
   \DeclareUnicodeCharacter{00F8}{\o}
   \DeclareUnicodeCharacter{00F9}{\`u}
   \DeclareUnicodeCharacter{00FA}{\'u}
@@ -9438,20 +9499,23 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{0107}{\'c}
   \DeclareUnicodeCharacter{0108}{\^C}
   \DeclareUnicodeCharacter{0109}{\^c}
-  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
-  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
   \DeclareUnicodeCharacter{010C}{\v{C}}
   \DeclareUnicodeCharacter{010D}{\v{c}}
   \DeclareUnicodeCharacter{010E}{\v{D}}
+  \DeclareUnicodeCharacter{010F}{d'}
 
+  \DeclareUnicodeCharacter{0110}{\DH}
+  \DeclareUnicodeCharacter{0111}{\dh}
   \DeclareUnicodeCharacter{0112}{\=E}
   \DeclareUnicodeCharacter{0113}{\=e}
   \DeclareUnicodeCharacter{0114}{\u{E}}
   \DeclareUnicodeCharacter{0115}{\u{e}}
   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
+  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
+  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
   \DeclareUnicodeCharacter{011A}{\v{E}}
   \DeclareUnicodeCharacter{011B}{\v{e}}
   \DeclareUnicodeCharacter{011C}{\^G}
@@ -9461,14 +9525,20 @@ directory should work if nowhere else does.}
 
   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
+  \DeclareUnicodeCharacter{0122}{\cedilla{G}}
+  \DeclareUnicodeCharacter{0123}{\cedilla{g}}
   \DeclareUnicodeCharacter{0124}{\^H}
   \DeclareUnicodeCharacter{0125}{\^h}
+  \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
+  \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
   \DeclareUnicodeCharacter{0128}{\~I}
   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
   \DeclareUnicodeCharacter{012A}{\=I}
   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
   \DeclareUnicodeCharacter{012C}{\u{I}}
   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
+  \DeclareUnicodeCharacter{012E}{\ogonek{I}}
+  \DeclareUnicodeCharacter{012F}{\ogonek{i}}
 
   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
   \DeclareUnicodeCharacter{0131}{\dotless{i}}
@@ -9476,15 +9546,29 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{0133}{ij}
   \DeclareUnicodeCharacter{0134}{\^J}
   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
+  \DeclareUnicodeCharacter{0136}{\cedilla{K}}
+  \DeclareUnicodeCharacter{0137}{\cedilla{k}}
+  \DeclareUnicodeCharacter{0138}{\ifmmode\kappa\else $\kappa$\fi}  
   \DeclareUnicodeCharacter{0139}{\'L}
   \DeclareUnicodeCharacter{013A}{\'l}
+  \DeclareUnicodeCharacter{013B}{\cedilla{L}}
+  \DeclareUnicodeCharacter{013C}{\cedilla{l}}
+  \DeclareUnicodeCharacter{013D}{L'}% should kern
+  \DeclareUnicodeCharacter{013E}{l'}% should kern
+  \DeclareUnicodeCharacter{013F}{L\U{00B7}}
 
+  \DeclareUnicodeCharacter{0140}{l\U{00B7}}
   \DeclareUnicodeCharacter{0141}{\L}
   \DeclareUnicodeCharacter{0142}{\l}
   \DeclareUnicodeCharacter{0143}{\'N}
   \DeclareUnicodeCharacter{0144}{\'n}
+  \DeclareUnicodeCharacter{0145}{\cedilla{N}}
+  \DeclareUnicodeCharacter{0146}{\cedilla{n}}
   \DeclareUnicodeCharacter{0147}{\v{N}}
   \DeclareUnicodeCharacter{0148}{\v{n}}
+  \DeclareUnicodeCharacter{0149}{'n}
+  \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
+  \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
   \DeclareUnicodeCharacter{014C}{\=O}
   \DeclareUnicodeCharacter{014D}{\=o}
   \DeclareUnicodeCharacter{014E}{\u{O}}
@@ -9496,6 +9580,8 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{0153}{\oe}
   \DeclareUnicodeCharacter{0154}{\'R}
   \DeclareUnicodeCharacter{0155}{\'r}
+  \DeclareUnicodeCharacter{0156}{\cedilla{R}}
+  \DeclareUnicodeCharacter{0157}{\cedilla{r}}
   \DeclareUnicodeCharacter{0158}{\v{R}}
   \DeclareUnicodeCharacter{0159}{\v{r}}
   \DeclareUnicodeCharacter{015A}{\'S}
@@ -9507,10 +9593,12 @@ directory should work if nowhere else does.}
 
   \DeclareUnicodeCharacter{0160}{\v{S}}
   \DeclareUnicodeCharacter{0161}{\v{s}}
-  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
-  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
+  \DeclareUnicodeCharacter{0162}{\cedilla{T}}
+  \DeclareUnicodeCharacter{0163}{\cedilla{t}}
   \DeclareUnicodeCharacter{0164}{\v{T}}
-
+  \DeclareUnicodeCharacter{0165}{\v{t}}
+  \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
+  \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
   \DeclareUnicodeCharacter{0168}{\~U}
   \DeclareUnicodeCharacter{0169}{\~u}
   \DeclareUnicodeCharacter{016A}{\=U}
@@ -9522,6 +9610,8 @@ directory should work if nowhere else does.}
 
   \DeclareUnicodeCharacter{0170}{\H{U}}
   \DeclareUnicodeCharacter{0171}{\H{u}}
+  \DeclareUnicodeCharacter{0172}{\ogonek{U}}
+  \DeclareUnicodeCharacter{0173}{\ogonek{u}}
   \DeclareUnicodeCharacter{0174}{\^W}
   \DeclareUnicodeCharacter{0175}{\^w}
   \DeclareUnicodeCharacter{0176}{\^Y}
@@ -9533,6 +9623,7 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
   \DeclareUnicodeCharacter{017D}{\v{Z}}
   \DeclareUnicodeCharacter{017E}{\v{z}}
+  \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
 
   \DeclareUnicodeCharacter{01C4}{D\v{Z}}
   \DeclareUnicodeCharacter{01C5}{D\v{z}}
@@ -9744,6 +9835,9 @@ directory should work if nowhere else does.}
    \relax
 }
 
+% define all the unicode characters we know about, for the sake of @U.
+\utfeightchardefs
+
 % Make non-ASCII characters printable again for compatibility with
 % existing Texinfo documents that may use them, even without declaring a
 % document encoding.
@@ -10165,7 +10259,7 @@ directory should work if nowhere else does.}
 
 @c Local variables:
 @c eval: (add-hook 'write-file-hooks 'time-stamp)
-@c page-delimiter: "^\\\\message"
+@c page-delimiter: "^\\\\message\\|emacs-page"
 @c time-stamp-start: "def\\\\texinfoversion{"
 @c time-stamp-format: "%:y-%02m-%02d.%02H"
 @c time-stamp-end: "}"
index 90624e9004cbae54707fd791f85a63880a2c1508..4eb4b93ea6c4b6aa57d1ecba252f3a0520e11b33 100755 (executable)
@@ -3,9 +3,9 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
     if 0;
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2013-01-03.09:41'; # UTC
+my $VERSION = '2015-01-15.20:53'; # UTC
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 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
@@ -124,7 +124,7 @@ use strict;
 use warnings;
 
 my $copyright_re = 'Copyright';
-my $circle_c_re = '(?:\([cC]\)|@copyright{}|&copy;)';
+my $circle_c_re = '(?:\([cC]\)|@copyright{}|\\\\\(co|&copy;)';
 my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
 $holder ||= 'Free Software Foundation, Inc.';
 my $prefix_max = 5;
index 4c76c75d797718c7a14e8f06e6854294c419342b..82a09b39e5614713c8e966338b39e95d16ac9e20 100755 (executable)
@@ -10,7 +10,7 @@ my $VERSION = '2012-01-06 07:23'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2008-2015 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
index b2bca54c959d8586f9945edf068c056c3fe84ad7..3bf93c3c03c20fa91f1f81921ca1fa7fb9b933eb 100755 (executable)
@@ -4,7 +4,7 @@
 # Print a version string.
 scriptversion=2011-05-16.22; # UTC
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2015 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
index 3044f2d151210f1e085a175ed8f93bc1b01071c2..f15a9cdbe59cfabce4cba50022777a90fad9fd88 100644 (file)
 /* Define to the number of bits in type 'wint_t'. */
 #undef BITSIZEOF_WINT_T
 
+/* Define to 1 if chown fails to change ctime when at least one argument was
+   not -1. */
+#undef CHOWN_CHANGE_TIME_BUG
+
+/* Define if chown is not POSIX compliant regarding IDs of -1. */
+#undef CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+
+/* Define if chown modifies symlinks. */
+#undef CHOWN_MODIFIES_SYMLINK
+
+/* Define to 1 if chown mishandles trailing slash. */
+#undef CHOWN_TRAILING_SLASH_BUG
+
 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    systems. This function is required for `alloca.c' support on those systems.
    */
 /* Name of editor program. */
 #undef EDITOR_PROGRAM
 
+/* Define to 1 if your platform has fchownat, but it does not reject an empty
+   file name. */
+#undef FCHOWNAT_EMPTY_FILENAME_BUG
+
+/* Define to 1 if your platform has fchownat, but it cannot perform lchown
+   tasks. */
+#undef FCHOWNAT_NOFOLLOW_BUG
+
 /* Define this to 1 if F_DUPFD behavior does not match POSIX */
 #undef FCNTL_DUPFD_BUGGY
 
    whether the gnulib module dirname shall be considered present. */
 #undef GNULIB_DIRNAME
 
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module fchmodat shall be considered present. */
+#undef GNULIB_FCHMODAT
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module fchownat shall be considered present. */
+#undef GNULIB_FCHOWNAT
+
 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
    whether the gnulib module fscanf shall be considered present. */
 #undef GNULIB_FSCANF
    whether the gnulib module malloc-gnu shall be considered present. */
 #undef GNULIB_MALLOC_GNU
 
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module openat shall be considered present. */
+#undef GNULIB_OPENAT
+
 /* enable some gnulib portability checks */
 #undef GNULIB_PORTCHECK
 
+/* Define to 1 if printf and friends should be labeled with attribute
+   "__gnu_printf__" instead of "__printf__" */
+#undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+
 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
    whether the gnulib module realloc-gnu shall be considered present. */
 #undef GNULIB_REALLOC_GNU
    whether the gnulib module scanf shall be considered present. */
 #undef GNULIB_SCANF
 
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module statat shall be considered present. */
+#undef GNULIB_STATAT
+
 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
    whether the gnulib module strerror shall be considered present. */
 #undef GNULIB_STRERROR
 /* Define to 1 when the gnulib module chdir should be tested. */
 #undef GNULIB_TEST_CHDIR
 
+/* Define to 1 when the gnulib module chown should be tested. */
+#undef GNULIB_TEST_CHOWN
+
+/* Define to 1 when the gnulib module cloexec should be tested. */
+#undef GNULIB_TEST_CLOEXEC
+
 /* Define to 1 when the gnulib module close should be tested. */
 #undef GNULIB_TEST_CLOSE
 
 /* Define to 1 when the gnulib module environ should be tested. */
 #undef GNULIB_TEST_ENVIRON
 
+/* Define to 1 when the gnulib module fchdir should be tested. */
+#undef GNULIB_TEST_FCHDIR
+
+/* Define to 1 when the gnulib module fchmodat should be tested. */
+#undef GNULIB_TEST_FCHMODAT
+
+/* Define to 1 when the gnulib module fchownat should be tested. */
+#undef GNULIB_TEST_FCHOWNAT
+
 /* Define to 1 when the gnulib module fcntl should be tested. */
 #undef GNULIB_TEST_FCNTL
 
 /* Define to 1 when the gnulib module fstat should be tested. */
 #undef GNULIB_TEST_FSTAT
 
+/* Define to 1 when the gnulib module fstatat should be tested. */
+#undef GNULIB_TEST_FSTATAT
+
+/* Define to 1 when the gnulib module getcwd should be tested. */
+#undef GNULIB_TEST_GETCWD
+
 /* Define to 1 when the gnulib module getdtablesize should be tested. */
 #undef GNULIB_TEST_GETDTABLESIZE
 
 /* Define to 1 when the gnulib module gettimeofday should be tested. */
 #undef GNULIB_TEST_GETTIMEOFDAY
 
-/* Define to 1 when the gnulib module lchmod should be tested. */
-#undef GNULIB_TEST_LCHMOD
+/* Define to 1 when the gnulib module lchown should be tested. */
+#undef GNULIB_TEST_LCHOWN
 
 /* Define to 1 when the gnulib module lstat should be tested. */
 #undef GNULIB_TEST_LSTAT
 /* Define to 1 when the gnulib module memchr should be tested. */
 #undef GNULIB_TEST_MEMCHR
 
+/* Define to 1 when the gnulib module mempcpy should be tested. */
+#undef GNULIB_TEST_MEMPCPY
+
+/* Define to 1 when the gnulib module memrchr should be tested. */
+#undef GNULIB_TEST_MEMRCHR
+
+/* Define to 1 when the gnulib module mkdirat should be tested. */
+#undef GNULIB_TEST_MKDIRAT
+
 /* Define to 1 when the gnulib module mktime should be tested. */
 #undef GNULIB_TEST_MKTIME
 
+/* Define to 1 when the gnulib module open should be tested. */
+#undef GNULIB_TEST_OPEN
+
+/* Define to 1 when the gnulib module openat should be tested. */
+#undef GNULIB_TEST_OPENAT
+
 /* Define to 1 when the gnulib module opendir should be tested. */
 #undef GNULIB_TEST_OPENDIR
 
 /* Define to 1 when the gnulib module readlink should be tested. */
 #undef GNULIB_TEST_READLINK
 
+/* Define to 1 when the gnulib module readlinkat should be tested. */
+#undef GNULIB_TEST_READLINKAT
+
 /* Define to 1 when the gnulib module realloc-posix should be tested. */
 #undef GNULIB_TEST_REALLOC_POSIX
 
 /* Define to 1 when the gnulib module rename should be tested. */
 #undef GNULIB_TEST_RENAME
 
+/* Define to 1 when the gnulib module renameat should be tested. */
+#undef GNULIB_TEST_RENAMEAT
+
 /* Define to 1 when the gnulib module rmdir should be tested. */
 #undef GNULIB_TEST_RMDIR
 
 /* Define to 1 when the gnulib module stat should be tested. */
 #undef GNULIB_TEST_STAT
 
+/* Define to 1 when the gnulib module strdup should be tested. */
+#undef GNULIB_TEST_STRDUP
+
 /* Define to 1 when the gnulib module strerror should be tested. */
 #undef GNULIB_TEST_STRERROR
 
 /* Define to 1 when the gnulib module symlink should be tested. */
 #undef GNULIB_TEST_SYMLINK
 
+/* Define to 1 when the gnulib module symlinkat should be tested. */
+#undef GNULIB_TEST_SYMLINKAT
+
 /* Define to 1 when the gnulib module time_r should be tested. */
 #undef GNULIB_TEST_TIME_R
 
 /* Define to 1 when the gnulib module unlink should be tested. */
 #undef GNULIB_TEST_UNLINK
 
+/* Define to 1 when the gnulib module unlinkat should be tested. */
+#undef GNULIB_TEST_UNLINKAT
+
 /* Define to 1 when the gnulib module unsetenv should be tested. */
 #undef GNULIB_TEST_UNSETENV
 
+/* Define to 1 when the gnulib module utimensat should be tested. */
+#undef GNULIB_TEST_UTIMENSAT
+
 /* Define to 1 when the gnulib module vasprintf should be tested. */
 #undef GNULIB_TEST_VASPRINTF
 
 /* Define to 1 if you have the `canonicalize_file_name' function. */
 #undef HAVE_CANONICALIZE_FILE_NAME
 
+/* Define to 1 if you have the `chown' function. */
+#undef HAVE_CHOWN
+
 /* Define to 1 if you have the `clock_gettime' function. */
 #undef HAVE_CLOCK_GETTIME
 
    */
 #undef HAVE_DECL_DIRFD
 
+/* Define to 1 if you have the declaration of `fchdir', and to 0 if you don't.
+   */
+#undef HAVE_DECL_FCHDIR
+
 /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
    don't. */
 #undef HAVE_DECL_GETC_UNLOCKED
    don't. */
 #undef HAVE_DECL_MBSINIT
 
+/* Define to 1 if you have the declaration of `memrchr', and to 0 if you
+   don't. */
+#undef HAVE_DECL_MEMRCHR
+
 /* Define to 1 if you have the declaration of `program_invocation_name', and
    to 0 if you don't. */
 #undef HAVE_DECL_PROGRAM_INVOCATION_NAME
    */
 #undef HAVE_DECL_SETENV
 
+/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRDUP
+
 /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
    don't. */
 #undef HAVE_DECL_STRERROR_R
 /* Define if you have the declaration of environ. */
 #undef HAVE_ENVIRON_DECL
 
+/* Define to 1 if you have the `fchdir' function. */
+#undef HAVE_FCHDIR
+
+/* Define to 1 if you have the `fchmodat' function. */
+#undef HAVE_FCHMODAT
+
+/* Define to 1 if you have the `fchown' function. */
+#undef HAVE_FCHOWN
+
 /* Define to 1 if you have the `fcntl' function. */
 #undef HAVE_FCNTL
 
 /* Define to 1 if you have the <features.h> header file. */
 #undef HAVE_FEATURES_H
 
+/* Define to 1 if you have the `fstatat' function. */
+#undef HAVE_FSTATAT
+
 /* Define to 1 if you have the `futimens' function. */
 #undef HAVE_FUTIMENS
 
 /* Define to 1 if you have the `lchmod' function. */
 #undef HAVE_LCHMOD
 
+/* Define to 1 if you have the `lchown' function. */
+#undef HAVE_LCHOWN
+
 /* Define to 1 if you have the `link' function. */
 #undef HAVE_LINK
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `mempcpy' function. */
+#undef HAVE_MEMPCPY
+
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if <limits.h> defines the MIN and MAX macros. */
 #undef HAVE_MINMAX_IN_LIMITS_H
 
 /* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */
 #undef HAVE_MINMAX_IN_SYS_PARAM_H
 
+/* Define to 1 if you have the `mkdirat' function. */
+#undef HAVE_MKDIRAT
+
 /* Define to 1 if you have the `mprotect' function. */
 #undef HAVE_MPROTECT
 
 /* Define to 1 if you have the `nanotime' function. */
 #undef HAVE_NANOTIME
 
+/* Define to 1 if you have the `openat' function. */
+#undef HAVE_OPENAT
+
 /* Define to 1 if you have the `opendir' function. */
 #undef HAVE_OPENDIR
 
 /* Define to 1 if you have the `readlink' function. */
 #undef HAVE_READLINK
 
+/* Define to 1 if you have the `readlinkat' function. */
+#undef HAVE_READLINKAT
+
 /* Define to 1 if your system has a GNU libc compatible 'realloc' function,
    and to 0 otherwise. */
 #undef HAVE_REALLOC_GNU
 /* Define to 1 if you have the `realpath' function. */
 #undef HAVE_REALPATH
 
+/* Define to 1 if you have the `renameat' function. */
+#undef HAVE_RENAMEAT
+
 /* Define to 1 if you have the <search.h> header file. */
 #undef HAVE_SEARCH_H
 
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
 /* Define to 1 if you have the `strerror_r' function. */
 #undef HAVE_STRERROR_R
 
 /* Define to 1 if you have the `symlink' function. */
 #undef HAVE_SYMLINK
 
+/* Define to 1 if you have the `symlinkat' function. */
+#undef HAVE_SYMLINKAT
+
 /* Define to 1 if you have the <sys/bitypes.h> header file. */
 #undef HAVE_SYS_BITYPES_H
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `unlinkat' function. */
+#undef HAVE_UNLINKAT
+
 /* Define to 1 if you have the `unsetenv' function. */
 #undef HAVE_UNSETENV
 
 /* Define if you have the 'wint_t' type. */
 #undef HAVE_WINT_T
 
+/* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX
+   7.1. */
+#undef HAVE_WORKING_FSTATAT_ZERO_FLAG
+
 /* Define to 1 if O_NOATIME works. */
 #undef HAVE_WORKING_O_NOATIME
 
 /* Define if the mbrtowc function returns a wrong return value. */
 #undef MBRTOWC_RETVAL_BUG
 
+/* Define to 1 if open() fails to recognize a trailing slash. */
+#undef OPEN_TRAILING_SLASH_BUG
+
 /* Name of package */
 #undef PACKAGE
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Define to the type that is the result of default argument promotions of
+   type mode_t. */
+#undef PROMOTED_MODE_T
+
 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
    such as on Solaris 9 or cygwin 1.5. */
 #undef RENAME_TRAILING_SLASH_SOURCE_BUG
 
+/* Define to 1 if gnulib's fchdir() replacement is used. */
+#undef REPLACE_FCHDIR
+
 /* Define to 1 if stat needs help when passed a directory name with a trailing
    slash */
 #undef REPLACE_FUNC_STAT_DIR
    slash */
 #undef REPLACE_FUNC_STAT_FILE
 
+/* Define to 1 if open() should work around the inability to open a directory.
+   */
+#undef REPLACE_OPEN_DIRECTORY
+
 /* Define to 1 if strerror(0) does not return a message implying success. */
 #undef REPLACE_STRERROR_0
 
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
+/* Use GNU style printf and scanf.  */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
 /* Enable threading extensions on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
index a09350c3d602a030607f303d7a500661379e14c2..1e1aedcc78e9a16a3f9d16b343e46c5c5e941a5b 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU patch 2.7.3.
+# Generated by GNU Autoconf 2.69 for GNU patch 2.7.4.
 #
 # Report bugs to <bug-patch@gnu.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GNU patch'
 PACKAGE_TARNAME='patch'
-PACKAGE_VERSION='2.7.3'
-PACKAGE_STRING='GNU patch 2.7.3'
+PACKAGE_VERSION='2.7.4'
+PACKAGE_STRING='GNU patch 2.7.4'
 PACKAGE_BUGREPORT='bug-patch@gnu.org'
 PACKAGE_URL='http://www.gnu.org/software/patch/'
 
@@ -667,6 +667,7 @@ HAVE_FEATURES_H
 HAVE_UNISTD_H
 NEXT_AS_FIRST_DIRECTIVE_UNISTD_H
 NEXT_UNISTD_H
+UNISTD_H_DEFINES_STRUCT_TIMESPEC
 PTHREAD_H_DEFINES_STRUCT_TIMESPEC
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
 TIME_H_DEFINES_STRUCT_TIMESPEC
@@ -713,6 +714,7 @@ GL_GENERATE_STDDEF_H_FALSE
 GL_GENERATE_STDDEF_H_TRUE
 STDDEF_H
 HAVE_WCHAR_T
+HAVE_MAX_ALIGN_T
 REPLACE_NULL
 GL_GENERATE_STDARG_H_FALSE
 GL_GENERATE_STDARG_H_TRUE
@@ -1048,6 +1050,23 @@ NEXT_GETOPT_H
 WINDOWS_64_BIT_ST_SIZE
 NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
 NEXT_SYS_STAT_H
+REPLACE_ITOLD
+GL_GENERATE_FLOAT_H_FALSE
+GL_GENERATE_FLOAT_H_TRUE
+FLOAT_H
+NEXT_AS_FIRST_DIRECTIVE_FLOAT_H
+NEXT_FLOAT_H
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H
+NEXT_FCNTL_H
+REPLACE_OPENAT
+REPLACE_OPEN
+REPLACE_FCNTL
+HAVE_OPENAT
+HAVE_FCNTL
+GNULIB_OPENAT
+GNULIB_OPEN
+GNULIB_NONBLOCKING
+GNULIB_FCNTL
 REPLACE_UTIMENSAT
 REPLACE_STAT
 REPLACE_MKNOD
@@ -1081,23 +1100,6 @@ GNULIB_FUTIMENS
 GNULIB_FSTATAT
 GNULIB_FSTAT
 GNULIB_FCHMODAT
-REPLACE_ITOLD
-GL_GENERATE_FLOAT_H_FALSE
-GL_GENERATE_FLOAT_H_TRUE
-FLOAT_H
-NEXT_AS_FIRST_DIRECTIVE_FLOAT_H
-NEXT_FLOAT_H
-NEXT_AS_FIRST_DIRECTIVE_FCNTL_H
-NEXT_FCNTL_H
-REPLACE_OPENAT
-REPLACE_OPEN
-REPLACE_FCNTL
-HAVE_OPENAT
-HAVE_FCNTL
-GNULIB_OPENAT
-GNULIB_OPEN
-GNULIB_NONBLOCKING
-GNULIB_FCNTL
 EOVERFLOW_VALUE
 EOVERFLOW_HIDDEN
 ENOLINK_VALUE
@@ -2011,7 +2013,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GNU patch 2.7.3 to adapt to many kinds of systems.
+\`configure' configures GNU patch 2.7.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2081,7 +2083,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GNU patch 2.7.3:";;
+     short | recursive ) echo "Configuration of GNU patch 2.7.4:";;
    esac
   cat <<\_ACEOF
 
@@ -2185,7 +2187,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GNU patch configure 2.7.3
+GNU patch configure 2.7.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2894,7 +2896,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GNU patch $as_me 2.7.3, which was
+It was created by GNU patch $as_me 2.7.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3180,34 +3182,47 @@ as_fn_append ac_func_list " getcwd"
 as_fn_append ac_func_list " readlink"
 as_fn_append ac_func_list " realpath"
 as_fn_append ac_header_list " sys/param.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " chown"
+as_fn_append ac_func_list " fchown"
 as_fn_append ac_func_list " _set_invalid_parameter_handler"
 as_fn_append ac_header_list " sys/socket.h"
+as_fn_append ac_func_list " fchdir"
 as_fn_append ac_header_list " dirent.h"
 as_fn_append ac_func_list " fdopendir"
 as_fn_append ac_func_list " getdtablesize"
-as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " fchmodat"
+as_fn_append ac_func_list " lchmod"
 as_fn_append ac_func_list " fcntl"
 as_fn_append ac_func_list " symlink"
+as_fn_append ac_func_list " mempcpy"
 as_fn_append ac_header_list " sys/stat.h"
+as_fn_append ac_func_list " fstatat"
 gl_getopt_required=GNU
 as_fn_append ac_header_list " getopt.h"
 as_fn_append ac_func_list " gettimeofday"
 as_fn_append ac_func_list " nanotime"
 as_fn_append ac_header_list " sys/time.h"
-as_fn_append ac_func_list " lchmod"
 as_fn_append ac_func_list " lstat"
 as_fn_append ac_func_list " mbsinit"
 as_fn_append ac_func_list " mbrtowc"
 as_fn_append ac_header_list " sys/mman.h"
 as_fn_append ac_func_list " mprotect"
+as_fn_append ac_func_list " mkdirat"
+as_fn_append ac_func_list " openat"
+as_fn_append ac_func_list " readlinkat"
 as_fn_append ac_func_list " link"
+as_fn_append ac_func_list " renameat"
 as_fn_append ac_func_list " secure_getenv"
 as_fn_append ac_func_list " setenv"
 as_fn_append ac_header_list " wchar.h"
 as_fn_append ac_header_list " stdint.h"
+as_fn_append ac_func_list " strdup"
 as_fn_append ac_func_list " strndup"
+as_fn_append ac_func_list " symlinkat"
 as_fn_append ac_func_list " localtime_r"
 as_fn_append ac_func_list " pipe"
+as_fn_append ac_func_list " unlinkat"
 as_fn_append ac_header_list " utime.h"
 as_fn_append ac_func_list " futimes"
 as_fn_append ac_func_list " futimesat"
@@ -3828,7 +3843,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='patch'
- VERSION='2.7.3'
+ VERSION='2.7.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5991,6 +6006,8 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
   $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 
+  $as_echo "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h
+
   $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
 
   $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
@@ -6257,6 +6274,8 @@ fi
   # Code from module absolute-header:
   # Code from module alloca-opt:
   # Code from module argmatch:
+  # Code from module assure:
+  # Code from module at-internal:
   # Code from module backupfile:
   # Code from module bitrotate:
   # Code from module c-ctype:
@@ -6264,7 +6283,10 @@ fi
   # Code from module c-strcaseeq:
   # Code from module canonicalize-lgpl:
   # Code from module chdir:
+  # Code from module chdir-long:
+  # Code from module chown:
   # Code from module clock-time:
+  # Code from module cloexec:
   # Code from module close:
   # Code from module closedir:
   # Code from module configmake:
@@ -6285,13 +6307,19 @@ fi
   # Code from module extensions:
 
   # Code from module extern-inline:
+  # Code from module fchdir:
+  # Code from module fchmodat:
+  # Code from module fchownat:
   # Code from module fcntl:
   # Code from module fcntl-h:
   # Code from module fd-hook:
   # Code from module filename:
+  # Code from module filenamecat-lgpl:
   # Code from module float:
   # Code from module fstat:
+  # Code from module fstatat:
   # Code from module full-write:
+  # Code from module getcwd-lgpl:
   # Code from module getdate:
   # Code from module getdtablesize:
   # Code from module getopt-gnu:
@@ -6308,7 +6336,7 @@ fi
   # Code from module intprops:
   # Code from module largefile:
 
-  # Code from module lchmod:
+  # Code from module lchown:
   # Code from module linked-list:
   # Code from module list:
   # Code from module localcharset:
@@ -6322,13 +6350,20 @@ fi
   # Code from module mbrtowc:
   # Code from module mbsinit:
   # Code from module memchr:
+  # Code from module mempcpy:
+  # Code from module memrchr:
   # Code from module minmax:
   # Code from module mkdir:
+  # Code from module mkdirat:
   # Code from module mktime:
   # Code from module msvc-inval:
   # Code from module msvc-nothrow:
   # Code from module multiarch:
   # Code from module nocrash:
+  # Code from module open:
+  # Code from module openat:
+  # Code from module openat-die:
+  # Code from module openat-h:
   # Code from module opendir:
   # Code from module parse-datetime:
   # Code from module pathmax:
@@ -6339,13 +6374,16 @@ fi
   # Code from module raise:
   # Code from module readdir:
   # Code from module readlink:
+  # Code from module readlinkat:
   # Code from module realloc:
   # Code from module realloc-gnu:
   # Code from module realloc-posix:
   # Code from module rename:
+  # Code from module renameat:
   # Code from module rmdir:
   # Code from module safe-write:
   # Code from module same-inode:
+  # Code from module save-cwd:
   # Code from module secure_getenv:
   # Code from module setenv:
   # Code from module signal:
@@ -6358,6 +6396,7 @@ fi
   # Code from module ssize_t:
   # Code from module stat:
   # Code from module stat-time:
+  # Code from module statat:
   # Code from module stdarg:
 
 
@@ -6367,6 +6406,7 @@ fi
   # Code from module stdint:
   # Code from module stdio:
   # Code from module stdlib:
+  # Code from module strdup-posix:
   # Code from module streq:
   # Code from module strerror:
   # Code from module strerror-override:
@@ -6374,6 +6414,7 @@ fi
   # Code from module strndup:
   # Code from module strnlen:
   # Code from module symlink:
+  # Code from module symlinkat:
   # Code from module sys_stat:
   # Code from module sys_time:
   # Code from module sys_types:
@@ -6384,10 +6425,12 @@ fi
   # Code from module unistd:
   # Code from module unistd-safer:
   # Code from module unlink:
+  # Code from module unlinkat:
   # Code from module unsetenv:
   # Code from module update-copyright:
   # Code from module useless-if-before-free:
   # Code from module utimens:
+  # Code from module utimensat:
   # Code from module vasnprintf:
   # Code from module vasprintf:
   # Code from module vc-list-files:
@@ -7395,159 +7438,169 @@ done
 
 
 
-  if test $ac_cv_func__set_invalid_parameter_handler = yes; then
-    HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
 
-$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
 
-  else
-    HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
-  fi
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then :
+  ac_cv_type_uid_t=yes
+else
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
 
+$as_echo "#define uid_t int" >>confdefs.h
 
 
+$as_echo "#define gid_t int" >>confdefs.h
 
+fi
 
-     GNULIB_OPENDIR=0;
-  GNULIB_READDIR=0;
-  GNULIB_REWINDDIR=0;
-  GNULIB_CLOSEDIR=0;
-  GNULIB_DIRFD=0;
-  GNULIB_FDOPENDIR=0;
-  GNULIB_SCANDIR=0;
-  GNULIB_ALPHASORT=0;
-    HAVE_OPENDIR=1;
-  HAVE_READDIR=1;
-  HAVE_REWINDDIR=1;
-  HAVE_CLOSEDIR=1;
-  HAVE_DECL_DIRFD=1;
-  HAVE_DECL_FDOPENDIR=1;
-  HAVE_FDOPENDIR=1;
-  HAVE_SCANDIR=1;
-  HAVE_ALPHASORT=1;
-  REPLACE_OPENDIR=0;
-  REPLACE_CLOSEDIR=0;
-  REPLACE_DIRFD=0;
-  REPLACE_FDOPENDIR=0;
 
+      for ac_header in unistd.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
+_ACEOF
 
+fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5
-$as_echo_n "checking whether the preprocessor supports include_next... " >&6; }
-if ${gl_cv_have_include_next+:} false; then :
+done
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
+$as_echo_n "checking for working chown... " >&6; }
+if ${ac_cv_func_chown_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  rm -rf conftestd1a conftestd1b conftestd2
-     mkdir conftestd1a conftestd1b conftestd2
-                                                  cat <<EOF > conftestd1a/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
-     cat <<EOF > conftestd1b/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include <stdio.h>
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
-     cat <<EOF > conftestd2/conftest.h
-#ifndef DEFINED_IN_CONFTESTD1
-#error "include_next test doesn't work"
-#endif
-#define DEFINED_IN_CONFTESTD2
-EOF
-     gl_save_CPPFLAGS="$CPPFLAGS"
-     CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <conftest.h>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_cv_have_include_next=yes
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in # ((
+                  # Guess yes on glibc systems.
+          *-gnu*) ac_cv_func_chown_works=yes ;;
+                  # If we don't know, assume the worst.
+          *)      ac_cv_func_chown_works=no ;;
+        esac
+
 else
-  CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <conftest.h>
+$ac_includes_default
+           #include <fcntl.h>
+
+int
+main ()
+{
+
+            char *f = "conftest.chown";
+            struct stat before, after;
+
+            if (creat (f, 0600) < 0)
+              return 1;
+            if (stat (f, &before) < 0)
+              return 1;
+            if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+              return 1;
+            if (stat (f, &after) < 0)
+              return 1;
+            return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+
+  ;
+  return 0;
+}
+
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_cv_have_include_next=buggy
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_chown_works=yes
 else
-  gl_cv_have_include_next=no
+  ac_cv_func_chown_works=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-     CPPFLAGS="$gl_save_CPPFLAGS"
-     rm -rf conftestd1a conftestd1b conftestd2
+
+     rm -f conftest.chown
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5
-$as_echo "$gl_cv_have_include_next" >&6; }
-  PRAGMA_SYSTEM_HEADER=
-  if test $gl_cv_have_include_next = yes; then
-    INCLUDE_NEXT=include_next
-    INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
-    if test -n "$GCC"; then
-      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
-    fi
-  else
-    if test $gl_cv_have_include_next = buggy; then
-      INCLUDE_NEXT=include
-      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
-    else
-      INCLUDE_NEXT=include
-      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
-    fi
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
+$as_echo "$ac_cv_func_chown_works" >&6; }
+  if test $ac_cv_func_chown_works = yes; then
 
+$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
 
+  fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system header files limit the line length" >&5
-$as_echo_n "checking whether system header files limit the line length... " >&6; }
-if ${gl_cv_pragma_columns+:} false; then :
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown dereferences symlinks" >&5
+$as_echo_n "checking whether chown dereferences symlinks... " >&6; }
+if ${gl_cv_func_chown_follows_symlink+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+      if test "$cross_compiling" = yes; then :
+  gl_cv_func_chown_follows_symlink=yes
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#ifdef __TANDEM
-choke me
-#endif
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+        int
+        main ()
+        {
+          int result = 0;
+          char const *dangling_symlink = "conftest.dangle";
+
+          unlink (dangling_symlink);
+          if (symlink ("conftest.no-such", dangling_symlink))
+            abort ();
+
+          /* Exit successfully on a conforming system,
+             i.e., where chown must fail with ENOENT.  */
+          if (chown (dangling_symlink, getuid (), getgid ()) == 0)
+            result |= 1;
+          if (errno != ENOENT)
+            result |= 2;
+          return result;
+        }
 
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "choke me" >/dev/null 2>&1; then :
-  gl_cv_pragma_columns=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_chown_follows_symlink=yes
 else
-  gl_cv_pragma_columns=no
+  gl_cv_func_chown_follows_symlink=no
 fi
-rm -f conftest*
-
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pragma_columns" >&5
-$as_echo "$gl_cv_pragma_columns" >&6; }
-  if test $gl_cv_pragma_columns = yes; then
-    PRAGMA_COLUMNS="#pragma COLUMNS 10000"
-  else
-    PRAGMA_COLUMNS=
-  fi
 
 
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_follows_symlink" >&5
+$as_echo "$gl_cv_func_chown_follows_symlink" >&6; }
 
+  if test $gl_cv_func_chown_follows_symlink = no; then
 
+$as_echo "#define CHOWN_MODIFIES_SYMLINK 1" >>confdefs.h
 
+  fi
 
 
 
@@ -7560,28 +7613,328 @@ $as_echo "$gl_cv_pragma_columns" >&6; }
 
 
 
+    if test $ac_cv_func_chown = no; then
+    HAVE_CHOWN=0
+  else
+        if test $gl_cv_func_chown_follows_symlink = no; then
+      REPLACE_CHOWN=1
+    fi
 
+        if test $ac_cv_func_chown_works = no; then
 
+$as_echo "#define CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE 1" >>confdefs.h
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5
-$as_echo_n "checking if environ is properly declared... " >&6; }
-  if ${gt_cv_var_environ_declaration+:} false; then :
+      REPLACE_CHOWN=1
+    fi
+
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown honors trailing slash" >&5
+$as_echo_n "checking whether chown honors trailing slash... " >&6; }
+if ${gl_cv_func_chown_slash_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
+  touch conftest.file && rm -f conftest.link
+       if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_chown_slash_works="guessing no" ;;
+         esac
 
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#if HAVE_UNISTD_H
-     #include <unistd.h>
-     #endif
-     /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
-     #include <stdlib.h>
 
-           extern struct { int foo; } environ;
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
 int
 main ()
 {
-environ.foo = 1;
+    if (symlink ("conftest.file", "conftest.link")) return 1;
+          if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_chown_slash_works=yes
+else
+  gl_cv_func_chown_slash_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.link conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_slash_works" >&5
+$as_echo "$gl_cv_func_chown_slash_works" >&6; }
+    case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+
+$as_echo "#define CHOWN_TRAILING_SLASH_BUG 1" >>confdefs.h
+
+        REPLACE_CHOWN=1
+        ;;
+    esac
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown always updates ctime" >&5
+$as_echo_n "checking whether chown always updates ctime... " >&6; }
+if ${gl_cv_func_chown_ctime_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_chown_ctime_works="guessing no" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+int
+main ()
+{
+    struct stat st1, st2;
+          if (close (creat ("conftest.file", 0600))) return 1;
+          if (stat ("conftest.file", &st1)) return 2;
+          sleep (1);
+          if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
+          if (stat ("conftest.file", &st2)) return 4;
+          if (st2.st_ctime <= st1.st_ctime) return 5;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_chown_ctime_works=yes
+else
+  gl_cv_func_chown_ctime_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_ctime_works" >&5
+$as_echo "$gl_cv_func_chown_ctime_works" >&6; }
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+
+$as_echo "#define CHOWN_CHANGE_TIME_BUG 1" >>confdefs.h
+
+        REPLACE_CHOWN=1
+        ;;
+    esac
+  fi
+
+
+
+
+
+  if test $ac_cv_func__set_invalid_parameter_handler = yes; then
+    HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
+
+$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h
+
+  else
+    HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
+  fi
+
+
+
+
+
+
+
+     GNULIB_OPENDIR=0;
+  GNULIB_READDIR=0;
+  GNULIB_REWINDDIR=0;
+  GNULIB_CLOSEDIR=0;
+  GNULIB_DIRFD=0;
+  GNULIB_FDOPENDIR=0;
+  GNULIB_SCANDIR=0;
+  GNULIB_ALPHASORT=0;
+    HAVE_OPENDIR=1;
+  HAVE_READDIR=1;
+  HAVE_REWINDDIR=1;
+  HAVE_CLOSEDIR=1;
+  HAVE_DECL_DIRFD=1;
+  HAVE_DECL_FDOPENDIR=1;
+  HAVE_FDOPENDIR=1;
+  HAVE_SCANDIR=1;
+  HAVE_ALPHASORT=1;
+  REPLACE_OPENDIR=0;
+  REPLACE_CLOSEDIR=0;
+  REPLACE_DIRFD=0;
+  REPLACE_FDOPENDIR=0;
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5
+$as_echo_n "checking whether the preprocessor supports include_next... " >&6; }
+if ${gl_cv_have_include_next+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -rf conftestd1a conftestd1b conftestd2
+     mkdir conftestd1a conftestd1b conftestd2
+                                                  cat <<EOF > conftestd1a/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+     cat <<EOF > conftestd1b/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include <stdio.h>
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+     cat <<EOF > conftestd2/conftest.h
+#ifndef DEFINED_IN_CONFTESTD1
+#error "include_next test doesn't work"
+#endif
+#define DEFINED_IN_CONFTESTD2
+EOF
+     gl_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <conftest.h>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_have_include_next=yes
+else
+  CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <conftest.h>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_have_include_next=buggy
+else
+  gl_cv_have_include_next=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     CPPFLAGS="$gl_save_CPPFLAGS"
+     rm -rf conftestd1a conftestd1b conftestd2
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5
+$as_echo "$gl_cv_have_include_next" >&6; }
+  PRAGMA_SYSTEM_HEADER=
+  if test $gl_cv_have_include_next = yes; then
+    INCLUDE_NEXT=include_next
+    INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    if test -n "$GCC"; then
+      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
+    fi
+  else
+    if test $gl_cv_have_include_next = buggy; then
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    else
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
+    fi
+  fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system header files limit the line length" >&5
+$as_echo_n "checking whether system header files limit the line length... " >&6; }
+if ${gl_cv_pragma_columns+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef __TANDEM
+choke me
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "choke me" >/dev/null 2>&1; then :
+  gl_cv_pragma_columns=yes
+else
+  gl_cv_pragma_columns=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pragma_columns" >&5
+$as_echo "$gl_cv_pragma_columns" >&6; }
+  if test $gl_cv_pragma_columns = yes; then
+    PRAGMA_COLUMNS="#pragma COLUMNS 10000"
+  else
+    PRAGMA_COLUMNS=
+  fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5
+$as_echo_n "checking if environ is properly declared... " >&6; }
+  if ${gt_cv_var_environ_declaration+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_UNISTD_H
+     #include <unistd.h>
+     #endif
+     /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+     #include <stdlib.h>
+
+           extern struct { int foo; } environ;
+int
+main ()
+{
+environ.foo = 1;
   ;
   return 0;
 }
@@ -8078,6 +8431,56 @@ fi
 
 
 
+ac_fn_c_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fchdir" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FCHDIR $ac_have_decl
+_ACEOF
+
+
+     GNULIB_FCHMODAT=0;
+  GNULIB_FSTAT=0;
+  GNULIB_FSTATAT=0;
+  GNULIB_FUTIMENS=0;
+  GNULIB_LCHMOD=0;
+  GNULIB_LSTAT=0;
+  GNULIB_MKDIRAT=0;
+  GNULIB_MKFIFO=0;
+  GNULIB_MKFIFOAT=0;
+  GNULIB_MKNOD=0;
+  GNULIB_MKNODAT=0;
+  GNULIB_STAT=0;
+  GNULIB_UTIMENSAT=0;
+    HAVE_FCHMODAT=1;
+  HAVE_FSTATAT=1;
+  HAVE_FUTIMENS=1;
+  HAVE_LCHMOD=1;
+  HAVE_LSTAT=1;
+  HAVE_MKDIRAT=1;
+  HAVE_MKFIFO=1;
+  HAVE_MKFIFOAT=1;
+  HAVE_MKNOD=1;
+  HAVE_MKNODAT=1;
+  HAVE_UTIMENSAT=1;
+  REPLACE_FSTAT=0;
+  REPLACE_FSTATAT=0;
+  REPLACE_FUTIMENS=0;
+  REPLACE_LSTAT=0;
+  REPLACE_MKDIR=0;
+  REPLACE_MKFIFO=0;
+  REPLACE_MKNOD=0;
+  REPLACE_STAT=0;
+  REPLACE_UTIMENSAT=0;
+
+
+
+
+
 
   GNULIB_FCNTL=0;
   GNULIB_NONBLOCKING=0;
@@ -8262,39 +8665,6 @@ _ACEOF
 fi
 
 
-     GNULIB_FCHMODAT=0;
-  GNULIB_FSTAT=0;
-  GNULIB_FSTATAT=0;
-  GNULIB_FUTIMENS=0;
-  GNULIB_LCHMOD=0;
-  GNULIB_LSTAT=0;
-  GNULIB_MKDIRAT=0;
-  GNULIB_MKFIFO=0;
-  GNULIB_MKFIFOAT=0;
-  GNULIB_MKNOD=0;
-  GNULIB_MKNODAT=0;
-  GNULIB_STAT=0;
-  GNULIB_UTIMENSAT=0;
-    HAVE_FCHMODAT=1;
-  HAVE_FSTATAT=1;
-  HAVE_FUTIMENS=1;
-  HAVE_LCHMOD=1;
-  HAVE_LSTAT=1;
-  HAVE_MKDIRAT=1;
-  HAVE_MKFIFO=1;
-  HAVE_MKFIFOAT=1;
-  HAVE_MKNOD=1;
-  HAVE_MKNODAT=1;
-  HAVE_UTIMENSAT=1;
-  REPLACE_FSTAT=0;
-  REPLACE_FSTATAT=0;
-  REPLACE_FUTIMENS=0;
-  REPLACE_LSTAT=0;
-  REPLACE_MKDIR=0;
-  REPLACE_MKFIFO=0;
-  REPLACE_MKNOD=0;
-  REPLACE_STAT=0;
-  REPLACE_UTIMENSAT=0;
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
 $as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
@@ -8535,6 +8905,175 @@ fi
 
 
 
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f conftest.sym conftest.file
+     echo >conftest.file
+     if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+       if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+              /* Linux will dereference the symlink and fail, as required by
+                 POSIX.  That is better in the sense that it means we will not
+                 have to compile and use the lstat wrapper.  */
+              return lstat ("conftest.sym/", &sbuf) == 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+  gl_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+     else
+       # If the 'ln -s' command failed, then we probably don't even
+       # have an lstat function.
+       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
+     fi
+     rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+    *yes)
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+      ;;
+  esac
+
+
+
+
+
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getcwd (NULL, 0) allocates memory for result" >&5
+$as_echo_n "checking whether getcwd (NULL, 0) allocates memory for result... " >&6; }
+if ${gl_cv_func_getcwd_null+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                     # Guess yes on glibc systems.
+            *-gnu*)  gl_cv_func_getcwd_null="guessing yes";;
+                     # Guess yes on Cygwin.
+            cygwin*) gl_cv_func_getcwd_null="guessing yes";;
+                     # If we don't know, assume the worst.
+            *)       gl_cv_func_getcwd_null="guessing no";;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#        if HAVE_UNISTD_H
+#         include <unistd.h>
+#        else /* on Windows with MSVC */
+#         include <direct.h>
+#        endif
+#        ifndef getcwd
+         char *getcwd ();
+#        endif
+
+int
+main ()
+{
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* mingw cwd does not start with '/', but getcwd does allocate.
+   However, mingw fails to honor non-zero size.  */
+#else
+           if (chdir ("/") != 0)
+             return 1;
+           else
+             {
+               char *f = getcwd (NULL, 0);
+               if (! f)
+                 return 2;
+               if (f[0] != '/')
+                 return 3;
+               if (f[1] != '\0')
+                 return 4;
+               return 0;
+             }
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getcwd_null=yes
+else
+  gl_cv_func_getcwd_null=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_null" >&5
+$as_echo "$gl_cv_func_getcwd_null" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getcwd with POSIX signature" >&5
+$as_echo_n "checking for getcwd with POSIX signature... " >&6; }
+if ${gl_cv_func_getcwd_posix_signature+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+int
+main ()
+{
+extern
+           #ifdef __cplusplus
+           "C"
+           #endif
+           char *getcwd (char *, size_t);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_getcwd_posix_signature=yes
+else
+  gl_cv_func_getcwd_posix_signature=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_posix_signature" >&5
+$as_echo "$gl_cv_func_getcwd_posix_signature" >&6; }
+
+
 
 
 
@@ -9472,8 +10011,6 @@ fi
 
 
 
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
 $as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
 if ${am_cv_langinfo_codeset+:} false; then :
@@ -9557,69 +10094,6 @@ $as_echo "$ac_cv_gnu_library_2_1" >&6; }
 
 
 
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-     echo >conftest.file
-     if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-       if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
-          esac
-
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-              /* Linux will dereference the symlink and fail, as required by
-                 POSIX.  That is better in the sense that it means we will not
-                 have to compile and use the lstat wrapper.  */
-              return lstat ("conftest.sym/", &sbuf) == 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  gl_cv_func_lstat_dereferences_slashed_symlink=yes
-else
-  gl_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-     else
-       # If the 'ln -s' command failed, then we probably don't even
-       # have an lstat function.
-       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
-     fi
-     rm -f conftest.sym conftest.file
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
-    *yes)
-
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
-
-      ;;
-  esac
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if ${ac_cv_path_SED+:} false; then :
@@ -10688,6 +11162,17 @@ $as_echo "$gl_cv_func_memchr_works" >&6; }
     fi
   fi
 
+ac_fn_c_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default"
+if test "x$ac_cv_have_decl_memrchr" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MEMRCHR $ac_have_decl
+_ACEOF
+
 
 
 
@@ -10765,6 +11250,8 @@ $as_echo "#define HAVE_MINMAX_IN_SYS_PARAM_H 1" >>confdefs.h
 
 
 
+
+
   GNULIB_MKTIME=0;
   GNULIB_NANOSLEEP=0;
   GNULIB_STRPTIME=0;
@@ -10836,6 +11323,43 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   fi
 
 
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5
+$as_echo_n "checking for promoted mode_t type... " >&6; }
+if ${gl_cv_promoted_mode_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+int
+main ()
+{
+typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_promoted_mode_t='int'
+else
+  gl_cv_promoted_mode_t='mode_t'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5
+$as_echo "$gl_cv_promoted_mode_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define PROMOTED_MODE_T $gl_cv_promoted_mode_t
+_ACEOF
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
 if ${ac_cv_header_stdbool_h+:} false; then :
@@ -11053,6 +11577,8 @@ fi
   REPLACE_RAISE=0;
 
 
+
+
   GNULIB_DPRINTF=0;
   GNULIB_FCLOSE=0;
   GNULIB_FDOPEN=0;
@@ -11158,6 +11684,8 @@ fi
 
 
 
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5
 $as_echo_n "checking for ssize_t... " >&6; }
 if ${gt_cv_ssize_t+:} false; then :
     HAVE_SIGSET_T=0
   fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if ${ac_cv_type_uid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "uid_t" >/dev/null 2>&1; then :
-  ac_cv_type_uid_t=yes
-else
-  ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
-
-$as_echo "#define uid_t int" >>confdefs.h
-
-
-$as_echo "#define gid_t int" >>confdefs.h
-
-fi
-
 
     REPLACE_NULL=0;
+  HAVE_MAX_ALIGN_T=1;
   HAVE_WCHAR_T=1;
 
 
 
 
 
+
+ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strdup" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRDUP $ac_have_decl
+_ACEOF
+
+
      REPLACE_STRERROR_0=0
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5
 $as_echo_n "checking whether strerror(0) succeeds... " >&6; }
@@ -12280,6 +12792,8 @@ _ACEOF
 
 
 
+
+
 
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_sys_types_h='<'sys/types.h'>'
@@ -12383,6 +12897,7 @@ $as_echo "$gl_cv_sys_struct_timespec_in_time_h" >&6; }
   TIME_H_DEFINES_STRUCT_TIMESPEC=0
   SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
   PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+  UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
   if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
     TIME_H_DEFINES_STRUCT_TIMESPEC=1
   else
 $as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; }
       if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
         PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <unistd.h>" >&5
+$as_echo_n "checking for struct timespec in <unistd.h>... " >&6; }
+if ${gl_cv_sys_struct_timespec_in_unistd_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+
+int
+main ()
+{
+static struct timespec x; x.tv_sec = x.tv_nsec;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timespec_in_unistd_h=yes
+else
+  gl_cv_sys_struct_timespec_in_unistd_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5
+$as_echo "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; }
+        if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+          UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+        fi
       fi
     fi
   fi
@@ -12461,6 +13006,7 @@ $as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; }
 
 
 
+
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_time_h='<'time.h'>'
      else
@@ -12530,6 +13076,8 @@ $as_echo "$gl_cv_next_time_h" >&6; }
 
 
 
+
+
 ac_fn_c_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default"
 if test "x$ac_cv_have_decl_unsetenv" = xyes; then :
   ac_have_decl=1
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS openat-proc.$ac_objext"
+
+
+
+
+
+
+
+
+
   if test $ac_cv_func_canonicalize_file_name = no; then
     HAVE_CANONICALIZE_FILE_NAME=0
     if test $ac_cv_func_realpath = no; then
   fi
 
 
-cat >>confdefs.h <<_ACEOF
-#define GNULIB_CANONICALIZE_LGPL 1
-_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_CANONICALIZE_LGPL 1
+_ACEOF
+
+
+
+
+
+
+
+          GNULIB_CANONICALIZE_FILE_NAME=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h
+
+
+
+
+
+
+
+
+          GNULIB_REALPATH=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_REALPATH 1" >>confdefs.h
+
+
+
+
+
+
+
+
+          GNULIB_CHDIR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_CHDIR 1" >>confdefs.h
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this system has an arbitrary file name length limit" >&5
+$as_echo_n "checking whether this system has an arbitrary file name length limit... " >&6; }
+if ${gl_cv_have_arbitrary_file_name_length_limit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Arrange to define PATH_MAX, like "pathmax.h" does. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#include <limits.h>
+#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
+# include <sys/param.h>
+#endif
+#if !defined PATH_MAX && defined MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+#endif
+#ifdef __hpux
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# undef PATH_MAX
+# define PATH_MAX 260
+#endif
+
+#ifdef PATH_MAX
+have_arbitrary_file_name_length_limit
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "have_arbitrary_file_name_length_limit" >/dev/null 2>&1; then :
+  gl_cv_have_arbitrary_file_name_length_limit=yes
+else
+  gl_cv_have_arbitrary_file_name_length_limit=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_arbitrary_file_name_length_limit" >&5
+$as_echo "$gl_cv_have_arbitrary_file_name_length_limit" >&6; }
+
+  if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then
 
 
 
@@ -13605,43 +14257,48 @@ _ACEOF
 
 
 
-          GNULIB_CANONICALIZE_FILE_NAME=1
 
+  gl_LIBOBJS="$gl_LIBOBJS chdir-long.$ac_objext"
 
+    :
+  fi
 
+  if test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1; then
 
 
-$as_echo "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h
 
 
 
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS chown.$ac_objext"
 
+  fi
+  if test $REPLACE_CHOWN = 1 && test $ac_cv_func_fchown = no; then
 
-          GNULIB_REALPATH=1
 
 
 
 
 
-$as_echo "#define GNULIB_TEST_REALPATH 1" >>confdefs.h
 
 
+  gl_LIBOBJS="$gl_LIBOBJS fchown-stub.$ac_objext"
 
+  fi
 
 
 
 
 
-          GNULIB_CHDIR=1
+          GNULIB_CHOWN=1
 
 
 
 
 
-$as_echo "#define GNULIB_TEST_CHDIR 1" >>confdefs.h
+$as_echo "#define GNULIB_TEST_CHOWN 1" >>confdefs.h
 
 
 
@@ -13730,6 +14387,11 @@ done
 
 
 
+$as_echo "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h
+
+
+
+
 
   if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
     REPLACE_CLOSE=1
@@ -13767,6 +14429,19 @@ done
     fi
 
 
+    if test $REPLACE_CLOSE = 0; then
+
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_CLOSE=1
+      fi
+    fi
+
 
   if test $REPLACE_CLOSE = 1; then
 
@@ -13814,6 +14489,19 @@ done
   fi
 
 
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+    if test $HAVE_FCHDIR = 0; then
+      if test $HAVE_CLOSEDIR = 1; then
+        REPLACE_CLOSEDIR=1
+      fi
+    fi
+
+
   if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then
 
 
@@ -14388,6 +15076,19 @@ done
   fi
 
 
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+    if test $HAVE_FCHDIR = 0; then
+      if test $HAVE_DUP2 = 1; then
+        REPLACE_DUP2=1
+      fi
+    fi
+
+
   if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
 
 
@@ -14474,9 +15175,297 @@ $as_echo "$ac_cv_lib_error_at_line" >&6; }
 
 
 
-  :
+  :
+
+  fi
+
+
+
+
+
+
+
+  if test $ac_cv_have_decl_fchdir = no; then
+    HAVE_DECL_FCHDIR=0
+  fi
+
+
+  if test $HAVE_FCHDIR = 0; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS fchdir.$ac_objext"
+
+    :
+
+$as_echo "#define REPLACE_FCHDIR 1" >>confdefs.h
+
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open can visit directories" >&5
+$as_echo_n "checking whether open can visit directories... " >&6; }
+if ${gl_cv_func_open_directory_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_open_directory_works="guessing no" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <fcntl.h>
+
+int
+main ()
+{
+return open(".", O_RDONLY) < 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_open_directory_works=yes
+else
+  gl_cv_func_open_directory_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_directory_works" >&5
+$as_echo "$gl_cv_func_open_directory_works" >&6; }
+    case "$gl_cv_func_open_directory_works" in
+      *yes) ;;
+      *)
+
+$as_echo "#define REPLACE_OPEN_DIRECTORY 1" >>confdefs.h
+
+        ;;
+    esac
+  fi
+
+
+
+
+
+
+          GNULIB_FCHDIR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHDIR 1" >>confdefs.h
+
+
+
+
+
+
+
+  if test $ac_cv_func_fchmodat != yes; then
+    HAVE_FCHMODAT=0
+  fi
+
+  if test $HAVE_FCHMODAT = 0; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS fchmodat.$ac_objext"
+
+  fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FCHMODAT 1
+_ACEOF
+
+
+
+
+
+
+          GNULIB_FCHMODAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHMODAT 1" >>confdefs.h
+
+
+
+
+
+
+
+  ac_fn_c_check_func "$LINENO" "fchownat" "ac_cv_func_fchownat"
+if test "x$ac_cv_func_fchownat" = xyes; then :
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fchownat works with AT_SYMLINK_NOFOLLOW" >&5
+$as_echo_n "checking whether fchownat works with AT_SYMLINK_NOFOLLOW... " >&6; }
+if ${gl_cv_func_fchownat_nofollow_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+     gl_dangle=conftest.dangle
+     # Remove any remnants of a previous test.
+     rm -f $gl_dangle
+     # Arrange for deletion of the temporary file this test creates.
+     ac_clean_files="$ac_clean_files $gl_dangle"
+     ln -s conftest.no-such $gl_dangle
+     if test "$cross_compiling" = yes; then :
+  gl_cv_func_fchownat_nofollow_works=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+  return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+                    AT_SYMLINK_NOFOLLOW) != 0
+          && errno == ENOENT);
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_fchownat_nofollow_works=yes
+else
+  gl_cv_func_fchownat_nofollow_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fchownat_nofollow_works" >&5
+$as_echo "$gl_cv_func_fchownat_nofollow_works" >&6; }
+  if test $gl_cv_func_fchownat_nofollow_works = no; then :
+  REPLACE_FCHOWNAT=1
+
+$as_echo "#define FCHOWNAT_NOFOLLOW_BUG 1" >>confdefs.h
+
+
+fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fchownat works with an empty file name" >&5
+$as_echo_n "checking whether fchownat works with an empty file name... " >&6; }
+if ${gl_cv_func_fchownat_empty_filename_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  gl_cv_func_fchownat_empty_filename_works="guessing no"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+            #include <fcntl.h>
+
+int
+main ()
+{
+int fd;
+            int ret;
+            if (mkdir ("conftestdir", 0700) < 0)
+              return 2;
+            fd = open ("conftestdir", O_RDONLY);
+            if (fd < 0)
+              return 3;
+            ret = fchownat (fd, "", -1, -1, 0);
+            close (fd);
+            rmdir ("conftestdir");
+            return ret == 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_fchownat_empty_filename_works=yes
+else
+  gl_cv_func_fchownat_empty_filename_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fchownat_empty_filename_works" >&5
+$as_echo "$gl_cv_func_fchownat_empty_filename_works" >&6; }
+  if test "$gl_cv_func_fchownat_empty_filename_works" != yes; then :
+  REPLACE_FCHOWNAT=1
+
+$as_echo "#define FCHOWNAT_EMPTY_FILENAME_BUG 1" >>confdefs.h
+
+
+fi
+
+     if test $REPLACE_CHOWN = 1; then
+       REPLACE_FCHOWNAT=1
+     fi
+else
+  HAVE_FCHOWNAT=0
+fi
+
+
+  if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS fchownat.$ac_objext"
+
+  fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FCHOWNAT 1
+_ACEOF
+
+
+
+
+
+
+          GNULIB_FCHOWNAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHOWNAT 1" >>confdefs.h
 
-  fi
 
 
 
@@ -14629,6 +15618,25 @@ $as_echo "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; }
   fi
 
 
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+    if test $HAVE_FCHDIR = 0; then
+
+
+
+  if test $ac_cv_func_fcntl = no; then
+    HAVE_FCNTL=0
+  else
+    REPLACE_FCNTL=1
+  fi
+
+    fi
+
+
   if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
 
 
@@ -14779,6 +15787,9 @@ fi
 
 
 
+
+
+
   FLOAT_H=
   REPLACE_FLOAT_LDBL=0
   case "$host_os" in
 
 
 
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+    if test $HAVE_FCHDIR = 0; then
+      case "$gl_cv_func_open_directory_works" in
+        *yes) ;;
+        *)
+          REPLACE_FSTAT=1
+          ;;
+      esac
+    fi
+
+
   if test $REPLACE_FSTAT = 1; then
 
 
@@ -15043,6 +16070,134 @@ $as_echo "#define GNULIB_TEST_FSTAT 1" >>confdefs.h
 
 
 
+
+
+  if test $ac_cv_func_fstatat = no; then
+    HAVE_FSTATAT=0
+  else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fstatat (..., 0) works" >&5
+$as_echo_n "checking whether fstatat (..., 0) works... " >&6; }
+if ${gl_cv_func_fstatat_zero_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+            aix*) gl_cv_func_fstatat_zero_flag="guessing no";;
+            *)    gl_cv_func_fstatat_zero_flag="guessing yes";;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+              #include <fcntl.h>
+              #include <sys/stat.h>
+              int
+              main (void)
+              {
+                struct stat a;
+                return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+              }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_fstatat_zero_flag=yes
+else
+  gl_cv_func_fstatat_zero_flag=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fstatat_zero_flag" >&5
+$as_echo "$gl_cv_func_fstatat_zero_flag" >&6; }
+
+    case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+    *yes+*yes) ;;
+    *) REPLACE_FSTATAT=1
+       case $gl_cv_func_fstatat_zero_flag in
+       *yes)
+
+$as_echo "#define HAVE_WORKING_FSTATAT_ZERO_FLAG 1" >>confdefs.h
+
+         ;;
+       esac
+       ;;
+    esac
+  fi
+
+  if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS fstatat.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_FSTATAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FSTATAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
+  case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+  *yes,yes) ;;
+  *)
+        REPLACE_GETCWD=1
+    ;;
+  esac
+
+  if test $REPLACE_GETCWD = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getcwd-lgpl.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_GETCWD=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_GETCWD 1" >>confdefs.h
+
+
+
+
+
+
+
   if test $ac_cv_func_getdtablesize = yes; then
     # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
     # up to an unchangeable hard limit; all other platforms correctly
@@ -15430,24 +16585,58 @@ $as_echo "#define GNULIB_TEST_GETTIMEOFDAY 1" >>confdefs.h
 
 
 
+  for ac_func in lchown
+do :
+  ac_fn_c_check_func "$LINENO" "lchown" "ac_cv_func_lchown"
+if test "x$ac_cv_func_lchown" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LCHOWN 1
+_ACEOF
 
+fi
+done
 
-  if test $ac_cv_func_lchmod = no; then
-    HAVE_LCHMOD=0
+  if test $ac_cv_func_lchown = no; then
+    HAVE_LCHOWN=0
+  else
+        case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
   fi
 
+  if test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1; then
+
+
+
+
+
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS lchown.$ac_objext"
+
+  fi
+
+
 
 
-          GNULIB_LCHMOD=1
 
+          GNULIB_LCHOWN=1
 
 
 
 
-$as_echo "#define GNULIB_TEST_LCHMOD 1" >>confdefs.h
+
+$as_echo "#define GNULIB_TEST_LCHOWN 1" >>confdefs.h
 
 
 
@@ -16553,6 +17742,106 @@ $as_echo "#define GNULIB_TEST_MEMCHR 1" >>confdefs.h
 
 
 
+
+  for ac_func in mempcpy
+do :
+  ac_fn_c_check_func "$LINENO" "mempcpy" "ac_cv_func_mempcpy"
+if test "x$ac_cv_func_mempcpy" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMPCPY 1
+_ACEOF
+
+fi
+done
+
+  if test $ac_cv_func_mempcpy = no; then
+    HAVE_MEMPCPY=0
+  fi
+
+  if test $HAVE_MEMPCPY = 0; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS mempcpy.$ac_objext"
+
+
+  :
+
+  fi
+
+
+
+
+
+          GNULIB_MEMPCPY=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MEMPCPY 1" >>confdefs.h
+
+
+
+
+
+
+
+
+  if test $ac_cv_have_decl_memrchr = no; then
+    HAVE_DECL_MEMRCHR=0
+  fi
+
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
+
+  if test $ac_cv_func_memrchr = no; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS memrchr.$ac_objext"
+
+    :
+  fi
+
+
+
+
+
+          GNULIB_MEMRCHR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MEMRCHR 1" >>confdefs.h
+
+
+
+
+
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir handles trailing slash" >&5
 $as_echo_n "checking whether mkdir handles trailing slash... " >&6; }
 if ${gl_cv_func_mkdir_trailing_slash_works+:} false; then :
@@ -16642,23 +17931,43 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-    rm -rf conftest.dir
+    rm -rf conftest.dir
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mkdir_trailing_dot_works" >&5
+$as_echo "$gl_cv_func_mkdir_trailing_dot_works" >&6; }
+  case "$gl_cv_func_mkdir_trailing_dot_works" in
+    *yes) ;;
+    *)
+      REPLACE_MKDIR=1
+
+$as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
+
+      ;;
+  esac
+
+  if test $REPLACE_MKDIR = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS mkdir.$ac_objext"
+
+  fi
 
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mkdir_trailing_dot_works" >&5
-$as_echo "$gl_cv_func_mkdir_trailing_dot_works" >&6; }
-  case "$gl_cv_func_mkdir_trailing_dot_works" in
-    *yes) ;;
-    *)
-      REPLACE_MKDIR=1
 
-$as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
 
-      ;;
-  esac
+  if test $ac_cv_func_mkdirat != yes; then
+    HAVE_MKDIRAT=0
+  fi
 
-  if test $REPLACE_MKDIR = 1; then
+  if test $HAVE_MKDIRAT = 0; then
 
 
 
@@ -16667,7 +17976,10 @@ $as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS mkdir.$ac_objext"
+  gl_LIBOBJS="$gl_LIBOBJS mkdirat.$ac_objext"
+
+
+
 
   fi
 
@@ -16675,6 +17987,21 @@ $as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
 
 
 
+          GNULIB_MKDIRAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MKDIRAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
 
   if test $APPLE_UNIVERSAL_BUILD = 1; then
     # A universal build on Apple Mac OS X platforms.
@@ -16980,6 +18307,179 @@ $as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h
 
 
 
+  case "$host_os" in
+    mingw* | pw*)
+      REPLACE_OPEN=1
+      ;;
+    *)
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5
+$as_echo_n "checking whether open recognizes a trailing slash... " >&6; }
+if ${gl_cv_func_open_slash+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # Assume that if we have lstat, we can also check symlinks.
+          if test $ac_cv_func_lstat = yes; then
+            touch conftest.tmp
+            ln -s conftest.tmp conftest.lnk
+          fi
+          if test "$cross_compiling" = yes; then :
+
+             case "$host_os" in
+               freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+                 gl_cv_func_open_slash="guessing no" ;;
+               *)
+                 gl_cv_func_open_slash="guessing yes" ;;
+             esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+int main ()
+{
+  int result = 0;
+#if HAVE_LSTAT
+  if (open ("conftest.lnk/", O_RDONLY) != -1)
+    result |= 1;
+#endif
+  if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
+    result |= 2;
+  return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_open_slash=yes
+else
+  gl_cv_func_open_slash=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+          rm -f conftest.sl conftest.tmp conftest.lnk
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5
+$as_echo "$gl_cv_func_open_slash" >&6; }
+      case "$gl_cv_func_open_slash" in
+        *no)
+
+$as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h
+
+          REPLACE_OPEN=1
+          ;;
+      esac
+      ;;
+  esac
+
+    if test $REPLACE_OPEN = 0; then
+
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_OPEN=1
+      fi
+    fi
+
+
+
+  if test $REPLACE_OPEN = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext"
+
+
+
+  :
+
+  fi
+
+
+
+
+
+          GNULIB_OPEN=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_OPEN 1" >>confdefs.h
+
+
+
+
+
+
+
+
+  case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
+  yes+*yes)
+    ;;
+  yes+*)
+    # Solaris 9 has *at functions, but uniformly mishandles trailing
+    # slash in all of them.
+    REPLACE_OPENAT=1
+    ;;
+  *)
+    HAVE_OPENAT=0
+    ;;
+  esac
+
+  if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS openat.$ac_objext"
+
+
+
+  :
+
+  fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_OPENAT 1
+_ACEOF
+
+
+
+
+
+
+          GNULIB_OPENAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_OPENAT 1" >>confdefs.h
+
+
+
+
+
 
   for ac_func in opendir
 do :
@@ -16997,6 +18497,19 @@ done
   fi
 
 
+
+
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+
+    if test $HAVE_FCHDIR = 0; then
+      if test $HAVE_OPENDIR = 1; then
+        REPLACE_OPENDIR=1
+      fi
+    fi
+
+
   if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then
 
 
@@ -17376,6 +18889,72 @@ $as_echo "#define GNULIB_TEST_READLINK 1" >>confdefs.h
 
 
 
+
+  if test $ac_cv_func_readlinkat = no; then
+    HAVE_READLINKAT=0
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlinkat signature is correct" >&5
+$as_echo_n "checking whether readlinkat signature is correct... " >&6; }
+if ${gl_cv_decl_readlinkat_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+             /* Check whether original declaration has correct type.  */
+             ssize_t readlinkat (int, char const *, char *, size_t);
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_decl_readlinkat_works=yes
+else
+  gl_cv_decl_readlinkat_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlinkat_works" >&5
+$as_echo "$gl_cv_decl_readlinkat_works" >&6; }
+    if test "$gl_cv_decl_readlink_works" != yes; then
+      REPLACE_READLINKAT=1
+    fi
+  fi
+
+  if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS readlinkat.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_READLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_READLINKAT 1" >>confdefs.h
+
+
+
+
+
+
       for ac_header in stdlib.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
@@ -17798,13 +19377,64 @@ $as_echo "#define RENAME_DEST_EXISTS_BUG 1" >>confdefs.h
 
 
 
-          GNULIB_RENAME=1
+          GNULIB_RENAME=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_RENAME 1" >>confdefs.h
+
+
+
+
+
+
+
+
+
+  if test $ac_cv_func_renameat = no; then
+    HAVE_RENAMEAT=0
+  elif test $REPLACE_RENAME = 1; then
+        REPLACE_RENAMEAT=1
+  fi
+
+  if test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS renameat.$ac_objext"
+
+  fi
+  if test $HAVE_RENAMEAT = 0; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS at-func2.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_RENAMEAT=1
 
 
 
 
 
-$as_echo "#define GNULIB_TEST_RENAME 1" >>confdefs.h
+$as_echo "#define GNULIB_TEST_RENAMEAT 1" >>confdefs.h
 
 
 
@@ -17910,6 +19540,9 @@ $as_echo "#define GNULIB_TEST_RMDIR 1" >>confdefs.h
 
 
 
+
+
+
   if test $ac_cv_func_secure_getenv = no; then
     HAVE_SECURE_GETENV=0
   fi
 
 
 
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_STATAT 1
+_ACEOF
+
+
   STDARG_H=''
   NEXT_STDARG_H='<stdarg.h>'
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
 
 
   STDDEF_H=
+  ac_fn_c_check_type "$LINENO" "max_align_t" "ac_cv_type_max_align_t" "#include <stddef.h>
+
+"
+if test "x$ac_cv_type_max_align_t" = xyes; then :
+
+else
+  HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h
+fi
+
   if test $gt_cv_c_wchar_t = no; then
     HAVE_WCHAR_T=0
     STDDEF_H=stddef.h
@@ -18949,6 +20597,8 @@ $as_echo "$gl_cv_next_stddef_h" >&6; }
 
 
 
+
+
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_stdio_h='<'stdio.h'>'
      else
@@ -19013,6 +20663,36 @@ $as_echo "$gl_cv_next_stdio_h" >&6; }
 
 
 
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether inttypes macros match system or gnu printf" >&5
+$as_echo_n "checking whether inttypes macros match system or gnu printf... " >&6; }
+if ${gl_cv_func_printf_attribute_flavor+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define __STDC_FORMAT_MACROS 1
+       #include <stdio.h>
+       #include <inttypes.h>
+       findme PRIdMAX findme
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "findme .(ll|j)d. findme" >/dev/null 2>&1; then :
+  gl_cv_func_printf_attribute_flavor=gnu
+else
+  gl_cv_func_printf_attribute_flavor=system
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5
+$as_echo "$gl_cv_func_printf_attribute_flavor" >&6; }
+  if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
+
+$as_echo "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h
+
+  fi
+
       GNULIB_FSCANF=1
 
 
 
 
 
+  if test $ac_cv_func_strdup = yes; then
+    if test $gl_cv_func_malloc_posix != yes; then
+      REPLACE_STRDUP=1
+    fi
+  fi
+
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+
+  if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext"
+
+    :
+  fi
+
+
+
+
+
+          GNULIB_STRDUP=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_STRDUP 1" >>confdefs.h
+
+
+
+
+
+
+
 
   if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5
@@ -19631,6 +21353,97 @@ $as_echo "#define GNULIB_TEST_SYMLINK 1" >>confdefs.h
 
 
 
+  if test $ac_cv_func_symlinkat = no; then
+    HAVE_SYMLINKAT=0
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symlinkat handles trailing slash correctly" >&5
+$as_echo_n "checking whether symlinkat handles trailing slash correctly... " >&6; }
+if ${gl_cv_func_symlinkat_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_symlinkat_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_symlinkat_works="guessing no" ;;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <fcntl.h>
+             #include <unistd.h>
+
+int
+main ()
+{
+int result = 0;
+             if (!symlinkat ("a", AT_FDCWD, "conftest.link/"))
+               result |= 1;
+             if (symlinkat ("conftest.f", AT_FDCWD, "conftest.lnk2"))
+               result |= 2;
+             else if (!symlinkat ("a", AT_FDCWD, "conftest.lnk2/"))
+               result |= 4;
+             return result;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_symlinkat_works=yes
+else
+  gl_cv_func_symlinkat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.f conftest.link conftest.lnk2
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlinkat_works" >&5
+$as_echo "$gl_cv_func_symlinkat_works" >&6; }
+    case "$gl_cv_func_symlinkat_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINKAT=1
+        ;;
+    esac
+  fi
+
+  if test $HAVE_SYMLINKAT = 0 || test $REPLACE_SYMLINKAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS symlinkat.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_SYMLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_SYMLINKAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
 
 
 
@@ -20222,6 +22035,57 @@ $as_echo "#define GNULIB_TEST_UNLINK 1" >>confdefs.h
 
 
 
+
+
+
+  if test $ac_cv_func_unlinkat = no; then
+    HAVE_UNLINKAT=0
+  else
+    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+      *no)
+        # Solaris 9 has *at functions, but uniformly mishandles trailing
+        # slash in all of them.
+        REPLACE_UNLINKAT=1
+        ;;
+      *)
+        # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+        if test $REPLACE_UNLINK = 1; then
+          REPLACE_UNLINKAT=1
+        fi
+        ;;
+    esac
+  fi
+
+  if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS unlinkat.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_UNLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_UNLINKAT 1" >>confdefs.h
+
+
+
+
+
+
   if test $ac_cv_have_decl_unsetenv = no; then
     HAVE_DECL_UNSETENV=0
   fi
@@ -20442,6 +22306,130 @@ $as_echo "#define FUTIMESAT_NULL_BUG 1" >>confdefs.h
 
 
 
+
+
+  if test $ac_cv_func_utimensat = no; then
+    HAVE_UTIMENSAT=0
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utimensat works" >&5
+$as_echo_n "checking whether utimensat works... " >&6; }
+if ${gl_cv_func_utimensat_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  gl_cv_func_utimensat_works="guessing no"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+int
+main ()
+{
+int result = 0;
+              const char *f = "conftest.file";
+              if (close (creat (f, 0600)))
+                return 1;
+              /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported.  */
+              {
+                if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+                  result |= 2;
+              }
+              /* Test whether UTIME_NOW and UTIME_OMIT work.  */
+              {
+                struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 4;
+              }
+              sleep (1);
+              {
+                struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } };
+                struct stat st;
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 8;
+                if (stat (f, &st))
+                  result |= 16;
+                else if (st.st_ctime < st.st_atime)
+                  result |= 32;
+              }
+              return result;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef __linux__
+/* The Linux kernel added utimensat in 2.6.22, but has bugs with UTIME_OMIT
+   in several file systems as recently as 2.6.32.  Always replace utimensat
+   to support older kernels.  */
+choke me
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_utimensat_works=yes
+else
+  gl_cv_func_utimensat_works="needs runtime check"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  gl_cv_func_utimensat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_utimensat_works" >&5
+$as_echo "$gl_cv_func_utimensat_works" >&6; }
+    if test "$gl_cv_func_utimensat_works" != yes; then
+      REPLACE_UTIMENSAT=1
+    fi
+  fi
+
+  if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS utimensat.$ac_objext"
+
+  fi
+
+
+
+
+
+          GNULIB_UTIMENSAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_UTIMENSAT 1" >>confdefs.h
+
+
+
+
+
   if test $ac_cv_func_vasnprintf = no; then
 
 
@@ -23003,7 +24991,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GNU patch $as_me 2.7.3, which was
+This file was extended by GNU patch $as_me 2.7.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23075,7 +25063,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GNU patch config.status 2.7.3
+GNU patch config.status 2.7.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index d3e2e3d4e8fe1a5296427042b09b8212a2c57751..bc3e54481545228ffdafd5728aac840bdfec6050 100644 (file)
@@ -14,7 +14,7 @@
 
 @SET_MAKE@
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fcntl-h full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile lchmod linked-list lstat maintainer-makefile malloc manywarnings memchr minmax mkdir progname quotearg readlink realloc rename rmdir setenv signal ssize_t stat-time stdbool stdlib symlink sys_stat tempname time unistd unlink update-copyright utimens verror xalloc xlist xmemdup0
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fchmodat fchownat fcntl-h fstatat full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile linked-list maintainer-makefile malloc manywarnings memchr minmax mkdirat openat progname quotearg readlinkat realloc renameat setenv signal ssize_t stat-time stdbool stdlib symlinkat sys_stat tempname time unistd unlinkat update-copyright utimensat verror xalloc xlist xmemdup0
 
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
@@ -109,6 +109,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
        $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
+       $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
        $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
        $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
        $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
@@ -118,52 +119,61 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
        $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
        $(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
-       $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+       $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+       $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+       $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
        $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+       $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
        $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
        $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/gnulib-comp.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
        $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
-       $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
        $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
        $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
        $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
        $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
        $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
        $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
        $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+       $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+       $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
        $(top_srcdir)/m4/msvc-inval.m4 \
        $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
        $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+       $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
        $(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
        $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
        $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
        $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
-       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
-       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+       $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+       $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
        $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
-       $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
-       $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
-       $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
-       $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
-       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
-       $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+       $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+       $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+       $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
        $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
        $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
-       $(top_srcdir)/m4/sys_socket_h.m4 \
+       $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
        $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
        $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
        $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
        $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
        $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
-       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+       $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+       $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
        $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
        $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
        $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
@@ -187,19 +197,22 @@ libpatch_a_AR = $(AR) $(ARFLAGS)
 am__DEPENDENCIES_1 =
 am_libpatch_a_OBJECTS = argmatch.$(OBJEXT) backupfile.$(OBJEXT) \
        bitrotate.$(OBJEXT) c-ctype.$(OBJEXT) c-strcasecmp.$(OBJEXT) \
-       c-strncasecmp.$(OBJEXT) opendir-safer.$(OBJEXT) \
-       dirname.$(OBJEXT) basename.$(OBJEXT) dirname-lgpl.$(OBJEXT) \
-       basename-lgpl.$(OBJEXT) stripslash.$(OBJEXT) \
-       exitfail.$(OBJEXT) fd-hook.$(OBJEXT) full-write.$(OBJEXT) \
-       gettime.$(OBJEXT) hash.$(OBJEXT) gl_linked_list.$(OBJEXT) \
-       gl_list.$(OBJEXT) localcharset.$(OBJEXT) malloca.$(OBJEXT) \
+       c-strncasecmp.$(OBJEXT) cloexec.$(OBJEXT) \
+       opendir-safer.$(OBJEXT) dirname.$(OBJEXT) basename.$(OBJEXT) \
+       dirname-lgpl.$(OBJEXT) basename-lgpl.$(OBJEXT) \
+       stripslash.$(OBJEXT) exitfail.$(OBJEXT) chmodat.$(OBJEXT) \
+       chownat.$(OBJEXT) fd-hook.$(OBJEXT) filenamecat-lgpl.$(OBJEXT) \
+       full-write.$(OBJEXT) gettime.$(OBJEXT) hash.$(OBJEXT) \
+       gl_linked_list.$(OBJEXT) gl_list.$(OBJEXT) \
+       localcharset.$(OBJEXT) malloca.$(OBJEXT) openat-die.$(OBJEXT) \
        parse-datetime.$(OBJEXT) progname.$(OBJEXT) quotearg.$(OBJEXT) \
-       safe-write.$(OBJEXT) stat-time.$(OBJEXT) tempname.$(OBJEXT) \
-       timespec.$(OBJEXT) unistd.$(OBJEXT) dup-safer.$(OBJEXT) \
-       fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) utimens.$(OBJEXT) \
-       verror.$(OBJEXT) wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) \
-       xalloc-die.$(OBJEXT) gl_xlist.$(OBJEXT) xsize.$(OBJEXT) \
-       xstrndup.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
+       safe-write.$(OBJEXT) save-cwd.$(OBJEXT) stat-time.$(OBJEXT) \
+       statat.$(OBJEXT) tempname.$(OBJEXT) timespec.$(OBJEXT) \
+       unistd.$(OBJEXT) dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) \
+       pipe-safer.$(OBJEXT) utimens.$(OBJEXT) verror.$(OBJEXT) \
+       wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) \
+       gl_xlist.$(OBJEXT) xsize.$(OBJEXT) xstrndup.$(OBJEXT) \
+       xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
 libpatch_a_OBJECTS = $(am_libpatch_a_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -641,6 +654,7 @@ HAVE_LINK = @HAVE_LINK@
 HAVE_LINKAT = @HAVE_LINKAT@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
 HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBRLEN = @HAVE_MBRLEN@
 HAVE_MBRTOWC = @HAVE_MBRTOWC@
 HAVE_MBSINIT = @HAVE_MBSINIT@
@@ -997,6 +1011,7 @@ STRIP = @STRIP@
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
 UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 VERSION = @VERSION@
@@ -1085,42 +1100,49 @@ BUILT_SOURCES = $(ALLOCA_H) configmake.h dirent.h $(ERRNO_H) fcntl.h \
        sys/types.h time.h unistd.h wchar.h wctype.h
 CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
        ref-del.sed
-EXTRA_DIST = alloca.in.h argmatch.h backupfile.h c-strcaseeq.h \
-       canonicalize-lgpl.c close.c closedir.c dirent-private.h \
-       dirent.in.h dirent--.h dirent-safer.h dirfd.c stripslash.c \
-       dirname.h dosname.h dup2.c errno.in.h error.c error.h \
-       exitfail.h fcntl.c fcntl.in.h fd-hook.h filename.h float.c \
-       float.in.h itold.c fstat.c getdate.h getdtablesize.c getopt.c \
-       getopt.in.h getopt1.c getopt_int.h gettimeofday.c \
+EXTRA_DIST = alloca.in.h argmatch.h assure.h openat-priv.h \
+       openat-proc.c backupfile.h c-strcaseeq.h canonicalize-lgpl.c \
+       chdir-long.c chdir-long.h chown.c fchown-stub.c cloexec.h \
+       close.c closedir.c dirent-private.h dirent.in.h dirent--.h \
+       dirent-safer.h dirfd.c stripslash.c dirname.h dosname.h dup2.c \
+       errno.in.h error.c error.h exitfail.h fchdir.c at-func.c \
+       fchmodat.c at-func.c fchownat.c fcntl.c fcntl.in.h fd-hook.h \
+       filename.h filenamecat.h float.c float.in.h itold.c fstat.c \
+       at-func.c fstatat.c getcwd-lgpl.c getdate.h getdtablesize.c \
+       getopt.c getopt.in.h getopt1.c getopt_int.h gettimeofday.c \
        $(top_srcdir)/build-aux/git-version-gen \
        $(top_srcdir)/build-aux/gitlog-to-changelog \
        $(top_srcdir)/GNUmakefile hash.h ignore-value.h intprops.h \
-       config.charset ref-add.sin ref-del.sin lstat.c \
+       lchown.c config.charset ref-add.sin ref-del.sin lstat.c \
        $(top_srcdir)/maint.mk malloc.c malloc.c malloca.h \
        malloca.valgrind mbrtowc.c mbsinit.c memchr.c memchr.valgrind \
-       mkdir.c mktime-internal.h mktime.c msvc-inval.c msvc-inval.h \
-       msvc-nothrow.c msvc-nothrow.h dirent-private.h opendir.c \
-       parse-datetime.c parse-datetime.h pathmax.h quote.h quote.h \
-       quotearg.h raise.c dirent-private.h readdir.c readlink.c \
-       realloc.c realloc.c rename.c rmdir.c safe-read.c safe-write.h \
-       same-inode.h secure_getenv.c setenv.c signal.in.h \
-       $(top_srcdir)/build-aux/snippet/_Noreturn.h \
+       mempcpy.c memrchr.c mkdir.c at-func.c mkdirat.c \
+       mktime-internal.h mktime.c msvc-inval.c msvc-inval.h \
+       msvc-nothrow.c msvc-nothrow.h open.c openat.c openat.h \
+       dirent-private.h opendir.c parse-datetime.c parse-datetime.h \
+       pathmax.h quote.h quote.h quotearg.h raise.c dirent-private.h \
+       readdir.c readlink.c at-func.c readlinkat.c realloc.c \
+       realloc.c rename.c at-func2.c renameat.c rmdir.c safe-read.c \
+       safe-write.h same-inode.h save-cwd.h secure_getenv.c setenv.c \
+       signal.in.h $(top_srcdir)/build-aux/snippet/_Noreturn.h \
        $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
        $(top_srcdir)/build-aux/snippet/c++defs.h \
        $(top_srcdir)/build-aux/snippet/warn-on-use.h stat.c \
        stat-time.h stdarg.in.h stdbool.in.h stddef.in.h stdint.in.h \
-       stdio.in.h stdlib.in.h streq.h strerror.c strerror-override.c \
-       strerror-override.h string.in.h strndup.c strnlen.c symlink.c \
-       sys_stat.in.h sys_time.in.h sys_types.in.h tempname.h \
-       time.in.h time_r.c timespec.h unistd.in.h unistd--.h \
-       unistd-safer.h unlink.c unsetenv.c \
+       stdio.in.h stdlib.in.h strdup.c streq.h strerror.c \
+       strerror-override.c strerror-override.h string.in.h strndup.c \
+       strnlen.c symlink.c at-func.c symlinkat.c sys_stat.in.h \
+       sys_time.in.h sys_types.in.h tempname.h time.in.h time_r.c \
+       timespec.h unistd.in.h unistd--.h unistd-safer.h unlink.c \
+       at-func.c unlinkat.c unsetenv.c \
        $(top_srcdir)/build-aux/update-copyright \
        $(top_srcdir)/build-aux/useless-if-before-free utimens.h \
-       asnprintf.c float+.h printf-args.c printf-args.h \
-       printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
-       asprintf.c vasprintf.c $(top_srcdir)/build-aux/vc-list-files \
-       verify.h wchar.in.h wctype.in.h write.c xalloc.h \
-       xalloc-oversized.h xmemdup0.c xmemdup0.h xalloc.h
+       at-func.c utimensat.c asnprintf.c float+.h printf-args.c \
+       printf-args.h printf-parse.c printf-parse.h vasnprintf.c \
+       vasnprintf.h asprintf.c vasprintf.c \
+       $(top_srcdir)/build-aux/vc-list-files verify.h wchar.in.h \
+       wctype.in.h write.c xalloc.h xalloc-oversized.h xmemdup0.c \
+       xmemdup0.h xalloc.h
 MAINTAINERCLEANFILES = parse-datetime.c
 MOSTLYCLEANDIRS = sys
 MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t dirent.h \
@@ -1137,29 +1159,36 @@ SUFFIXES = .sed .sin
 noinst_LIBRARIES = libpatch.a
 libpatch_a_SOURCES = argmatch.c backupfile.c bitrotate.h bitrotate.c \
        c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c c-strncasecmp.c \
-       diffseq.h opendir-safer.c dirname.c basename.c dirname-lgpl.c \
-       basename-lgpl.c stripslash.c exitfail.c fd-hook.c full-write.h \
+       cloexec.c diffseq.h opendir-safer.c dirname.c basename.c \
+       dirname-lgpl.c basename-lgpl.c stripslash.c exitfail.c \
+       chmodat.c chownat.c fd-hook.c filenamecat-lgpl.c full-write.h \
        full-write.c gettext.h gettime.c hash.c gl_linked_list.h \
        gl_linked_list.c gl_anylinked_list1.h gl_anylinked_list2.h \
        gl_list.h gl_list.c localcharset.h localcharset.c malloca.c \
-       minmax.h parse-datetime.y progname.h progname.c quotearg.c \
-       safe-write.c size_max.h stat-time.c tempname.c timespec.c \
-       unistd.c dup-safer.c fd-safer.c pipe-safer.c utimens.c \
-       verror.h verror.c wctype-h.c xmalloc.c xalloc-die.c gl_xlist.h \
-       gl_xlist.c xsize.h xsize.c xstrndup.h xstrndup.c xvasprintf.h \
-       xvasprintf.c xasprintf.c
+       minmax.h openat-die.c parse-datetime.y progname.h progname.c \
+       quotearg.c safe-write.c save-cwd.c size_max.h stat-time.c \
+       statat.c tempname.c timespec.c unistd.c dup-safer.c fd-safer.c \
+       pipe-safer.c utimens.c verror.h verror.c wctype-h.c xmalloc.c \
+       xalloc-die.c gl_xlist.h gl_xlist.c xsize.h xsize.c xstrndup.h \
+       xstrndup.c xvasprintf.h xvasprintf.c xasprintf.c
 libpatch_a_LIBADD = $(gl_LIBOBJS)
 libpatch_a_DEPENDENCIES = $(gl_LIBOBJS)
-EXTRA_libpatch_a_SOURCES = canonicalize-lgpl.c close.c closedir.c \
-       dirfd.c stripslash.c dup2.c error.c fcntl.c float.c itold.c \
-       fstat.c getdtablesize.c getopt.c getopt1.c gettimeofday.c \
-       lstat.c malloc.c malloc.c mbrtowc.c mbsinit.c memchr.c mkdir.c \
-       mktime.c msvc-inval.c msvc-nothrow.c opendir.c raise.c \
-       readdir.c readlink.c realloc.c realloc.c rename.c rmdir.c \
-       safe-read.c secure_getenv.c setenv.c stat.c strerror.c \
-       strerror-override.c strndup.c strnlen.c symlink.c time_r.c \
-       unlink.c unsetenv.c asnprintf.c printf-args.c printf-parse.c \
-       vasnprintf.c asprintf.c vasprintf.c write.c xmemdup0.c
+EXTRA_libpatch_a_SOURCES = openat-proc.c canonicalize-lgpl.c \
+       chdir-long.c chown.c fchown-stub.c close.c closedir.c dirfd.c \
+       stripslash.c dup2.c error.c fchdir.c at-func.c fchmodat.c \
+       at-func.c fchownat.c fcntl.c float.c itold.c fstat.c at-func.c \
+       fstatat.c getcwd-lgpl.c getdtablesize.c getopt.c getopt1.c \
+       gettimeofday.c lchown.c lstat.c malloc.c malloc.c mbrtowc.c \
+       mbsinit.c memchr.c mempcpy.c memrchr.c mkdir.c at-func.c \
+       mkdirat.c mktime.c msvc-inval.c msvc-nothrow.c open.c openat.c \
+       opendir.c raise.c readdir.c readlink.c at-func.c readlinkat.c \
+       realloc.c realloc.c rename.c at-func2.c renameat.c rmdir.c \
+       safe-read.c secure_getenv.c setenv.c stat.c strdup.c \
+       strerror.c strerror-override.c strndup.c strnlen.c symlink.c \
+       at-func.c symlinkat.c time_r.c unlink.c at-func.c unlinkat.c \
+       unsetenv.c at-func.c utimensat.c asnprintf.c printf-args.c \
+       printf-parse.c vasnprintf.c asprintf.c vasprintf.c write.c \
+       xmemdup0.c
 
 # Use this preprocessor expression to decide whether #include_next works.
 # Do not rely on a 'configure'-time test for this, since the expression
@@ -1229,6 +1258,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backupfile.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
@@ -1237,6 +1268,11 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize-lgpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chmodat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chown.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chownat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closedir.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@
@@ -1246,12 +1282,19 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchdir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchmodat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchown-stub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchownat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcntl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-hook.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat-lgpl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
@@ -1262,6 +1305,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_xlist.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lchown.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@
@@ -1269,10 +1313,17 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbrtowc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsinit.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memrchr.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdirat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-inval.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-nothrow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-die.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-proc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendir-safer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendir.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-datetime.Po@am__quote@
@@ -1284,28 +1335,36 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raise.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdir.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlinkat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renameat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-read.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/save-cwd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secure_getenv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror-override.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlinkat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempname.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timespec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlinkat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimens.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimensat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verror.Po@am__quote@
@@ -1886,6 +1945,7 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
 @GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
 @GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
 @GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+@GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
 @GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
 @GL_GENERATE_STDDEF_H_TRUE@          -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
 @GL_GENERATE_STDDEF_H_TRUE@          < $(srcdir)/stddef.in.h; \
@@ -2360,6 +2420,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
index 5de9aaabc494b7c26a46422d893fd024d889a630..906fe92379d9b11064ca152fd9e2d1e6827f28bd 100644 (file)
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2014 Free Software Foundation,
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify it
index f56ab55f727cf04575f1348a2523530387b0ee0f..0e452bd1cba07deb9eceaa2286a5d30888237fe3 100644 (file)
@@ -1,6 +1,6 @@
 /* argmatch.c -- find a match for a string in an array
 
-   Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2014 Free Software
+   Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 09645db65762c33c55fbd9fa77ed00f37e9e2b47..bbbfe64dfb5a97a42461a2e5690638ad985247cc 100644 (file)
@@ -1,6 +1,6 @@
 /* argmatch.h -- definitions and prototypes for argmatch.c
 
-   Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2014 Free Software
+   Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 0c62197f79a0da3fe4001d758b1963747341891c..d6776caab273004f066763b54a986f41c78fa535 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009-2015 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
index 9a69ac480652e38dd70be075858d3b5038ec4af5..06ae3dd7f7e69c5e476bd16bf52cd5b08b20abf0 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007, 2009-2014 Free Software Foundation,
+   Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/assure.h b/lib/assure.h
new file mode 100644 (file)
index 0000000..f44f380
--- /dev/null
@@ -0,0 +1,37 @@
+/* Run-time assert-like macros.
+
+   Copyright (C) 2014-2015 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 Paul Eggert.  */
+
+#ifndef _GL_ASSURE_H
+#define _GL_ASSURE_H
+
+#include <assert.h>
+
+/* Check E's value at runtime, and report an error and abort if not.
+   However, do nothng if NDEBUG is defined.
+
+   Unlike standard 'assert', this macro always compiles E even when NDEBUG
+   is defined, so as to catch typos and avoid some GCC warnings.  */
+
+#ifdef NDEBUG
+# define assure(E) ((void) (0 && (E)))
+#else
+# define assure(E) assert (E)
+#endif
+
+#endif
diff --git a/lib/at-func.c b/lib/at-func.c
new file mode 100644 (file)
index 0000000..bbbe458
--- /dev/null
@@ -0,0 +1,146 @@
+/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
+   Copyright (C) 2006, 2009-2015 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 Jim Meyering */
+
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+# include <errno.h>
+# ifndef ENOTSUP
+#  define ENOTSUP EINVAL
+# endif
+#else
+# include "openat.h"
+# include "openat-priv.h"
+# include "save-cwd.h"
+#endif
+
+#ifdef AT_FUNC_USE_F1_COND
+# define CALL_FUNC(F)                           \
+  (flag == AT_FUNC_USE_F1_COND                  \
+    ? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS)     \
+    : AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F)                       \
+  if (flag & ~AT_FUNC_USE_F1_COND)              \
+    {                                           \
+      errno = EINVAL;                           \
+      return FUNC_FAIL;                         \
+    }
+#else
+# define CALL_FUNC(F) (AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F) /* empty */
+#endif
+
+#ifdef AT_FUNC_RESULT
+# define FUNC_RESULT AT_FUNC_RESULT
+#else
+# define FUNC_RESULT int
+#endif
+
+#ifdef AT_FUNC_FAIL
+# define FUNC_FAIL AT_FUNC_FAIL
+#else
+# define FUNC_FAIL -1
+#endif
+
+/* Call AT_FUNC_F1 to operate on FILE, which is in the directory
+   open on descriptor FD.  If AT_FUNC_USE_F1_COND is defined to a value,
+   AT_FUNC_POST_FILE_PARAM_DECLS must include a parameter named flag;
+   call AT_FUNC_F2 if FLAG is 0 or fail if FLAG contains more bits than
+   AT_FUNC_USE_F1_COND.  Return int and fail with -1 unless AT_FUNC_RESULT
+   or AT_FUNC_FAIL are defined.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then AT_FUNC_F?/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+FUNC_RESULT
+AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
+{
+  VALIDATE_FLAG (flag);
+
+  if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+    return CALL_FUNC (file);
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+  errno = ENOTSUP;
+  return FUNC_FAIL;
+#else
+  {
+  /* Be careful to choose names unlikely to conflict with
+     AT_FUNC_POST_FILE_PARAM_DECLS.  */
+  struct saved_cwd saved_cwd;
+  int saved_errno;
+  FUNC_RESULT err;
+
+  {
+    char proc_buf[OPENAT_BUFFER_SIZE];
+    char *proc_file = openat_proc_name (proc_buf, fd, file);
+    if (proc_file)
+      {
+        FUNC_RESULT proc_result = CALL_FUNC (proc_file);
+        int proc_errno = errno;
+        if (proc_file != proc_buf)
+          free (proc_file);
+        /* If the syscall succeeds, or if it fails with an unexpected
+           errno value, then return right away.  Otherwise, fall through
+           and resort to using save_cwd/restore_cwd.  */
+        if (FUNC_FAIL != proc_result)
+          return proc_result;
+        if (! EXPECTED_ERRNO (proc_errno))
+          {
+            errno = proc_errno;
+            return proc_result;
+          }
+      }
+  }
+
+  if (save_cwd (&saved_cwd) != 0)
+    openat_save_fail (errno);
+  if (0 <= fd && fd == saved_cwd.desc)
+    {
+      /* If saving the working directory collides with the user's
+         requested fd, then the user's fd must have been closed to
+         begin with.  */
+      free_cwd (&saved_cwd);
+      errno = EBADF;
+      return FUNC_FAIL;
+    }
+
+  if (fchdir (fd) != 0)
+    {
+      saved_errno = errno;
+      free_cwd (&saved_cwd);
+      errno = saved_errno;
+      return FUNC_FAIL;
+    }
+
+  err = CALL_FUNC (file);
+  saved_errno = (err == FUNC_FAIL ? errno : 0);
+
+  if (restore_cwd (&saved_cwd) != 0)
+    openat_restore_fail (errno);
+
+  free_cwd (&saved_cwd);
+
+  if (saved_errno)
+    errno = saved_errno;
+  return err;
+  }
+#endif
+}
+#undef CALL_FUNC
+#undef FUNC_RESULT
+#undef FUNC_FAIL
diff --git a/lib/at-func2.c b/lib/at-func2.c
new file mode 100644 (file)
index 0000000..32a64ff
--- /dev/null
@@ -0,0 +1,282 @@
+/* Define 2-FD at-style functions like linkat or renameat.
+   Copyright (C) 2006, 2009-2015 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 Jim Meyering and Eric Blake */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "filenamecat.h"
+#include "openat.h"
+#include "same-inode.h"
+#include "save-cwd.h"
+
+/* Call FUNC to operate on a pair of files, where FILE1 is relative to FD1,
+   and FILE2 is relative to FD2.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   FUNC, restore_cwd (up to two times).  If either the save_cwd or the
+   restore_cwd fails, then give a diagnostic and exit nonzero.  */
+int
+at_func2 (int fd1, char const *file1,
+          int fd2, char const *file2,
+          int (*func) (char const *file1, char const *file2))
+{
+  struct saved_cwd saved_cwd;
+  int saved_errno;
+  int err;
+  char *file1_alt;
+  char *file2_alt;
+  struct stat st1;
+  struct stat st2;
+
+  /* There are 16 possible scenarios, based on whether an fd is
+     AT_FDCWD or real, and whether a file is absolute or relative:
+
+         fd1  file1 fd2  file2  action
+     0   cwd  abs   cwd  abs    direct call
+     1   cwd  abs   cwd  rel    direct call
+     2   cwd  abs   fd   abs    direct call
+     3   cwd  abs   fd   rel    chdir to fd2
+     4   cwd  rel   cwd  abs    direct call
+     5   cwd  rel   cwd  rel    direct call
+     6   cwd  rel   fd   abs    direct call
+     7   cwd  rel   fd   rel    convert file1 to abs, then case 3
+     8   fd   abs   cwd  abs    direct call
+     9   fd   abs   cwd  rel    direct call
+     10  fd   abs   fd   abs    direct call
+     11  fd   abs   fd   rel    chdir to fd2
+     12  fd   rel   cwd  abs    chdir to fd1
+     13  fd   rel   cwd  rel    convert file2 to abs, then case 12
+     14  fd   rel   fd   abs    chdir to fd1
+     15a fd1  rel   fd1  rel    chdir to fd1
+     15b fd1  rel   fd2  rel    chdir to fd1, then case 7
+
+     Try some optimizations to reduce fd to AT_FDCWD, or to at least
+     avoid converting an absolute name or doing a double chdir.  */
+
+  if ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+      && (fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2)))
+    return func (file1, file2); /* Case 0-2, 4-6, 8-10.  */
+
+  /* If /proc/self/fd works, we don't need any stat or chdir.  */
+  {
+    char proc_buf1[OPENAT_BUFFER_SIZE];
+    char *proc_file1 = ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+                        ? (char *) file1
+                        : openat_proc_name (proc_buf1, fd1, file1));
+    if (proc_file1)
+      {
+        char proc_buf2[OPENAT_BUFFER_SIZE];
+        char *proc_file2 = ((fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2))
+                            ? (char *) file2
+                            : openat_proc_name (proc_buf2, fd2, file2));
+        if (proc_file2)
+          {
+            int proc_result = func (proc_file1, proc_file2);
+            int proc_errno = errno;
+            if (proc_file1 != proc_buf1 && proc_file1 != file1)
+              free (proc_file1);
+            if (proc_file2 != proc_buf2 && proc_file2 != file2)
+              free (proc_file2);
+            /* If the syscall succeeds, or if it fails with an unexpected
+               errno value, then return right away.  Otherwise, fall through
+               and resort to using save_cwd/restore_cwd.  */
+            if (0 <= proc_result)
+              return proc_result;
+            if (! EXPECTED_ERRNO (proc_errno))
+              {
+                errno = proc_errno;
+                return proc_result;
+              }
+          }
+        else if (proc_file1 != proc_buf1 && proc_file1 != file1)
+          free (proc_file1);
+      }
+  }
+
+  /* Cases 3, 7, 11-15 remain.  Time to normalize directory fds, if
+     possible.  */
+  if (IS_ABSOLUTE_FILE_NAME (file1))
+    fd1 = AT_FDCWD; /* Case 11 reduced to 3.  */
+  else if (IS_ABSOLUTE_FILE_NAME (file2))
+    fd2 = AT_FDCWD; /* Case 14 reduced to 12.  */
+
+  /* Cases 3, 7, 12, 13, 15 remain.  */
+
+  if (fd1 == AT_FDCWD) /* Cases 3, 7.  */
+    {
+      if (stat (".", &st1) == -1 || fstat (fd2, &st2) == -1)
+        return -1;
+      if (!S_ISDIR (st2.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (SAME_INODE (st1, st2)) /* Reduced to cases 1, 5.  */
+        return func (file1, file2);
+    }
+  else if (fd2 == AT_FDCWD) /* Cases 12, 13.  */
+    {
+      if (stat (".", &st2) == -1 || fstat (fd1, &st1) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (SAME_INODE (st1, st2)) /* Reduced to cases 4, 5.  */
+        return func (file1, file2);
+    }
+  else if (fd1 != fd2) /* Case 15b.  */
+    {
+      if (fstat (fd1, &st1) == -1 || fstat (fd2, &st2) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode) || !S_ISDIR (st2.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (SAME_INODE (st1, st2)) /* Reduced to case 15a.  */
+        {
+          fd2 = fd1;
+          if (stat (".", &st1) == 0 && SAME_INODE (st1, st2))
+            return func (file1, file2); /* Further reduced to case 5.  */
+        }
+    }
+  else /* Case 15a.  */
+    {
+      if (fstat (fd1, &st1) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (stat (".", &st2) == 0 && SAME_INODE (st1, st2))
+        return func (file1, file2); /* Reduced to case 5.  */
+    }
+
+  /* Cases 3, 7, 12, 13, 15a, 15b remain.  With all reductions in
+     place, it is time to start changing directories.  */
+
+  if (save_cwd (&saved_cwd) != 0)
+    openat_save_fail (errno);
+
+  if (fd1 != AT_FDCWD && fd2 != AT_FDCWD && fd1 != fd2) /* Case 15b.  */
+    {
+      if (fchdir (fd1) != 0)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      fd1 = AT_FDCWD; /* Reduced to case 7.  */
+    }
+
+  /* Cases 3, 7, 12, 13, 15a remain.  Convert one relative name to
+     absolute, if necessary.  */
+
+  file1_alt = (char *) file1;
+  file2_alt = (char *) file2;
+
+  if (fd1 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file1)) /* Case 7.  */
+    {
+      /* It would be nicer to use:
+         file1_alt = file_name_concat (xgetcwd (), file1, NULL);
+         but libraries should not call xalloc_die.  */
+      char *cwd = getcwd (NULL, 0);
+      if (!cwd)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      file1_alt = mfile_name_concat (cwd, file1, NULL);
+      if (!file1_alt)
+        {
+          saved_errno = errno;
+          free (cwd);
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      free (cwd); /* Reduced to case 3.  */
+    }
+  else if (fd2 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file2)) /* Case 13.  */
+    {
+      char *cwd = getcwd (NULL, 0);
+      if (!cwd)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      file2_alt = mfile_name_concat (cwd, file2, NULL);
+      if (!file2_alt)
+        {
+          saved_errno = errno;
+          free (cwd);
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      free (cwd); /* Reduced to case 12.  */
+    }
+
+  /* Cases 3, 12, 15a remain.  Change to the correct directory.  */
+  if (fchdir (fd1 == AT_FDCWD ? fd2 : fd1) != 0)
+    {
+      saved_errno = errno;
+      free_cwd (&saved_cwd);
+      if (file1 != file1_alt)
+        free (file1_alt);
+      else if (file2 != file2_alt)
+        free (file2_alt);
+      errno = saved_errno;
+      return -1;
+    }
+
+  /* Finally safe to perform the user's function, then clean up.  */
+
+  err = func (file1_alt, file2_alt);
+  saved_errno = (err < 0 ? errno : 0);
+
+  if (file1 != file1_alt)
+    free (file1_alt);
+  else if (file2 != file2_alt)
+    free (file2_alt);
+
+  if (restore_cwd (&saved_cwd) != 0)
+    openat_restore_fail (errno);
+
+  free_cwd (&saved_cwd);
+
+  if (saved_errno)
+    errno = saved_errno;
+  return err;
+}
+#undef CALL_FUNC
+#undef FUNC_RESULT
index 2ad030f8dc5a9d2abed1ddd93dba56fa0732ac5f..824c9d08737d67f04914b39f37550f03afdd7d38 100644 (file)
@@ -1,6 +1,6 @@
 /* backupfile.c -- make Emacs style backup file names
 
-   Copyright (C) 1990-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2006, 2009-2015 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
index e2034c7712d9ba90fab44adf2fad0f51d18a84f5..678b996a6c1ea8212254a2742d1be626a8707248 100644 (file)
@@ -1,6 +1,6 @@
 /* backupfile.h -- declarations for making Emacs style backup file names
 
-   Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2014 Free Software
+   Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index cec50e935aa41c3678d99076ec1c92a2e6e446b7..aae1280f2f4e48b617a764ef36469bd88467583d 100644 (file)
@@ -1,6 +1,6 @@
 /* basename.c -- return the last element in a file name
 
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 67d9420a6d9d1a5e1e18f589cc9dba152b66ca4c..faebe761acafbd19b109b7267baeffdd33027469 100644 (file)
@@ -1,6 +1,6 @@
 /* basename.c -- return the last element in a file name
 
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 9ec0b47b7252db90a2cfe6524aecbc3f186102ff..1665e996793c1feba451c0c56ef277bab4830753 100644 (file)
@@ -1,5 +1,5 @@
 /* bitrotate.h - Rotate bits in integers
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index 48c6478378742f5da190b1b4fdf27ad4ced413f5..1fb5fe675e9155df89d18e708159b32b6b5061e6 100644 (file)
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright 2000-2003, 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright 2000-2003, 2006, 2009-2015 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
index b465277619c2c990f1955be543d2e39bc069312a..476447317829bff2802f6cf038429af0f58a04cd 100644 (file)
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2015 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
index 8e660441d082dcc4979ad8807c2ebb5dc5f8e541..f25bcca23f5ac048faecdae6e691201c38df9295 100644 (file)
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison functions in C locale.
-   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2014 Free Software
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index b9b26a4ce8382eca95a026fbbe8a40ac3387ca76..6deb6d1236dfea18fa86bbdad319ba28fb141a2c 100644 (file)
@@ -1,5 +1,5 @@
 /* c-strcasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2015 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
index 5139a30b9d5e0f83530e4b44b08a9fa429604f5b..ffd05a239c426d3228500d1cdf339ea95d7f5881 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized case-insensitive string comparison in C locale.
-   Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2009-2015 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
index 972eb80079532fef5be995a640327760ed65beed..b98e36838ca8f48e76a83537d3696d210d6e2ec3 100644 (file)
@@ -1,5 +1,5 @@
 /* c-strncasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2015 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
index 902380fd92d8f835a153260d65f0aa548fda1967..1c9f2ee91b96ae73063952e83c0f8ac358f390f9 100644 (file)
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2014 Free Software Foundation, Inc.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/chdir-long.c b/lib/chdir-long.c
new file mode 100644 (file)
index 0000000..ecc025a
--- /dev/null
@@ -0,0 +1,267 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+   Copyright (C) 2004-2015 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 Jim Meyering */
+
+#include <config.h>
+
+#include "chdir-long.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "assure.h"
+
+#ifndef PATH_MAX
+# error "compile this file only if your system defines PATH_MAX"
+#endif
+
+/* The results of openat() in this file are not leaked to any
+   single-threaded code that could use stdio.
+   FIXME - if the kernel ever adds support for multi-thread safety for
+   avoiding standard fds, then we should use openat_safer.  */
+
+struct cd_buf
+{
+  int fd;
+};
+
+static void
+cdb_init (struct cd_buf *cdb)
+{
+  cdb->fd = AT_FDCWD;
+}
+
+static int
+cdb_fchdir (struct cd_buf const *cdb)
+{
+  return fchdir (cdb->fd);
+}
+
+static void
+cdb_free (struct cd_buf const *cdb)
+{
+  if (0 <= cdb->fd)
+    {
+      bool close_fail = close (cdb->fd);
+      assure (! close_fail);
+    }
+}
+
+/* Given a file descriptor of an open directory (or AT_FDCWD), CDB->fd,
+   try to open the CDB->fd-relative directory, DIR.  If the open succeeds,
+   update CDB->fd with the resulting descriptor, close the incoming file
+   descriptor, and return zero.  Upon failure, return -1 and set errno.  */
+static int
+cdb_advance_fd (struct cd_buf *cdb, char const *dir)
+{
+  int new_fd = openat (cdb->fd, dir,
+                       O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+  if (new_fd < 0)
+    return -1;
+
+  cdb_free (cdb);
+  cdb->fd = new_fd;
+
+  return 0;
+}
+
+/* Return a pointer to the first non-slash in S.  */
+static char * _GL_ATTRIBUTE_PURE
+find_non_slash (char const *s)
+{
+  size_t n_slash = strspn (s, "/");
+  return (char *) s + n_slash;
+}
+
+/* This is a function much like chdir, but without the PATH_MAX limitation
+   on the length of the directory name.  A significant difference is that
+   it must be able to modify (albeit only temporarily) the directory
+   name.  It handles an arbitrarily long directory name by operating
+   on manageable portions of the name.  On systems without the openat
+   syscall, this means changing the working directory to more and more
+   "distant" points along the long directory name and then restoring
+   the working directory.  If any of those attempts to save or restore
+   the working directory fails, this function exits nonzero.
+
+   Note that this function may still fail with errno == ENAMETOOLONG, but
+   only if the specified directory name contains a component that is long
+   enough to provoke such a failure all by itself (e.g. if the component
+   has length PATH_MAX or greater on systems that define PATH_MAX).  */
+
+int
+chdir_long (char *dir)
+{
+  int e = chdir (dir);
+  if (e == 0 || errno != ENAMETOOLONG)
+    return e;
+
+  {
+    size_t len = strlen (dir);
+    char *dir_end = dir + len;
+    struct cd_buf cdb;
+    size_t n_leading_slash;
+
+    cdb_init (&cdb);
+
+    /* If DIR is the empty string, then the chdir above
+       must have failed and set errno to ENOENT.  */
+    assure (0 < len);
+    assure (PATH_MAX <= len);
+
+    /* Count leading slashes.  */
+    n_leading_slash = strspn (dir, "/");
+
+    /* Handle any leading slashes as well as any name that matches
+       the regular expression, m!^//hostname[/]*! .  Handling this
+       prefix separately usually results in a single additional
+       cdb_advance_fd call, but it's worthwhile, since it makes the
+       code in the following loop cleaner.  */
+    if (n_leading_slash == 2)
+      {
+        int err;
+        /* Find next slash.
+           We already know that dir[2] is neither a slash nor '\0'.  */
+        char *slash = memchr (dir + 3, '/', dir_end - (dir + 3));
+        if (slash == NULL)
+          {
+            errno = ENAMETOOLONG;
+            return -1;
+          }
+        *slash = '\0';
+        err = cdb_advance_fd (&cdb, dir);
+        *slash = '/';
+        if (err != 0)
+          goto Fail;
+        dir = find_non_slash (slash + 1);
+      }
+    else if (n_leading_slash)
+      {
+        if (cdb_advance_fd (&cdb, "/") != 0)
+          goto Fail;
+        dir += n_leading_slash;
+      }
+
+    assure (*dir != '/');
+    assure (dir <= dir_end);
+
+    while (PATH_MAX <= dir_end - dir)
+      {
+        int err;
+        /* Find a slash that is PATH_MAX or fewer bytes away from dir.
+           I.e. see if there is a slash that will give us a name of
+           length PATH_MAX-1 or less.  */
+        char *slash = memrchr (dir, '/', PATH_MAX);
+        if (slash == NULL)
+          {
+            errno = ENAMETOOLONG;
+            return -1;
+          }
+
+        *slash = '\0';
+        assure (slash - dir < PATH_MAX);
+        err = cdb_advance_fd (&cdb, dir);
+        *slash = '/';
+        if (err != 0)
+          goto Fail;
+
+        dir = find_non_slash (slash + 1);
+      }
+
+    if (dir < dir_end)
+      {
+        if (cdb_advance_fd (&cdb, dir) != 0)
+          goto Fail;
+      }
+
+    if (cdb_fchdir (&cdb) != 0)
+      goto Fail;
+
+    cdb_free (&cdb);
+    return 0;
+
+   Fail:
+    {
+      int saved_errno = errno;
+      cdb_free (&cdb);
+      errno = saved_errno;
+      return -1;
+    }
+  }
+}
+
+#if TEST_CHDIR
+
+# include "closeout.h"
+# include "error.h"
+
+char *program_name;
+
+int
+main (int argc, char *argv[])
+{
+  char *line = NULL;
+  size_t n = 0;
+  int len;
+
+  program_name = argv[0];
+  atexit (close_stdout);
+
+  len = getline (&line, &n, stdin);
+  if (len < 0)
+    {
+      int saved_errno = errno;
+      if (feof (stdin))
+        exit (0);
+
+      error (EXIT_FAILURE, saved_errno,
+             "reading standard input");
+    }
+  else if (len == 0)
+    exit (0);
+
+  if (line[len-1] == '\n')
+    line[len-1] = '\0';
+
+  if (chdir_long (line) != 0)
+    error (EXIT_FAILURE, errno,
+           "chdir_long failed: %s", line);
+
+  if (argc <= 1)
+    {
+      /* Using 'pwd' here makes sense only if it is a robust implementation,
+         like the one in coreutils after the 2004-04-19 changes.  */
+      char const *cmd = "pwd";
+      execlp (cmd, (char *) NULL);
+      error (EXIT_FAILURE, errno, "%s", cmd);
+    }
+
+  fclose (stdin);
+  fclose (stderr);
+
+  exit (EXIT_SUCCESS);
+}
+#endif
+
+/*
+Local Variables:
+compile-command: "gcc -DTEST_CHDIR=1 -g -O -W -Wall chdir-long.c libcoreutils.a"
+End:
+*/
diff --git a/lib/chdir-long.h b/lib/chdir-long.h
new file mode 100644 (file)
index 0000000..81dacc3
--- /dev/null
@@ -0,0 +1,30 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+   Copyright (C) 2004-2005, 2009-2015 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 Jim Meyering.  */
+
+#include <unistd.h>
+#include <limits.h>
+
+#include "pathmax.h"
+
+/* On systems without PATH_MAX, presume that chdir accepts
+   arbitrarily long directory names.  */
+#ifndef PATH_MAX
+# define chdir_long(Dir) chdir (Dir)
+#else
+int chdir_long (char *dir);
+#endif
diff --git a/lib/chmodat.c b/lib/chmodat.c
new file mode 100644 (file)
index 0000000..3c69689
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define FCHMODAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
diff --git a/lib/chown.c b/lib/chown.c
new file mode 100644 (file)
index 0000000..11238eb
--- /dev/null
@@ -0,0 +1,151 @@
+/* provide consistent interface to chown for systems that don't interpret
+   an ID of -1 as meaning "don't change the corresponding ID".
+
+   Copyright (C) 1997, 2004-2007, 2009-2015 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 Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_CHOWN
+
+/* Simple stub that always fails with ENOSYS, for mingw.  */
+int
+chown (const char *file _GL_UNUSED, uid_t uid _GL_UNUSED,
+       gid_t gid _GL_UNUSED)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_CHOWN */
+
+/* Below we refer to the system's chown().  */
+# undef chown
+
+/* Provide a more-closely POSIX-conforming version of chown on
+   systems with one or both of the following problems:
+   - chown doesn't treat an ID of -1 as meaning
+   "don't change the corresponding ID".
+   - chown doesn't dereference symlinks.  */
+
+int
+rpl_chown (const char *file, uid_t uid, gid_t gid)
+{
+  struct stat st;
+  bool stat_valid = false;
+  int result;
+
+# if CHOWN_CHANGE_TIME_BUG
+  if (gid != (gid_t) -1 || uid != (uid_t) -1)
+    {
+      if (stat (file, &st))
+        return -1;
+      stat_valid = true;
+    }
+# endif
+
+# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+  if (gid == (gid_t) -1 || uid == (uid_t) -1)
+    {
+      /* Stat file to get id(s) that should remain unchanged.  */
+      if (!stat_valid && stat (file, &st))
+        return -1;
+      if (gid == (gid_t) -1)
+        gid = st.st_gid;
+      if (uid == (uid_t) -1)
+        uid = st.st_uid;
+    }
+# endif
+
+# if CHOWN_MODIFIES_SYMLINK
+  {
+    /* Handle the case in which the system-supplied chown function
+       does *not* follow symlinks.  Instead, it changes permissions
+       on the symlink itself.  To work around that, we open the
+       file (but this can fail due to lack of read or write permission) and
+       use fchown on the resulting descriptor.  */
+    int open_flags = O_NONBLOCK | O_NOCTTY;
+    int fd = open (file, O_RDONLY | open_flags);
+    if (0 <= fd
+        || (errno == EACCES
+            && 0 <= (fd = open (file, O_WRONLY | open_flags))))
+      {
+        int saved_errno;
+        bool fchown_socket_failure;
+
+        result = fchown (fd, uid, gid);
+        saved_errno = errno;
+
+        /* POSIX says fchown can fail with errno == EINVAL on sockets
+           and pipes, so fall back on chown in that case.  */
+        fchown_socket_failure =
+          (result != 0 && saved_errno == EINVAL
+           && fstat (fd, &st) == 0
+           && (S_ISFIFO (st.st_mode) || S_ISSOCK (st.st_mode)));
+
+        close (fd);
+
+        if (! fchown_socket_failure)
+          {
+            errno = saved_errno;
+            return result;
+          }
+      }
+    else if (errno != EACCES)
+      return -1;
+  }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG
+  if (!stat_valid)
+    {
+      size_t len = strlen (file);
+      if (len && file[len - 1] == '/' && stat (file, &st))
+        return -1;
+    }
+# endif
+
+  result = chown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG
+  if (result == 0 && stat_valid
+      && (uid == st.st_uid || uid == (uid_t) -1)
+      && (gid == st.st_gid || gid == (gid_t) -1))
+    {
+      /* No change in ownership, but at least one argument was not -1,
+         so we are required to update ctime.  Since chown succeeded,
+         we assume that chmod will do likewise.  Fortunately, on all
+         known systems where a 'no-op' chown skips the ctime update, a
+         'no-op' chmod still does the trick.  */
+      result = chmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+                                          | S_ISUID | S_ISGID | S_ISVTX));
+    }
+# endif
+
+  return result;
+}
+
+#endif /* HAVE_CHOWN */
diff --git a/lib/chownat.c b/lib/chownat.c
new file mode 100644 (file)
index 0000000..3937f9c
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define FCHOWNAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
diff --git a/lib/cloexec.c b/lib/cloexec.c
new file mode 100644 (file)
index 0000000..29d1a38
--- /dev/null
@@ -0,0 +1,83 @@
+/* closexec.c - set or clear the close-on-exec descriptor flag
+
+   Copyright (C) 1991, 2004-2006, 2009-2015 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/>.
+
+   The code is taken from glibc/manual/llio.texi  */
+
+#include <config.h>
+
+#include "cloexec.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+   or clear the flag if VALUE is false.
+   Return 0 on success, or -1 on error with 'errno' set.
+
+   Note that on MingW, this function does NOT protect DESC from being
+   inherited into spawned children.  Instead, either use dup_cloexec
+   followed by closing the original DESC, or use interfaces such as
+   open or pipe2 that accept flags like O_CLOEXEC to create DESC
+   non-inheritable in the first place.  */
+
+int
+set_cloexec_flag (int desc, bool value)
+{
+#ifdef F_SETFD
+
+  int flags = fcntl (desc, F_GETFD, 0);
+
+  if (0 <= flags)
+    {
+      int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
+
+      if (flags == newflags
+          || fcntl (desc, F_SETFD, newflags) != -1)
+        return 0;
+    }
+
+  return -1;
+
+#else /* !F_SETFD */
+
+  /* Use dup2 to reject invalid file descriptors; the cloexec flag
+     will be unaffected.  */
+  if (desc < 0)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (dup2 (desc, desc) < 0)
+    /* errno is EBADF here.  */
+    return -1;
+
+  /* There is nothing we can do on this kind of platform.  Punt.  */
+  return 0;
+#endif /* !F_SETFD */
+}
+
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+   prior to exec or spawn.  Returns -1 and sets errno if FD could not
+   be duplicated.  */
+
+int
+dup_cloexec (int fd)
+{
+  return fcntl (fd, F_DUPFD_CLOEXEC, 0);
+}
diff --git a/lib/cloexec.h b/lib/cloexec.h
new file mode 100644 (file)
index 0000000..ef5bacc
--- /dev/null
@@ -0,0 +1,38 @@
+/* closexec.c - set or clear the close-on-exec descriptor flag
+
+   Copyright (C) 2004, 2009-2015 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/>.
+
+*/
+
+#include <stdbool.h>
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+   or clear the flag if VALUE is false.
+   Return 0 on success, or -1 on error with 'errno' set.
+
+   Note that on MingW, this function does NOT protect DESC from being
+   inherited into spawned children.  Instead, either use dup_cloexec
+   followed by closing the original DESC, or use interfaces such as
+   open or pipe2 that accept flags like O_CLOEXEC to create DESC
+   non-inheritable in the first place.  */
+
+int set_cloexec_flag (int desc, bool value);
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+   prior to exec or spawn.  Returns -1 and sets errno if FD could not
+   be duplicated.  */
+
+int dup_cloexec (int fd);
index d7dcb3f15762ab9d730edcea7b626df6f5807870..54d1f71b9c370b18af1d2858856d16d7ab0abe89 100644 (file)
@@ -1,5 +1,5 @@
 /* close replacement.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index 940c6f9f39f8e103bda4bfd1ab3d317ec16ef841..f80843f91959f3bc4ecc6c94655bd9b83f6f50e3 100644 (file)
@@ -1,5 +1,5 @@
 /* Stop reading the entries of a directory.
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index 289bc44ea98d4327ae7a852f94f9d8088e5fbc58..f06d7e9f00fdb5ef60ebfa6a2af4223009f4544f 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Output a system dependent table of character encoding aliases.
 #
-#   Copyright (C) 2000-2004, 2006-2014 Free Software Foundation, Inc.
+#   Copyright (C) 2000-2004, 2006-2015 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
@@ -348,12 +348,10 @@ case "$os" in
     #echo "sun_eu_greek ?" # what is this?
     echo "UTF-8 UTF-8"
     ;;
-  freebsd* | os2*)
+  freebsd*)
     # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
     # localcharset.c falls back to using the full locale name
     # from the environment variables.
-    # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
-    # reuse FreeBSD's locale data for OS/2.
     echo "C ASCII"
     echo "US-ASCII ASCII"
     for l in la_LN lt_LN; do
index 1974c3691b2b014bdffd6758a404cd8af8bda919..b4188300c022197cb9f4a6c471e104e912d62357 100644 (file)
@@ -1,6 +1,6 @@
 /* Analyze differences between two vectors.
 
-   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2014 Free Software
+   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index d7c51bac2a31b5d0038d3bee9eb2fec9374d4c34..17a88538795ec3ef8da4d34c20cd14d7563b5b38 100644 (file)
@@ -1,6 +1,6 @@
 /* Like dirent.h, but redefine some names to avoid glitches.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index 83531a16af95299148773326de30428155454267..aa01f6026d160885323369f016289f29e7a9d211 100644 (file)
@@ -1,5 +1,5 @@
 /* Private details of the DIR type.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index 8cc75d8d0fb60f13610e7331b5153e6639f7a093..da62b2e31561fee22186f92f6a5a1bd5aa2b6530 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke dirent-like functions, but avoid some glitches.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index 4822d6b2c402f5b80b16414ffe276ddfb038a91e..ddd3b84fbb289fefd16d89e6a95f26da1dffbd4b 100644 (file)
@@ -1,5 +1,5 @@
 /* A GNU-like <dirent.h>.
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index 4d37928cb28a8f3071670c65c3d6cf242b498d40..c91f8e558721e772ab3e2097728adc5ddf6919a2 100644 (file)
@@ -1,6 +1,6 @@
 /* dirfd.c -- return the file descriptor associated with an open DIR*
 
-   Copyright (C) 2001, 2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006, 2008-2015 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
index d4a69730e5bbf1e303f54b191c9d67641e88ad3d..98391356fde1bd41fb6cf0e9a1c12d3475315753 100644 (file)
@@ -1,6 +1,6 @@
 /* dirname.c -- return all but the last element in a file name
 
-   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 94f1a36a1afc3b35246b427251b96f171a3d278b..c22be314d1e8ea790e65e62e4eec55e01e6c2850 100644 (file)
@@ -1,6 +1,6 @@
 /* dirname.c -- return all but the last element in a file name
 
-   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 657d265321768e7045dcdab81a597957362a04b4..55021ec5e6a8f20c79986a3c65f3188e9b58d226 100644 (file)
@@ -1,6 +1,6 @@
 /*  Take file names apart into directory and base names.
 
-    Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+    Copyright (C) 1998, 2001, 2003-2006, 2009-2015 Free Software Foundation,
     Inc.
 
     This program is free software: you can redistribute it and/or modify
index b92adfac2eca838b231436bc63a7cedf56648840..893baf6ccf3361dd55d675f55429614579b2fa36 100644 (file)
@@ -1,6 +1,6 @@
 /* File names on MS-DOS/Windows systems.
 
-   Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2004-2006, 2009-2015 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
index 8df3cdab10867b03025acc39de017f25e07bd9e5..c6436cd9ba8b96ee4611affc45404699d86dab55 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke dup, but avoid some glitches.
 
-   Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2004-2006, 2009-2015 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
index 7de6805499004d90ef56a0f255362d53152f6870..0e13214c82565bc7befe8bf1ca15d45536801816 100644 (file)
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2015 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
index 832afc8f85381a2d96cc6cc40437354f6690ec70..affbb9798806708f8d421a30b5da9c0dbff141db 100644 (file)
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index 18ff5db12ba3a81b4c1eea1a0f2ef38674099dc6..66831978fc98a51d62da67376c098459ebe07407 100644 (file)
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index 4aaafb362603ba075e6ba21092bf50a49be5f4fd..ccffef5853c9e23e678cac590f1aea144f0ad68e 100644 (file)
@@ -1,5 +1,5 @@
 /* Declaration for error-reporting function
-   Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation,
+   Copyright (C) 1995-1997, 2003, 2006, 2008-2015 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
 
index 609afc5af7e09ab9c89e86f5328e8fb87128cc1a..8035b8952c5edf00679b785e99231f0e7e2dfedd 100644 (file)
@@ -1,6 +1,6 @@
 /* Failure exit status
 
-   Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2007, 2009-2015 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
index 66807d511fa6d3a4d95ca41fc1348a77c87aaeab..62d0ac5d9e657751fc4a4e1844c0736084d45f13 100644 (file)
@@ -1,6 +1,6 @@
 /* Failure exit status
 
-   Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2015 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
diff --git a/lib/fchdir.c b/lib/fchdir.c
new file mode 100644 (file)
index 0000000..944d1bd
--- /dev/null
@@ -0,0 +1,208 @@
+/* fchdir replacement.
+   Copyright (C) 2006-2015 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/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "assure.h"
+#include "dosname.h"
+#include "filenamecat.h"
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+/* This replacement assumes that a directory is not renamed while opened
+   through a file descriptor.
+
+   FIXME: On mingw, this would be possible to enforce if we were to
+   also open a HANDLE to each directory currently visited by a file
+   descriptor, since mingw refuses to rename any in-use file system
+   object.  */
+
+/* Array of file descriptors opened.  If REPLACE_OPEN_DIRECTORY or if it points
+   to a directory, it stores info about this directory.  */
+typedef struct
+{
+  char *name;       /* Absolute name of the directory, or NULL.  */
+  /* FIXME - add a DIR* member to make dirfd possible on mingw?  */
+} dir_info_t;
+static dir_info_t *dirs;
+static size_t dirs_allocated;
+
+/* Try to ensure dirs has enough room for a slot at index fd; free any
+   contents already in that slot.  Return false and set errno to
+   ENOMEM on allocation failure.  */
+static bool
+ensure_dirs_slot (size_t fd)
+{
+  if (fd < dirs_allocated)
+    free (dirs[fd].name);
+  else
+    {
+      size_t new_allocated;
+      dir_info_t *new_dirs;
+
+      new_allocated = 2 * dirs_allocated + 1;
+      if (new_allocated <= fd)
+        new_allocated = fd + 1;
+      new_dirs =
+        (dirs != NULL
+         ? (dir_info_t *) realloc (dirs, new_allocated * sizeof *dirs)
+         : (dir_info_t *) malloc (new_allocated * sizeof *dirs));
+      if (new_dirs == NULL)
+        return false;
+      memset (new_dirs + dirs_allocated, 0,
+              (new_allocated - dirs_allocated) * sizeof *dirs);
+      dirs = new_dirs;
+      dirs_allocated = new_allocated;
+    }
+  return true;
+}
+
+/* Return an absolute name of DIR in malloc'd storage.  */
+static char *
+get_name (char const *dir)
+{
+  char *cwd;
+  char *result;
+  int saved_errno;
+
+  if (IS_ABSOLUTE_FILE_NAME (dir))
+    return strdup (dir);
+
+  /* We often encounter "."; treat it as a special case.  */
+  cwd = getcwd (NULL, 0);
+  if (!cwd || (dir[0] == '.' && dir[1] == '\0'))
+    return cwd;
+
+  result = mfile_name_concat (cwd, dir, NULL);
+  saved_errno = errno;
+  free (cwd);
+  errno = saved_errno;
+  return result;
+}
+
+/* Hook into the gnulib replacements for open() and close() to keep track
+   of the open file descriptors.  */
+
+/* Close FD, cleaning up any fd to name mapping if fd was visiting a
+   directory.  */
+void
+_gl_unregister_fd (int fd)
+{
+  if (fd >= 0 && fd < dirs_allocated)
+    {
+      free (dirs[fd].name);
+      dirs[fd].name = NULL;
+    }
+}
+
+/* Mark FD as visiting FILENAME.  FD must be non-negative, and refer
+   to an open file descriptor.  If REPLACE_OPEN_DIRECTORY is non-zero,
+   this should only be called if FD is visiting a directory.  Close FD
+   and return -1 if there is insufficient memory to track the
+   directory name; otherwise return FD.  */
+int
+_gl_register_fd (int fd, const char *filename)
+{
+  struct stat statbuf;
+
+  assure (0 <= fd);
+  if (REPLACE_OPEN_DIRECTORY
+      || (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)))
+    {
+      if (!ensure_dirs_slot (fd)
+          || (dirs[fd].name = get_name (filename)) == NULL)
+        {
+          int saved_errno = errno;
+          close (fd);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+  return fd;
+}
+
+/* Mark NEWFD as a duplicate of OLDFD; useful from dup, dup2, dup3,
+   and fcntl.  Both arguments must be valid and distinct file
+   descriptors.  Close NEWFD and return -1 if OLDFD is tracking a
+   directory, but there is insufficient memory to track the same
+   directory in NEWFD; otherwise return NEWFD.  */
+int
+_gl_register_dup (int oldfd, int newfd)
+{
+  assure (0 <= oldfd && 0 <= newfd && oldfd != newfd);
+  if (oldfd < dirs_allocated && dirs[oldfd].name)
+    {
+      /* Duplicated a directory; must ensure newfd is allocated.  */
+      if (!ensure_dirs_slot (newfd)
+          || (dirs[newfd].name = strdup (dirs[oldfd].name)) == NULL)
+        {
+          int saved_errno = errno;
+          close (newfd);
+          errno = saved_errno;
+          newfd = -1;
+        }
+    }
+  else if (newfd < dirs_allocated)
+    {
+      /* Duplicated a non-directory; ensure newfd is cleared.  */
+      free (dirs[newfd].name);
+      dirs[newfd].name = NULL;
+    }
+  return newfd;
+}
+
+/* If FD is currently visiting a directory, then return the name of
+   that directory.  Otherwise, return NULL and set errno.  */
+const char *
+_gl_directory_name (int fd)
+{
+  if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL)
+    return dirs[fd].name;
+  /* At this point, fd is either invalid, or open but not a directory.
+     If dup2 fails, errno is correctly EBADF.  */
+  if (0 <= fd)
+    {
+      if (dup2 (fd, fd) == fd)
+        errno = ENOTDIR;
+    }
+  else
+    errno = EBADF;
+  return NULL;
+}
+
+
+/* Implement fchdir() in terms of chdir().  */
+
+int
+fchdir (int fd)
+{
+  const char *name = _gl_directory_name (fd);
+  return name ? chdir (name) : -1;
+}
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
new file mode 100644 (file)
index 0000000..c09d02d
--- /dev/null
@@ -0,0 +1,53 @@
+/* Change the protections of file relative to an open directory.
+   Copyright (C) 2006, 2009-2015 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 Jim Meyering */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#ifndef HAVE_LCHMOD
+/* Use a different name, to avoid conflicting with any
+   system-supplied declaration.  */
+# undef lchmod
+# define lchmod lchmod_rpl
+static int
+lchmod (char const *f _GL_UNUSED, mode_t m _GL_UNUSED)
+{
+  errno = ENOSYS;
+  return -1;
+}
+#endif
+
+/* Solaris 10 has no function like this.
+   Invoke chmod or lchmod on file, FILE, using mode MODE, in the directory
+   open on descriptor FD.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then (chmod|lchmod)/restore_cwd.  If either the save_cwd or the
+   restore_cwd fails, then give a diagnostic and exit nonzero.
+   Note that an attempt to use a FLAG value of AT_SYMLINK_NOFOLLOW
+   on a system without lchmod support causes this function to fail.  */
+
+#define AT_FUNC_NAME fchmodat
+#define AT_FUNC_F1 lchmod
+#define AT_FUNC_F2 chmod
+#define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode, int flag
+#define AT_FUNC_POST_FILE_ARGS        , mode
+#include "at-func.c"
diff --git a/lib/fchown-stub.c b/lib/fchown-stub.c
new file mode 100644 (file)
index 0000000..62b6969
--- /dev/null
@@ -0,0 +1,16 @@
+#include <config.h>
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* A trivial substitute for 'fchown'.
+
+   DJGPP 2.03 and earlier (and perhaps later) don't have 'fchown',
+   so we pretend no-one has permission for this operation. */
+
+int
+fchown (int fd, uid_t uid, gid_t gid)
+{
+  errno = EPERM;
+  return -1;
+}
diff --git a/lib/fchownat.c b/lib/fchownat.c
new file mode 100644 (file)
index 0000000..3bf5daa
--- /dev/null
@@ -0,0 +1,114 @@
+/* This function serves as replacement for a missing fchownat function,
+   as well as a work around for the fchownat bug in glibc-2.4:
+    <http://lists.ubuntu.com/archives/ubuntu-users/2006-September/093218.html>
+   when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
+   mistakenly affects the symlink referent, rather than the symlink itself.
+
+   Copyright (C) 2006-2007, 2009-2015 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 Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+
+#include "openat.h"
+
+#if !HAVE_FCHOWNAT
+
+/* Replacement for Solaris' function by the same name.
+   Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the
+   directory open on descriptor FD.  If FLAG is AT_SYMLINK_NOFOLLOW, then
+   use lchown, otherwise, use chown.  If possible, do it without changing
+   the working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then (chown|lchown)/restore_cwd.  If either the save_cwd or the
+   restore_cwd fails, then give a diagnostic and exit nonzero.  */
+
+# define AT_FUNC_NAME fchownat
+# define AT_FUNC_F1 lchown
+# define AT_FUNC_F2 chown
+# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+# define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group, int flag
+# define AT_FUNC_POST_FILE_ARGS        , owner, group
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#else /* HAVE_FCHOWNAT */
+
+# undef fchownat
+
+# if FCHOWNAT_NOFOLLOW_BUG
+
+/* Failure to handle AT_SYMLINK_NOFOLLOW requires the /proc/self/fd or
+   fchdir workaround to call lchown for lchownat, but there is no need
+   to penalize chownat.  */
+static int
+local_lchownat (int fd, char const *file, uid_t owner, gid_t group);
+
+#  define AT_FUNC_NAME local_lchownat
+#  define AT_FUNC_F1 lchown
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
+#  define AT_FUNC_POST_FILE_ARGS        , owner, group
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
+
+# endif
+
+/* Work around bugs with trailing slash, using the same workarounds as
+   chown and lchown.  */
+
+int
+rpl_fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+{
+# if FCHOWNAT_NOFOLLOW_BUG
+  if (flag == AT_SYMLINK_NOFOLLOW)
+    return local_lchownat (fd, file, owner, group);
+# endif
+# if FCHOWNAT_EMPTY_FILENAME_BUG
+  if (file[0] == '\0')
+    {
+      errno = ENOENT;
+      return -1;
+    }
+# endif
+# if CHOWN_TRAILING_SLASH_BUG
+  {
+    size_t len = strlen (file);
+    struct stat st;
+    if (len && file[len - 1] == '/')
+      {
+        if (statat (fd, file, &st))
+          return -1;
+        if (flag == AT_SYMLINK_NOFOLLOW)
+          return fchownat (fd, file, owner, group, 0);
+      }
+  }
+# endif
+  return fchownat (fd, file, owner, group, flag);
+}
+
+#endif /* HAVE_FCHOWNAT */
index 1e35dd1a4f9e2cc471017e1c2747db9b03ad4aa6..23b73e975c844d976a032d2582f482fac0f43f33 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide file descriptor control.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index f63cd6a734c1911ac963e459de16a8cec9f5bf10..e2880185c6310c0ff5689a18b501379ee18bb214 100644 (file)
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index 0171cc6028cdf606cc04af4925dda0f212f91dca..b1488c4ce7bbac045a05eb406999d1cdb263ea45 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2009.
 
    This program is free software: you can redistribute it and/or modify it
index 1aa264eb745d28c0ec27f3a79a8cd10ded544b8a..bdb9aefe839293ba5373f76e4c992139fba29c3a 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making making file descriptor functions close(), ioctl() extensible.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index 148f735dc64349a0257efde5dc9bc9be6822f669..6c1fb2b60d9b25768aa1882fa402b2fd3d8eda03 100644 (file)
@@ -1,6 +1,6 @@
 /* Return a safer copy of a file descriptor.
 
-   Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2015 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
index 96dbaaa7d97295488f4df1011f0503274be71975..457699315b03562449d43bcbb7bc97e9006e6914 100644 (file)
@@ -1,5 +1,5 @@
 /* Basic filename support macros.
-   Copyright (C) 2001-2004, 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2007-2015 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
diff --git a/lib/filenamecat-lgpl.c b/lib/filenamecat-lgpl.c
new file mode 100644 (file)
index 0000000..a359a51
--- /dev/null
@@ -0,0 +1,88 @@
+/* Concatenate two arbitrary file names.
+
+   Copyright (C) 1996-2007, 2009-2015 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 Jim Meyering.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "filenamecat.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "dirname.h"
+
+#if ! HAVE_MEMPCPY && ! defined mempcpy
+# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
+#endif
+
+/* Return the longest suffix of F that is a relative file name.
+   If it has no such suffix, return the empty string.  */
+
+static char const * _GL_ATTRIBUTE_PURE
+longest_relative_suffix (char const *f)
+{
+  for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++)
+    continue;
+  return f;
+}
+
+/* Concatenate two file name components, DIR and ABASE, in
+   newly-allocated storage and return the result.
+   The resulting file name F is such that the commands "ls F" and "(cd
+   DIR; ls BASE)" refer to the same file, where BASE is ABASE with any
+   file system prefixes and leading separators removed.
+   Arrange for a directory separator if necessary between DIR and BASE
+   in the result, removing any redundant separators.
+   In any case, if BASE_IN_RESULT is non-NULL, set
+   *BASE_IN_RESULT to point to the copy of ABASE in the returned
+   concatenation.  However, if ABASE begins with more than one slash,
+   set *BASE_IN_RESULT to point to the sole corresponding slash that
+   is copied into the result buffer.
+
+   Return NULL if malloc fails.  */
+
+char *
+mfile_name_concat (char const *dir, char const *abase, char **base_in_result)
+{
+  char const *dirbase = last_component (dir);
+  size_t dirbaselen = base_len (dirbase);
+  size_t dirlen = dirbase - dir + dirbaselen;
+  size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1]));
+
+  char const *base = longest_relative_suffix (abase);
+  size_t baselen = strlen (base);
+
+  char *p_concat = malloc (dirlen + needs_separator + baselen + 1);
+  char *p;
+
+  if (p_concat == NULL)
+    return NULL;
+
+  p = mempcpy (p_concat, dir, dirlen);
+  *p = DIRECTORY_SEPARATOR;
+  p += needs_separator;
+
+  if (base_in_result)
+    *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase);
+
+  p = mempcpy (p, base, baselen);
+  *p = '\0';
+
+  return p_concat;
+}
diff --git a/lib/filenamecat.h b/lib/filenamecat.h
new file mode 100644 (file)
index 0000000..62f81b0
--- /dev/null
@@ -0,0 +1,27 @@
+/* Concatenate two arbitrary file names.
+
+   Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2015 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 Jim Meyering.  */
+
+#if GNULIB_FILENAMECAT
+char *file_name_concat (char const *dir, char const *base,
+                        char **base_in_result);
+#endif
+
+char *mfile_name_concat (char const *dir, char const *base,
+                         char **base_in_result);
index 5ff15110f92ff52af6036705ad9de2b828b48c48..e6aaa922daab836033bd127d2dac697363d17776 100644 (file)
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2007.
 
    This program is free software; you can redistribute it and/or modify
index b7c321dd8eb84de41be7746c1b3d8edbb0c352f4..dac9f88e34b9225bac0f49795b89ce5d5bd3f05c 100644 (file)
@@ -1,5 +1,5 @@
 /* Auxiliary definitions for <float.h>.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2011.
 
    This program is free software: you can redistribute it and/or modify
index db809f8f16e2db962a05562301b70452d4aeac25..3bb382647443844cfed1245ac5ff75e33c43e9e2 100644 (file)
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 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
index ffcda9f5718c808a613e894e3d9c543096eb0d54..7a0521fa0f329c4c0ce6f40e0b5f31a2dc7abb0f 100644 (file)
@@ -1,5 +1,5 @@
 /* fstat() replacement.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
diff --git a/lib/fstatat.c b/lib/fstatat.c
new file mode 100644 (file)
index 0000000..6a9e862
--- /dev/null
@@ -0,0 +1,135 @@
+/* Work around an fstatat bug on Solaris 9.
+
+   Copyright (C) 2006, 2009-2015 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 Paul Eggert and Jim Meyering.  */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_fstatat doesn't recurse to
+   rpl_fstatat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of fstatat.  It might be defined as a macro.  */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if HAVE_FSTATAT
+static int
+orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
+{
+  return fstatat (fd, filename, buf, flags);
+}
+#endif
+
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+#include "sys/stat.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
+
+# ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
+#  define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
+# endif
+
+/* fstatat should always follow symbolic links that end in /, but on
+   Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.
+   Likewise, trailing slash on a non-directory should be an error.
+   These are the same problems that lstat.c and stat.c address, so
+   solve it in a similar way.
+
+   AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug.
+   Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero.  */
+
+int
+rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+  int result = orig_fstatat (fd, file, st, flag);
+  size_t len;
+
+  if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0)
+    return result;
+  len = strlen (file);
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    {
+      /* Fix lstat behavior.  */
+      if (file[len - 1] != '/' || S_ISDIR (st->st_mode))
+        return 0;
+      if (!S_ISLNK (st->st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+    }
+  /* Fix stat behavior.  */
+  if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/')
+    {
+      errno = ENOTDIR;
+      return -1;
+    }
+  return result;
+}
+
+#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */
+
+/* On mingw, the gnulib <sys/stat.h> defines 'stat' as a function-like
+   macro; but using it in AT_FUNC_F2 causes compilation failure
+   because the preprocessor sees a use of a macro that requires two
+   arguments but is only given one.  Hence, we need an inline
+   forwarder to get past the preprocessor.  */
+static int
+stat_func (char const *name, struct stat *st)
+{
+  return stat (name, st);
+}
+
+/* Likewise, if there is no native 'lstat', then the gnulib
+   <sys/stat.h> defined it as stat, which also needs adjustment.  */
+# if !HAVE_LSTAT
+#  undef lstat
+#  define lstat stat_func
+# endif
+
+/* Replacement for Solaris' function by the same name.
+   <http://www.google.com/search?q=fstatat+site:docs.sun.com>
+   First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE").
+   Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd.
+   If either the save_cwd or the restore_cwd fails (relatively unlikely),
+   then give a diagnostic and exit nonzero.
+   Otherwise, this function works just like Solaris' fstatat.  */
+
+# define AT_FUNC_NAME fstatat
+# define AT_FUNC_F1 lstat
+# define AT_FUNC_F2 stat_func
+# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+# define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag
+# define AT_FUNC_POST_FILE_ARGS        , st
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#endif /* !HAVE_FSTATAT */
index b8036772d271d43cd61697d339d46e8d06cee595..027f77adc9e95983389a2ed8592b5754a67b4035 100644 (file)
@@ -1,6 +1,6 @@
 /* An interface to read and write that retries (if necessary) until complete.
 
-   Copyright (C) 1993-1994, 1997-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1997-2006, 2009-2015 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
index 589f6e1bc59351e396dc90be6d6bcdd77bee50ed..b32b53d9ec5a9618d74ef0a2c6de74542ee2fa29 100644 (file)
@@ -1,6 +1,6 @@
 /* An interface to write() that writes all it is asked to write.
 
-   Copyright (C) 2002-2003, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2009-2015 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
diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c
new file mode 100644 (file)
index 0000000..1e17e19
--- /dev/null
@@ -0,0 +1,126 @@
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of gnulib.
+
+   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/>.  */
+
+#include <config.h>
+
+/* Specification */
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if GNULIB_GETCWD
+/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use.  */
+typedef int dummy;
+#else
+
+/* Get the name of the current working directory, and put it in SIZE
+   bytes of BUF.  Returns NULL if the directory couldn't be determined
+   (perhaps because the absolute name was longer than PATH_MAX, or
+   because of missing read/search permissions on parent directories)
+   or SIZE was too small.  If successful, returns BUF.  If BUF is
+   NULL, an array is allocated with 'malloc'; the array is SIZE bytes
+   long, unless SIZE == 0, in which case it is as big as
+   necessary.  */
+
+# undef getcwd
+char *
+rpl_getcwd (char *buf, size_t size)
+{
+  char *ptr;
+  char *result;
+
+  /* Handle single size operations.  */
+  if (buf)
+    {
+      if (!size)
+        {
+          errno = EINVAL;
+          return NULL;
+        }
+      return getcwd (buf, size);
+    }
+
+  if (size)
+    {
+      buf = malloc (size);
+      if (!buf)
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
+      result = getcwd (buf, size);
+      if (!result)
+        {
+          int saved_errno = errno;
+          free (buf);
+          errno = saved_errno;
+        }
+      return result;
+    }
+
+  /* Flexible sizing requested.  Avoid over-allocation for the common
+     case of a name that fits within a 4k page, minus some space for
+     local variables, to be sure we don't skip over a guard page.  */
+  {
+    char tmp[4032];
+    size = sizeof tmp;
+    ptr = getcwd (tmp, size);
+    if (ptr)
+      {
+        result = strdup (ptr);
+        if (!result)
+          errno = ENOMEM;
+        return result;
+      }
+    if (errno != ERANGE)
+      return NULL;
+  }
+
+  /* My what a large directory name we have.  */
+  do
+    {
+      size <<= 1;
+      ptr = realloc (buf, size);
+      if (ptr == NULL)
+        {
+          free (buf);
+          errno = ENOMEM;
+          return NULL;
+        }
+      buf = ptr;
+      result = getcwd (buf, size);
+    }
+  while (!result && errno == ERANGE);
+
+  if (!result)
+    {
+      int saved_errno = errno;
+      free (buf);
+      errno = saved_errno;
+    }
+  else
+    {
+      /* Trim to fit, if possible.  */
+      result = realloc (buf, strlen (buf) + 1);
+      if (!result)
+        result = buf;
+    }
+  return result;
+}
+
+#endif
index f0c62713a65270f02c5af2ff9399766289c64386..59b97360bc576dce3b5c8f79a1d5b369670c34f1 100644 (file)
@@ -1,5 +1,5 @@
 /* getdtablesize() function for platforms that don't have it.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
index 7d950af1a5f2d4cb867fbc6d7a0d1cf74bf5f653..3b9c585a28c3abf20d6214ac62acc639d6cba001 100644 (file)
@@ -2,7 +2,7 @@
    NOTE: getopt is part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@gnu.org
    before changing it!
-   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2014 Free Software
+   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2015 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
index 7ab99fb83236da963b2efb53c0baeaa9f99acd62..9248f76ec8b1b54e2f8e792aac464816c6e46454 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2014 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
index a184865ea6373354e719bf03842b0ad2bb039a5b..2b1feb6eadb7277139f5f633be149db91567a520 100644 (file)
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2014 Free Software
+   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
index 24ed672e2eb72e560df84b526a80b8709950013d..e893a6e133f5b40de21eba3e2e18ea04cf9599b3 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2014 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
index c7d6fd345ceac949162abe03a8727f0935948eee..599a14ec1b3201e206247d473b27e927cda99e21 100644 (file)
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 1b4ca8d2f3a3591a3f4ca34e6c04b06d972bbf5a..1c47e3b299579c250cde2f2cd64884d27b6e134a 100644 (file)
@@ -1,6 +1,6 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004-2007, 2009-2015 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
index 8b2058e8c87fc4b6bcb82039b04c9293d8b64fe0..e0e2e696d044b8375c13a2381c5d6467e2ad4c2d 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide gettimeofday for systems that don't have it or for which it's broken.
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2015 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
index 6433442f8c198d5b121f334cab975293b121b8da..aa336e3002f9f17ed3dc9a299c39d7b1f5ff275f 100644 (file)
@@ -1,5 +1,5 @@
 /* Sequential list data type implemented by a linked list.
-   Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
index 8711823f58cb1eefbfba9532149984c8c93226e8..12f732e1b2bc627a4ab84fe1e9b9280af026751e 100644 (file)
@@ -1,5 +1,5 @@
 /* Sequential list data type implemented by a linked list.
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
index 69a63abaeb39e3369ece086601721c9339b7d3ca..b83e1644d083914eb2628310a7ef27dd53c10ef7 100644 (file)
@@ -1,5 +1,5 @@
 /* Sequential list data type implemented by a linked list.
-   Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
index f65859ad1cb72594bdbda9a41e5eeb865bb6f5ab..a7b7eec8068a25ff377afd8ded65d6bc2703af07 100644 (file)
@@ -1,5 +1,5 @@
 /* Sequential list data type implemented by a linked list.
-   Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
index ad6d12f1a619a20f2042a38680ed0d2b545fbf95..916f57f7de1587e8484ee879c7a7cfd00f4623a6 100644 (file)
@@ -1,5 +1,5 @@
 /* Abstract sequential list data type.
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
index a4f4e89c0ad8c1969aab259ce056f3421fc69d01..7ea62c1c278b14e08320b614a7fcbc47788f8e9e 100644 (file)
@@ -1,5 +1,5 @@
 /* Abstract sequential list data type, with out-of-memory checking.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2009.
 
    This program is free software: you can redistribute it and/or modify
index 493cf9c23ea3fda4d24c7660a62e4a2ff00fcedf..9d80d74349de1dbc71561636553c3a59d2501b54 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fcntl-h full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile lchmod linked-list lstat maintainer-makefile malloc manywarnings memchr minmax mkdir progname quotearg readlink realloc rename rmdir setenv signal ssize_t stat-time stdbool stdlib symlink sys_stat tempname time unistd unlink update-copyright utimens verror xalloc xlist xmemdup0
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fchmodat fchownat fcntl-h fstatat full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile linked-list maintainer-makefile malloc manywarnings memchr minmax mkdirat openat progname quotearg readlinkat realloc renameat setenv signal ssize_t stat-time stdbool stdlib symlinkat sys_stat tempname time unistd unlinkat update-copyright utimensat verror xalloc xlist xmemdup0
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -73,6 +73,22 @@ EXTRA_DIST += argmatch.h
 
 ## end   gnulib module argmatch
 
+## begin gnulib module assure
+
+
+EXTRA_DIST += assure.h
+
+## end   gnulib module assure
+
+## begin gnulib module at-internal
+
+
+EXTRA_DIST += openat-priv.h openat-proc.c
+
+EXTRA_libpatch_a_SOURCES += openat-proc.c
+
+## end   gnulib module at-internal
+
 ## begin gnulib module backupfile
 
 libpatch_a_SOURCES += backupfile.c
@@ -115,6 +131,32 @@ EXTRA_libpatch_a_SOURCES += canonicalize-lgpl.c
 
 ## end   gnulib module canonicalize-lgpl
 
+## begin gnulib module chdir-long
+
+
+EXTRA_DIST += chdir-long.c chdir-long.h
+
+EXTRA_libpatch_a_SOURCES += chdir-long.c
+
+## end   gnulib module chdir-long
+
+## begin gnulib module chown
+
+
+EXTRA_DIST += chown.c fchown-stub.c
+
+EXTRA_libpatch_a_SOURCES += chown.c fchown-stub.c
+
+## end   gnulib module chown
+
+## begin gnulib module cloexec
+
+libpatch_a_SOURCES += cloexec.c
+
+EXTRA_DIST += cloexec.h
+
+## end   gnulib module cloexec
+
 ## begin gnulib module close
 
 
@@ -334,6 +376,35 @@ EXTRA_DIST += exitfail.h
 
 ## end   gnulib module exitfail
 
+## begin gnulib module fchdir
+
+
+EXTRA_DIST += fchdir.c
+
+EXTRA_libpatch_a_SOURCES += fchdir.c
+
+## end   gnulib module fchdir
+
+## begin gnulib module fchmodat
+
+libpatch_a_SOURCES += chmodat.c
+
+EXTRA_DIST += at-func.c fchmodat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fchmodat.c
+
+## end   gnulib module fchmodat
+
+## begin gnulib module fchownat
+
+libpatch_a_SOURCES += chownat.c
+
+EXTRA_DIST += at-func.c fchownat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fchownat.c
+
+## end   gnulib module fchownat
+
 ## begin gnulib module fcntl
 
 
@@ -393,6 +464,14 @@ EXTRA_DIST += filename.h
 
 ## end   gnulib module filename
 
+## begin gnulib module filenamecat-lgpl
+
+libpatch_a_SOURCES += filenamecat-lgpl.c
+
+EXTRA_DIST += filenamecat.h
+
+## end   gnulib module filenamecat-lgpl
+
 ## begin gnulib module float
 
 BUILT_SOURCES += $(FLOAT_H)
@@ -433,12 +512,30 @@ EXTRA_libpatch_a_SOURCES += fstat.c
 
 ## end   gnulib module fstat
 
+## begin gnulib module fstatat
+
+
+EXTRA_DIST += at-func.c fstatat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fstatat.c
+
+## end   gnulib module fstatat
+
 ## begin gnulib module full-write
 
 libpatch_a_SOURCES += full-write.h full-write.c
 
 ## end   gnulib module full-write
 
+## begin gnulib module getcwd-lgpl
+
+
+EXTRA_DIST += getcwd-lgpl.c
+
+EXTRA_libpatch_a_SOURCES += getcwd-lgpl.c
+
+## end   gnulib module getcwd-lgpl
+
 ## begin gnulib module getdate
 
 
@@ -549,6 +646,15 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
+## begin gnulib module lchown
+
+
+EXTRA_DIST += lchown.c
+
+EXTRA_libpatch_a_SOURCES += lchown.c
+
+## end   gnulib module lchown
+
 ## begin gnulib module linked-list
 
 libpatch_a_SOURCES += gl_linked_list.h gl_linked_list.c gl_anylinked_list1.h gl_anylinked_list2.h
@@ -703,6 +809,24 @@ EXTRA_libpatch_a_SOURCES += memchr.c
 
 ## end   gnulib module memchr
 
+## begin gnulib module mempcpy
+
+
+EXTRA_DIST += mempcpy.c
+
+EXTRA_libpatch_a_SOURCES += mempcpy.c
+
+## end   gnulib module mempcpy
+
+## begin gnulib module memrchr
+
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libpatch_a_SOURCES += memrchr.c
+
+## end   gnulib module memrchr
+
 ## begin gnulib module minmax
 
 libpatch_a_SOURCES += minmax.h
@@ -718,6 +842,15 @@ EXTRA_libpatch_a_SOURCES += mkdir.c
 
 ## end   gnulib module mkdir
 
+## begin gnulib module mkdirat
+
+
+EXTRA_DIST += at-func.c mkdirat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c mkdirat.c
+
+## end   gnulib module mkdirat
+
 ## begin gnulib module mktime
 
 
@@ -745,6 +878,37 @@ EXTRA_libpatch_a_SOURCES += msvc-nothrow.c
 
 ## end   gnulib module msvc-nothrow
 
+## begin gnulib module open
+
+
+EXTRA_DIST += open.c
+
+EXTRA_libpatch_a_SOURCES += open.c
+
+## end   gnulib module open
+
+## begin gnulib module openat
+
+
+EXTRA_DIST += openat.c
+
+EXTRA_libpatch_a_SOURCES += openat.c
+
+## end   gnulib module openat
+
+## begin gnulib module openat-die
+
+libpatch_a_SOURCES += openat-die.c
+
+## end   gnulib module openat-die
+
+## begin gnulib module openat-h
+
+
+EXTRA_DIST += openat.h
+
+## end   gnulib module openat-h
+
 ## begin gnulib module opendir
 
 
@@ -832,6 +996,15 @@ EXTRA_libpatch_a_SOURCES += readlink.c
 
 ## end   gnulib module readlink
 
+## begin gnulib module readlinkat
+
+
+EXTRA_DIST += at-func.c readlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c readlinkat.c
+
+## end   gnulib module readlinkat
+
 ## begin gnulib module realloc-gnu
 
 
@@ -859,6 +1032,15 @@ EXTRA_libpatch_a_SOURCES += rename.c
 
 ## end   gnulib module rename
 
+## begin gnulib module renameat
+
+
+EXTRA_DIST += at-func2.c renameat.c
+
+EXTRA_libpatch_a_SOURCES += at-func2.c renameat.c
+
+## end   gnulib module renameat
+
 ## begin gnulib module rmdir
 
 
@@ -885,6 +1067,14 @@ EXTRA_DIST += same-inode.h
 
 ## end   gnulib module same-inode
 
+## begin gnulib module save-cwd
+
+libpatch_a_SOURCES += save-cwd.c
+
+EXTRA_DIST += save-cwd.h
+
+## end   gnulib module save-cwd
+
 ## begin gnulib module secure_getenv
 
 
@@ -1049,6 +1239,12 @@ EXTRA_DIST += stat-time.h
 
 ## end   gnulib module stat-time
 
+## begin gnulib module statat
+
+libpatch_a_SOURCES += statat.c
+
+## end   gnulib module statat
+
 ## begin gnulib module stdarg
 
 BUILT_SOURCES += $(STDARG_H)
@@ -1115,6 +1311,7 @@ stddef.h: stddef.in.h $(top_builddir)/config.status
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+             -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
              -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
              -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
              < $(srcdir)/stddef.in.h; \
@@ -1413,6 +1610,15 @@ EXTRA_DIST += stdlib.in.h
 
 ## end   gnulib module stdlib
 
+## begin gnulib module strdup-posix
+
+
+EXTRA_DIST += strdup.c
+
+EXTRA_libpatch_a_SOURCES += strdup.c
+
+## end   gnulib module strdup-posix
+
 ## begin gnulib module streq
 
 
@@ -1565,6 +1771,15 @@ EXTRA_libpatch_a_SOURCES += symlink.c
 
 ## end   gnulib module symlink
 
+## begin gnulib module symlinkat
+
+
+EXTRA_DIST += at-func.c symlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c symlinkat.c
+
+## end   gnulib module symlinkat
+
 ## begin gnulib module sys_stat
 
 BUILT_SOURCES += sys/stat.h
@@ -1727,6 +1942,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -1927,6 +2143,15 @@ EXTRA_libpatch_a_SOURCES += unlink.c
 
 ## end   gnulib module unlink
 
+## begin gnulib module unlinkat
+
+
+EXTRA_DIST += at-func.c unlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c unlinkat.c
+
+## end   gnulib module unlinkat
+
 ## begin gnulib module unsetenv
 
 
@@ -1958,6 +2183,15 @@ EXTRA_DIST += utimens.h
 
 ## end   gnulib module utimens
 
+## begin gnulib module utimensat
+
+
+EXTRA_DIST += at-func.c utimensat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c utimensat.c
+
+## end   gnulib module utimensat
+
 ## begin gnulib module vasnprintf
 
 
index d312a2644e25622718de776aeea26403d62caf2b..439c533dbaebfb5fa852fc74e80a3adfebe8ca27 100644 (file)
@@ -1,6 +1,6 @@
 /* hash - hashing table processing.
 
-   Copyright (C) 1998-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1998-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
 
    Written by Jim Meyering, 1992.
 
index 9994f5f6656048423e1b09934e0118ca5a373672..e678a2bbd8d87c3f1c7ef2661efed7c7eacbd095 100644 (file)
@@ -1,5 +1,5 @@
 /* hash - hashing table processing.
-   Copyright (C) 1998-1999, 2001, 2003, 2009-2014 Free Software Foundation,
+   Copyright (C) 1998-1999, 2001, 2003, 2009-2015 Free Software Foundation,
    Inc.
    Written by Jim Meyering <meyering@ascend.com>, 1998.
 
index 4dd0946d4bed5c599301ad4d35326daecad93e9e..68521edb38f50cb2230c8560a125864be212db6a 100644 (file)
@@ -1,6 +1,6 @@
 /* ignore a function return without a compiler warning
 
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index d0bb7a6f57734e15e535cfc6b287a555dc6ccbb3..f85ccade4e1adf07abf0e98ac82378b8da9f641a 100644 (file)
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2005, 2009-2015 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
index 937f4805e65919f20a10cf63cf7d2e4f905680f4..1eee03e345833c4d69d6f3cb579154bd29a467ec 100644 (file)
@@ -1,5 +1,5 @@
 /* Replacement for 'int' to 'long double' conversion routine.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2011.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/lchown.c b/lib/lchown.c
new file mode 100644 (file)
index 0000000..7f5f602
--- /dev/null
@@ -0,0 +1,117 @@
+/* Provide a stub lchown function for systems that lack it.
+
+   Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2015 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 Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_LCHOWN
+
+/* If the system chown does not follow symlinks, we don't want it
+   replaced by gnulib's chown, which does follow symlinks.  */
+# if CHOWN_MODIFIES_SYMLINK
+#  undef chown
+# endif
+
+/* Work just like chown, except when FILE is a symbolic link.
+   In that case, set errno to EOPNOTSUPP and return -1.
+   But if autoconf tests determined that chown modifies
+   symlinks, then just call chown.  */
+
+int
+lchown (const char *file, uid_t uid, gid_t gid)
+{
+# if HAVE_CHOWN
+#  if ! CHOWN_MODIFIES_SYMLINK
+  struct stat stats;
+
+  if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
+    {
+      errno = EOPNOTSUPP;
+      return -1;
+    }
+#  endif
+
+  return chown (file, uid, gid);
+
+# else /* !HAVE_CHOWN */
+  errno = ENOSYS;
+  return -1;
+# endif
+}
+
+#else /* HAVE_LCHOWN */
+
+# undef lchown
+
+/* Work around trailing slash bugs in lchown.  */
+int
+rpl_lchown (const char *file, uid_t uid, gid_t gid)
+{
+  bool stat_valid = false;
+  int result;
+
+# if CHOWN_CHANGE_TIME_BUG
+  struct stat st;
+
+  if (gid != (gid_t) -1 || uid != (uid_t) -1)
+    {
+      if (lstat (file, &st))
+        return -1;
+      stat_valid = true;
+      if (!S_ISLNK (st.st_mode))
+        return chown (file, uid, gid);
+    }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG
+  if (!stat_valid)
+    {
+      size_t len = strlen (file);
+      if (len && file[len - 1] == '/')
+        return chown (file, uid, gid);
+    }
+# endif
+
+  result = lchown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG && HAVE_LCHMOD
+  if (result == 0 && stat_valid
+      && (uid == st.st_uid || uid == (uid_t) -1)
+      && (gid == st.st_gid || gid == (gid_t) -1))
+    {
+      /* No change in ownership, but at least one argument was not -1,
+         so we are required to update ctime.  Since lchown succeeded,
+         we assume that lchmod will do likewise.  But if the system
+         lacks lchmod and lutimes, we are out of luck.  Oh well.  */
+      result = lchmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+                                           | S_ISUID | S_ISGID | S_ISVTX));
+    }
+# endif
+
+  return result;
+}
+
+#endif /* HAVE_LCHOWN */
index ccfa993ee8ed8bbade76d7019bb38c247a64a895..1f02aa598822524cca034ff4d0cc4aff60f4141b 100644 (file)
@@ -1,6 +1,6 @@
 /* Determine a canonical name for the current locale's character encoding.
 
-   Copyright (C) 2000-2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2006, 2008-2015 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
@@ -128,7 +128,7 @@ get_charset_aliases (void)
   cp = charset_aliases;
   if (cp == NULL)
     {
-#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__)
+#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2)
       const char *dir;
       const char *base = "charset.alias";
       char *file_name;
@@ -342,6 +342,36 @@ get_charset_aliases (void)
            "CP54936" "\0" "GB18030" "\0"
            "CP65001" "\0" "UTF-8" "\0";
 # endif
+# if defined OS2
+      /* To avoid the troubles of installing a separate file in the same
+         directory as the DLL and of retrieving the DLL's directory at
+         runtime, simply inline the aliases here.  */
+
+      /* The list of encodings is taken from "List of OS/2 Codepages"
+         by Alex Taylor:
+         <http://altsan.org/os2/toolkits/uls/index.html#codepages>.
+         See also "IBM Globalization - Code page identifiers":
+         <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>.  */
+      cp = "CP813" "\0" "ISO-8859-7" "\0"
+           "CP878" "\0" "KOI8-R" "\0"
+           "CP819" "\0" "ISO-8859-1" "\0"
+           "CP912" "\0" "ISO-8859-2" "\0"
+           "CP913" "\0" "ISO-8859-3" "\0"
+           "CP914" "\0" "ISO-8859-4" "\0"
+           "CP915" "\0" "ISO-8859-5" "\0"
+           "CP916" "\0" "ISO-8859-8" "\0"
+           "CP920" "\0" "ISO-8859-9" "\0"
+           "CP921" "\0" "ISO-8859-13" "\0"
+           "CP923" "\0" "ISO-8859-15" "\0"
+           "CP954" "\0" "EUC-JP" "\0"
+           "CP964" "\0" "EUC-TW" "\0"
+           "CP970" "\0" "EUC-KR" "\0"
+           "CP1089" "\0" "ISO-8859-6" "\0"
+           "CP1208" "\0" "UTF-8" "\0"
+           "CP1381" "\0" "GB2312" "\0"
+           "CP1386" "\0" "GBK" "\0"
+           "CP3372" "\0" "EUC-JP" "\0";
+# endif
 #endif
 
       charset_aliases = cp;
@@ -499,6 +529,8 @@ locale_charset (void)
   ULONG cp[3];
   ULONG cplen;
 
+  codeset = NULL;
+
   /* Allow user to override the codeset, as set in the operating system,
      with standard language environment variables.  */
   locale = getenv ("LC_ALL");
@@ -530,10 +562,12 @@ locale_charset (void)
             }
         }
 
-      /* Resolve through the charset.alias file.  */
-      codeset = locale;
+      /* For the POSIX locale, don't use the system's codepage.  */
+      if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
+        codeset = "";
     }
-  else
+
+  if (codeset == NULL)
     {
       /* OS/2 has a function returning the locale's codepage as a number.  */
       if (DosQueryCp (sizeof (cp), cp, &cplen))
index 9011d5805d5de2dd6d4145efa5678e26a45a6c5b..c5e6d463505a8e545f041c4167524d8d5dfd7fd4 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine a canonical name for the current locale's character encoding.
-   Copyright (C) 2000-2003, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2009-2015 Free Software Foundation, Inc.
    This file is part of the GNU CHARSET Library.
 
    This program is free software; you can redistribute it and/or modify
index f70fd435c03047f2f52e53d8900c2a4cf1b56f78..31dee1387f50b7baf0385fdef6ca09c85ed07bea 100644 (file)
@@ -1,6 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2015 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
index bc81c54dcc67f3aa4ad04b3b7f8886402ddee35e..00800a2848fa5a54d229d38511eba74d865aa98d 100644 (file)
@@ -1,6 +1,6 @@
 /* malloc() function that is glibc compatible.
 
-   Copyright (C) 1997-1998, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1997-1998, 2006-2007, 2009-2015 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
index 370551c534cbd79e51bcb9778c9230d2bda0c421..198a96ce7406e0e5b249d7b58d4535f195d1f4b5 100644 (file)
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify
index 5071e46f9ee1cc79f160620eb8c794a5716bbc17..7a4190cfe4e8e88872c4fcb251b4e764984770f4 100644 (file)
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify
index 5743f437f6a2585670d078f51689f442f6344e9b..e49d55b3b1037dfdd7cab83f9be98fe8aa53ec56 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert multibyte character to wide character.
-   Copyright (C) 1999-2002, 2005-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2005-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
index df4bcd182ac98961845bf6bd2acd6f25d1f699e3..4effdd8047ddbc7f499073ae0c7d11f90f155cce 100644 (file)
@@ -1,5 +1,5 @@
 /* Test for initial conversion state.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
index 6709f6ea2edb7f184ef74bf025696133bdc9d074..f74cc9afc13d9448d8ad2bfcbd0898b91dff601d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2015
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/mempcpy.c b/lib/mempcpy.c
new file mode 100644 (file)
index 0000000..e9f2e34
--- /dev/null
@@ -0,0 +1,28 @@
+/* Copy memory area and return pointer after last written byte.
+   Copyright (C) 2003, 2007, 2009-2015 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, 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/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+void *
+mempcpy (void *dest, const void *src, size_t n)
+{
+  return (char *) memcpy (dest, src, n) + n;
+}
diff --git a/lib/memrchr.c b/lib/memrchr.c
new file mode 100644 (file)
index 0000000..3827208
--- /dev/null
@@ -0,0 +1,161 @@
+/* memrchr -- find the last occurrence of a byte in a memory block
+
+   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software
+   Foundation, Inc.
+
+   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+   with help from Dan Sahlin (dan@sics.se) and
+   commentary by Jim Blandy (jimb@ai.mit.edu);
+   adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+   and implemented by Roland McGrath (roland@ai.mit.edu).
+
+   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/>.  */
+
+#if defined _LIBC
+# include <memcopy.h>
+#else
+# include <config.h>
+# define reg_char char
+#endif
+
+#include <string.h>
+#include <limits.h>
+
+#undef __memrchr
+#ifdef _LIBC
+# undef memrchr
+#endif
+
+#ifndef weak_alias
+# define __memrchr memrchr
+#endif
+
+/* Search no more than N bytes of S for C.  */
+void *
+__memrchr (void const *s, int c_in, size_t n)
+{
+  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+     long instead of a 64-bit uintmax_t tends to give better
+     performance.  On 64-bit hardware, unsigned long is generally 64
+     bits already.  Change this typedef to experiment with
+     performance.  */
+  typedef unsigned long int longword;
+
+  const unsigned char *char_ptr;
+  const longword *longword_ptr;
+  longword repeated_one;
+  longword repeated_c;
+  unsigned reg_char c;
+
+  c = (unsigned char) c_in;
+
+  /* Handle the last few bytes by reading one byte at a time.
+     Do this until CHAR_PTR is aligned on a longword boundary.  */
+  for (char_ptr = (const unsigned char *) s + n;
+       n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
+       --n)
+    if (*--char_ptr == c)
+      return (void *) char_ptr;
+
+  longword_ptr = (const longword *) char_ptr;
+
+  /* All these elucidatory comments refer to 4-byte longwords,
+     but the theory applies equally well to any size longwords.  */
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c has c in every byte.  */
+  repeated_one = 0x01010101;
+  repeated_c = c | (c << 8);
+  repeated_c |= repeated_c << 16;
+  if (0xffffffffU < (longword) -1)
+    {
+      repeated_one |= repeated_one << 31 << 1;
+      repeated_c |= repeated_c << 31 << 1;
+      if (8 < sizeof (longword))
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
+    }
+
+  /* Instead of the traditional loop which tests each byte, we will test a
+     longword at a time.  The tricky part is testing if *any of the four*
+     bytes in the longword in question are equal to c.  We first use an xor
+     with repeated_c.  This reduces the task to testing whether *any of the
+     four* bytes in longword1 is zero.
+
+     We compute tmp =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     So, the test whether any byte in longword1 is zero is equivalent to
+     testing whether tmp is nonzero.  */
+
+  while (n >= sizeof (longword))
+    {
+      longword longword1 = *--longword_ptr ^ repeated_c;
+
+      if ((((longword1 - repeated_one) & ~longword1)
+           & (repeated_one << 7)) != 0)
+        {
+          longword_ptr++;
+          break;
+        }
+      n -= sizeof (longword);
+    }
+
+  char_ptr = (const unsigned char *) longword_ptr;
+
+  /* At this point, we know that either n < sizeof (longword), or one of the
+     sizeof (longword) bytes starting at char_ptr is == c.  On little-endian
+     machines, we could determine the first such byte without any further
+     memory accesses, just by looking at the tmp result from the last loop
+     iteration.  But this does not work on big-endian machines.  Choose code
+     that works in both cases.  */
+
+  while (n-- > 0)
+    {
+      if (*--char_ptr == c)
+        return (void *) char_ptr;
+    }
+
+  return NULL;
+}
+#ifdef weak_alias
+weak_alias (__memrchr, memrchr)
+#endif
index af1fc9bfc6ece53958204bab1bebb3faf922585d..919678db350266aae7efac096953824e2da6a440 100644 (file)
@@ -1,5 +1,5 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2014 Free Software
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 481bbf375ec27df28586f0f7b35d17ffc86ffcc9..37de12e3fa05f07b587fdc72233bcb95fe4be047 100644 (file)
@@ -1,7 +1,7 @@
 /* On some systems, mkdir ("foo/", 0700) fails because of the trailing
    slash.  On those systems, this wrapper removes the trailing slash.
 
-   Copyright (C) 2001, 2003, 2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2006, 2008-2015 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
diff --git a/lib/mkdirat.c b/lib/mkdirat.c
new file mode 100644 (file)
index 0000000..3012ac4
--- /dev/null
@@ -0,0 +1,34 @@
+/* fd-relative mkdir
+   Copyright (C) 2005-2006, 2009-2015 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 Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+/* Solaris 10 has no function like this.
+   Create a subdirectory, FILE, with mode MODE, in the directory
+   open on descriptor FD.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then mkdir/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+#define AT_FUNC_NAME mkdirat
+#define AT_FUNC_F1 mkdir
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode
+#define AT_FUNC_POST_FILE_ARGS        , mode
+#include "at-func.c"
index 48b3a40f9c73ee0c6f626f0278dba12ec86c4947..580bc8ed0043ddec65f84e6ec7171a0b508e343f 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert a 'struct tm' to a time_t value.
-   Copyright (C) 1993-2014 Free Software Foundation, Inc.
+   Copyright (C) 1993-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <eggert@twinsun.com>.
 
index f83827fb4d92ccb5bd61214f5dccafc626d6e7fc..a1f1dc0ee056893f68ad26a5f40ef7271f4bcfba 100644 (file)
@@ -1,5 +1,5 @@
 /* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index a0ef540fc50f2a6112877788be622fe15b2665a5..8b07269a7040593b86545dc20cb72f6a682886ac 100644 (file)
@@ -1,5 +1,5 @@
 /* Invalid parameter handler for MSVC runtime libraries.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index b1e5f0c97f4c6103a0a118414ed10c45538fc868..90cf8014e53fc064d89d57e4cf13dcc57b1b8af6 100644 (file)
@@ -1,6 +1,6 @@
 /* Wrappers that don't throw invalid parameter notifications
    with MSVC runtime libraries.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index 0d4dea584b83582762b83f7bc771995db953c0ec..67b151e65ebb3606b0ef5cf098c4a98bb842e668 100644 (file)
@@ -1,6 +1,6 @@
 /* Wrappers that don't throw invalid parameter notifications
    with MSVC runtime libraries.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
diff --git a/lib/open.c b/lib/open.c
new file mode 100644 (file)
index 0000000..95c7811
--- /dev/null
@@ -0,0 +1,181 @@
+/* Open a descriptor to a file.
+   Copyright (C) 2007-2015 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 Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_open doesn't recurse to
+   rpl_open.  */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open.  It might be defined as a macro.  */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+static int
+orig_open (const char *filename, int flags, mode_t mode)
+{
+  return open (filename, flags, mode);
+}
+
+/* Specification.  */
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <fcntl.h> above.  */
+#include "fcntl.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+int
+open (const char *filename, int flags, ...)
+{
+  mode_t mode;
+  int fd;
+
+  mode = 0;
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+    }
+
+#if GNULIB_defined_O_NONBLOCK
+  /* The only known platform that lacks O_NONBLOCK is mingw, but it
+     also lacks named pipes and Unix sockets, which are the only two
+     file types that require non-blocking handling in open().
+     Therefore, it is safe to ignore O_NONBLOCK here.  It is handy
+     that mingw also lacks openat(), so that is also covered here.  */
+  flags &= ~O_NONBLOCK;
+#endif
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  if (strcmp (filename, "/dev/null") == 0)
+    filename = "NUL";
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
+     is specified, then fail.
+     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+     says that
+       "A pathname that contains at least one non-slash character and that
+        ends with one or more trailing slashes shall be resolved as if a
+        single dot character ( '.' ) were appended to the pathname."
+     and
+       "The special filename dot shall refer to the directory specified by
+        its predecessor."
+     If the named file already exists as a directory, then
+       - if O_CREAT is specified, open() must fail because of the semantics
+         of O_CREAT,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+         <http://www.opengroup.org/susv3/functions/open.html> says that it
+         fails with errno = EISDIR in this case.
+     If the named file does not exist or does not name a directory, then
+       - if O_CREAT is specified, open() must fail since open() cannot create
+         directories,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because the
+         file does not contain a '.' directory.  */
+  if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+    {
+      size_t len = strlen (filename);
+      if (len > 0 && filename[len - 1] == '/')
+        {
+          errno = EISDIR;
+          return -1;
+        }
+    }
+#endif
+
+  fd = orig_open (filename, flags, mode);
+
+#if REPLACE_FCHDIR
+  /* Implementing fchdir and fdopendir requires the ability to open a
+     directory file descriptor.  If open doesn't support that (as on
+     mingw), we use a dummy file that behaves the same as directories
+     on Linux (ie. always reports EOF on attempts to read()), and
+     override fstat() in fchdir.c to hide the fact that we have a
+     dummy.  */
+  if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
+      && ((flags & O_ACCMODE) == O_RDONLY
+          || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
+    {
+      struct stat statbuf;
+      if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+        {
+          /* Maximum recursion depth of 1.  */
+          fd = open ("/dev/null", flags, mode);
+          if (0 <= fd)
+            fd = _gl_register_fd (fd, filename);
+        }
+      else
+        errno = EACCES;
+    }
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and fd does not refer to a directory,
+     then fail.
+     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+     says that
+       "A pathname that contains at least one non-slash character and that
+        ends with one or more trailing slashes shall be resolved as if a
+        single dot character ( '.' ) were appended to the pathname."
+     and
+       "The special filename dot shall refer to the directory specified by
+        its predecessor."
+     If the named file without the slash is not a directory, open() must fail
+     with ENOTDIR.  */
+  if (fd >= 0)
+    {
+      /* We know len is positive, since open did not fail with ENOENT.  */
+      size_t len = strlen (filename);
+      if (filename[len - 1] == '/')
+        {
+          struct stat statbuf;
+
+          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+            {
+              close (fd);
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+    }
+#endif
+
+#if REPLACE_FCHDIR
+  if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
+    fd = _gl_register_fd (fd, filename);
+#endif
+
+  return fd;
+}
diff --git a/lib/openat-die.c b/lib/openat-die.c
new file mode 100644 (file)
index 0000000..4accca0
--- /dev/null
@@ -0,0 +1,62 @@
+/* Report a save- or restore-cwd failure in our openat replacement and then exit.
+
+   Copyright (C) 2005-2006, 2008-2015 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/>.  */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <stdlib.h>
+
+#ifndef GNULIB_LIBPOSIX
+# include "error.h"
+#endif
+
+#include "exitfail.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+_Noreturn void
+openat_save_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+  error (exit_failure, errnum,
+         _("unable to record current working directory"));
+#endif
+  /* _Noreturn cannot be applied to error, since it returns
+     when its first argument is 0.  To help compilers understand that this
+     function does not return, call abort.  Also, the abort is a
+     safety feature if exit_failure is 0 (which shouldn't happen).  */
+  abort ();
+}
+
+
+/* Exit with an error about failure to restore the working directory
+   during an openat emulation.  The caller must ensure that fd 2 is
+   not a just-opened fd, even when openat_safer is not in use.  */
+
+_Noreturn void
+openat_restore_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+  error (exit_failure, errnum,
+         _("failed to return to initial working directory"));
+#endif
+
+  /* As above.  */
+  abort ();
+}
diff --git a/lib/openat-priv.h b/lib/openat-priv.h
new file mode 100644 (file)
index 0000000..f5a3690
--- /dev/null
@@ -0,0 +1,64 @@
+/* Internals for openat-like functions.
+
+   Copyright (C) 2005-2006, 2009-2015 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 Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT_PRIV
+#define _GL_HEADER_OPENAT_PRIV
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+/* Maximum number of bytes that it is safe to allocate as a single
+   array on the stack, and that is known as a compile-time constant.
+   The assumption is that we'll touch the array very quickly, or a
+   temporary very near the array, provoking an out-of-memory trap.  On
+   some operating systems, there is only one guard page for the stack,
+   and a page size can be as small as 4096 bytes.  Subtract 64 in the
+   hope that this will let the compiler touch a nearby temporary and
+   provoke a trap.  */
+#define SAFER_ALLOCA_MAX (4096 - 64)
+
+#define SAFER_ALLOCA(m) ((m) < SAFER_ALLOCA_MAX ? (m) : SAFER_ALLOCA_MAX)
+
+#if defined PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (PATH_MAX)
+#elif defined _XOPEN_PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (_XOPEN_PATH_MAX)
+#else
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (1024)
+#endif
+
+char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
+
+/* Trying to access a BUILD_PROC_NAME file will fail on systems without
+   /proc support, and even on systems *with* ProcFS support.  Return
+   nonzero if the failure may be legitimate, e.g., because /proc is not
+   readable, or the particular .../fd/N directory is not present.  */
+#define EXPECTED_ERRNO(Errno)                   \
+  ((Errno) == ENOTDIR || (Errno) == ENOENT      \
+   || (Errno) == EPERM || (Errno) == EACCES     \
+   || (Errno) == ENOSYS /* Solaris 8 */         \
+   || (Errno) == EOPNOTSUPP /* FreeBSD */)
+
+/* Wrapper function shared among linkat and renameat.  */
+int at_func2 (int fd1, char const *file1,
+              int fd2, char const *file2,
+              int (*func) (char const *file1, char const *file2));
+
+#endif /* _GL_HEADER_OPENAT_PRIV */
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
new file mode 100644 (file)
index 0000000..4e1d341
--- /dev/null
@@ -0,0 +1,102 @@
+/* Create /proc/self/fd-related names for subfiles of open directories.
+
+   Copyright (C) 2006, 2009-2015 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 Paul Eggert.  */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "intprops.h"
+
+#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
+
+#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
+  (sizeof PROC_SELF_FD_FORMAT - sizeof "%d%s" \
+   + INT_STRLEN_BOUND (int) + (len) + 1)
+
+
+/* Set BUF to the expansion of PROC_SELF_FD_FORMAT, using FD and FILE
+   respectively for %d and %s.  If successful, return BUF if the
+   result fits in BUF, dynamically allocated memory otherwise.  But
+   return NULL if /proc is not reliable, either because the operating
+   system support is lacking or because memory is low.  */
+char *
+openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
+{
+  static int proc_status = 0;
+
+  /* Make sure the caller gets ENOENT when appropriate.  */
+  if (!*file)
+    {
+      buf[0] = '\0';
+      return buf;
+    }
+
+  if (! proc_status)
+    {
+      /* Set PROC_STATUS to a positive value if /proc/self/fd is
+         reliable, and a negative value otherwise.  Solaris 10
+         /proc/self/fd mishandles "..", and any file name might expand
+         to ".." after symbolic link expansion, so avoid /proc/self/fd
+         if it mishandles "..".  Solaris 10 has openat, but this
+         problem is exhibited on code that built on Solaris 8 and
+         running on Solaris 10.  */
+
+      int proc_self_fd = open ("/proc/self/fd",
+                               O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+      if (proc_self_fd < 0)
+        proc_status = -1;
+      else
+        {
+          /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the
+             number of a file descriptor open on /proc/self/fd.  On Linux,
+             that name resolves to /proc/self/fd, which was opened above.
+             However, on Solaris, it may resolve to /proc/self/fd/fd, which
+             cannot exist, since all names in /proc/self/fd are numeric.  */
+          char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)];
+          sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd");
+          proc_status = access (dotdot_buf, F_OK) ? -1 : 1;
+          close (proc_self_fd);
+        }
+    }
+
+  if (proc_status < 0)
+    return NULL;
+  else
+    {
+      size_t bufsize = PROC_SELF_FD_NAME_SIZE_BOUND (strlen (file));
+      char *result = buf;
+      if (OPENAT_BUFFER_SIZE < bufsize)
+        {
+          result = malloc (bufsize);
+          if (! result)
+            return NULL;
+        }
+      sprintf (result, PROC_SELF_FD_FORMAT, fd, file);
+      return result;
+    }
+}
diff --git a/lib/openat.c b/lib/openat.c
new file mode 100644 (file)
index 0000000..d1de8b9
--- /dev/null
@@ -0,0 +1,286 @@
+/* provide a replacement openat function
+   Copyright (C) 2004-2015 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 Jim Meyering */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_openat doesn't recurse to
+   rpl_openat.  */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open.  It might be defined as a macro.  */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+#if HAVE_OPENAT
+static int
+orig_openat (int fd, char const *filename, int flags, mode_t mode)
+{
+  return openat (fd, filename, flags, mode);
+}
+#endif
+
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <fcntl.h> above.  */
+#include "fcntl.h"
+
+#include "openat.h"
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#if HAVE_OPENAT
+
+/* Like openat, but work around Solaris 9 bugs with trailing slash.  */
+int
+rpl_openat (int dfd, char const *filename, int flags, ...)
+{
+  mode_t mode;
+  int fd;
+
+  mode = 0;
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+    }
+
+# if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
+     is specified, then fail.
+     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+     says that
+       "A pathname that contains at least one non-slash character and that
+        ends with one or more trailing slashes shall be resolved as if a
+        single dot character ( '.' ) were appended to the pathname."
+     and
+       "The special filename dot shall refer to the directory specified by
+        its predecessor."
+     If the named file already exists as a directory, then
+       - if O_CREAT is specified, open() must fail because of the semantics
+         of O_CREAT,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+         <http://www.opengroup.org/susv3/functions/open.html> says that it
+         fails with errno = EISDIR in this case.
+     If the named file does not exist or does not name a directory, then
+       - if O_CREAT is specified, open() must fail since open() cannot create
+         directories,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because the
+         file does not contain a '.' directory.  */
+  if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+    {
+      size_t len = strlen (filename);
+      if (len > 0 && filename[len - 1] == '/')
+        {
+          errno = EISDIR;
+          return -1;
+        }
+    }
+# endif
+
+  fd = orig_openat (dfd, filename, flags, mode);
+
+# if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and fd does not refer to a directory,
+     then fail.
+     Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+     says that
+       "A pathname that contains at least one non-slash character and that
+        ends with one or more trailing slashes shall be resolved as if a
+        single dot character ( '.' ) were appended to the pathname."
+     and
+       "The special filename dot shall refer to the directory specified by
+        its predecessor."
+     If the named file without the slash is not a directory, open() must fail
+     with ENOTDIR.  */
+  if (fd >= 0)
+    {
+      /* We know len is positive, since open did not fail with ENOENT.  */
+      size_t len = strlen (filename);
+      if (filename[len - 1] == '/')
+        {
+          struct stat statbuf;
+
+          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+            {
+              close (fd);
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+    }
+# endif
+
+  return fd;
+}
+
+#else /* !HAVE_OPENAT */
+
+# include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+# include "openat-priv.h"
+# include "save-cwd.h"
+
+/* Replacement for Solaris' openat function.
+   <http://www.google.com/search?q=openat+site:docs.sun.com>
+   First, try to simulate it via open ("/proc/self/fd/FD/FILE").
+   Failing that, simulate it by doing save_cwd/fchdir/open/restore_cwd.
+   If either the save_cwd or the restore_cwd fails (relatively unlikely),
+   then give a diagnostic and exit nonzero.
+   Otherwise, upon failure, set errno and return -1, as openat does.
+   Upon successful completion, return a file descriptor.  */
+int
+openat (int fd, char const *file, int flags, ...)
+{
+  mode_t mode = 0;
+
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+    }
+
+  return openat_permissive (fd, file, flags, mode, NULL);
+}
+
+/* Like openat (FD, FILE, FLAGS, MODE), but if CWD_ERRNO is
+   nonnull, set *CWD_ERRNO to an errno value if unable to save
+   or restore the initial working directory.  This is needed only
+   the first time remove.c's remove_dir opens a command-line
+   directory argument.
+
+   If a previous attempt to restore the current working directory
+   failed, then we must not even try to access a '.'-relative name.
+   It is the caller's responsibility not to call this function
+   in that case.  */
+
+int
+openat_permissive (int fd, char const *file, int flags, mode_t mode,
+                   int *cwd_errno)
+{
+  struct saved_cwd saved_cwd;
+  int saved_errno;
+  int err;
+  bool save_ok;
+
+  if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+    return open (file, flags, mode);
+
+  {
+    char buf[OPENAT_BUFFER_SIZE];
+    char *proc_file = openat_proc_name (buf, fd, file);
+    if (proc_file)
+      {
+        int open_result = open (proc_file, flags, mode);
+        int open_errno = errno;
+        if (proc_file != buf)
+          free (proc_file);
+        /* If the syscall succeeds, or if it fails with an unexpected
+           errno value, then return right away.  Otherwise, fall through
+           and resort to using save_cwd/restore_cwd.  */
+        if (0 <= open_result || ! EXPECTED_ERRNO (open_errno))
+          {
+            errno = open_errno;
+            return open_result;
+          }
+      }
+  }
+
+  save_ok = (save_cwd (&saved_cwd) == 0);
+  if (! save_ok)
+    {
+      if (! cwd_errno)
+        openat_save_fail (errno);
+      *cwd_errno = errno;
+    }
+  if (0 <= fd && fd == saved_cwd.desc)
+    {
+      /* If saving the working directory collides with the user's
+         requested fd, then the user's fd must have been closed to
+         begin with.  */
+      free_cwd (&saved_cwd);
+      errno = EBADF;
+      return -1;
+    }
+
+  err = fchdir (fd);
+  saved_errno = errno;
+
+  if (! err)
+    {
+      err = open (file, flags, mode);
+      saved_errno = errno;
+      if (save_ok && restore_cwd (&saved_cwd) != 0)
+        {
+          if (! cwd_errno)
+            {
+              /* Don't write a message to just-created fd 2.  */
+              saved_errno = errno;
+              if (err == STDERR_FILENO)
+                close (err);
+              openat_restore_fail (saved_errno);
+            }
+          *cwd_errno = errno;
+        }
+    }
+
+  free_cwd (&saved_cwd);
+  errno = saved_errno;
+  return err;
+}
+
+/* Return true if our openat implementation must resort to
+   using save_cwd and restore_cwd.  */
+bool
+openat_needs_fchdir (void)
+{
+  bool needs_fchdir = true;
+  int fd = open ("/", O_SEARCH);
+
+  if (0 <= fd)
+    {
+      char buf[OPENAT_BUFFER_SIZE];
+      char *proc_file = openat_proc_name (buf, fd, ".");
+      if (proc_file)
+        {
+          needs_fchdir = false;
+          if (proc_file != buf)
+            free (proc_file);
+        }
+      close (fd);
+    }
+
+  return needs_fchdir;
+}
+
+#endif /* !HAVE_OPENAT */
diff --git a/lib/openat.h b/lib/openat.h
new file mode 100644 (file)
index 0000000..f148adf
--- /dev/null
@@ -0,0 +1,123 @@
+/* provide a replacement openat function
+   Copyright (C) 2004-2006, 2008-2015 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 Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT
+#define _GL_HEADER_OPENAT
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+
+#if !HAVE_OPENAT
+
+int openat_permissive (int fd, char const *file, int flags, mode_t mode,
+                       int *cwd_errno);
+bool openat_needs_fchdir (void);
+
+#else
+
+# define openat_permissive(Fd, File, Flags, Mode, Cwd_errno) \
+    openat (Fd, File, Flags, Mode)
+# define openat_needs_fchdir() false
+
+#endif
+
+_Noreturn void openat_restore_fail (int);
+_Noreturn void openat_save_fail (int);
+
+/* Using these function names makes application code
+   slightly more readable than it would be with
+   fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW).  */
+
+#if GNULIB_FCHOWNAT
+
+# ifndef FCHOWNAT_INLINE
+#  define FCHOWNAT_INLINE _GL_INLINE
+# endif
+
+FCHOWNAT_INLINE int
+chownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+  return fchownat (fd, file, owner, group, 0);
+}
+
+FCHOWNAT_INLINE int
+lchownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+  return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_FCHMODAT
+
+# ifndef FCHMODAT_INLINE
+#  define FCHMODAT_INLINE _GL_INLINE
+# endif
+
+FCHMODAT_INLINE int
+chmodat (int fd, char const *file, mode_t mode)
+{
+  return fchmodat (fd, file, mode, 0);
+}
+
+FCHMODAT_INLINE int
+lchmodat (int fd, char const *file, mode_t mode)
+{
+  return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_STATAT
+
+# ifndef STATAT_INLINE
+#  define STATAT_INLINE _GL_INLINE
+# endif
+
+STATAT_INLINE int
+statat (int fd, char const *name, struct stat *st)
+{
+  return fstatat (fd, name, st, 0);
+}
+
+STATAT_INLINE int
+lstatat (int fd, char const *name, struct stat *st)
+{
+  return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+/* For now, there are no wrappers named laccessat or leuidaccessat,
+   since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and
+   since access rights on symlinks are of limited utility.  Likewise,
+   wrappers are not provided for accessat or euidaccessat, so as to
+   avoid dragging in -lgen on some platforms.  */
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_HEADER_OPENAT */
index e31da884980a4cfe9b0a76559ca4377131f59b32..9bbcda85a35bdd025311e7250df643897dc0e408 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke opendir, but avoid some glitches.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
index c67f2e5ac431d539b455e2131197581762e78a97..9f53110310b66ae81d707f7ca14c51a99d48fdea 100644 (file)
@@ -1,5 +1,5 @@
 /* Start reading the entries of a directory.
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index 7e4f0eae147435a259d425fb32dbabf257a03e00..bed51e1bd913a6146c34b4115d4da25c9640af4a 100644 (file)
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.  */
+/* A Bison parser, made by GNU Bison 3.0.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-   
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 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/>.  */
 
@@ -26,7 +26,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "3.0.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 
 
 /* Copy the first part of user declarations.  */
-/* Line 371 of yacc.c  */
-#line 1 "./parse-datetime.y"
+#line 1 "./parse-datetime.y" /* yacc.c:339  */
 
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2015 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
@@ -349,14 +348,13 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
 }
 
 
-/* Line 371 of yacc.c  */
-#line 354 "parse-datetime.c"
+#line 352 "parse-datetime.c" /* yacc.c:339  */
 
-# ifndef YY_NULL
+# ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULL nullptr
+#   define YY_NULLPTR nullptr
 #  else
-#   define YY_NULL 0
+#   define YY_NULLPTR 0
 #  endif
 # endif
 
@@ -369,7 +367,7 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
 #endif
 
 
-/* Enabling traces.  */
+/* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
 #endif
@@ -377,33 +375,32 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
 extern int yydebug;
 #endif
 
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     tAGO = 258,
-     tDST = 259,
-     tYEAR_UNIT = 260,
-     tMONTH_UNIT = 261,
-     tHOUR_UNIT = 262,
-     tMINUTE_UNIT = 263,
-     tSEC_UNIT = 264,
-     tDAY_UNIT = 265,
-     tDAY_SHIFT = 266,
-     tDAY = 267,
-     tDAYZONE = 268,
-     tLOCAL_ZONE = 269,
-     tMERIDIAN = 270,
-     tMONTH = 271,
-     tORDINAL = 272,
-     tZONE = 273,
-     tSNUMBER = 274,
-     tUNUMBER = 275,
-     tSDECIMAL_NUMBER = 276,
-     tUDECIMAL_NUMBER = 277
-   };
+  enum yytokentype
+  {
+    tAGO = 258,
+    tDST = 259,
+    tYEAR_UNIT = 260,
+    tMONTH_UNIT = 261,
+    tHOUR_UNIT = 262,
+    tMINUTE_UNIT = 263,
+    tSEC_UNIT = 264,
+    tDAY_UNIT = 265,
+    tDAY_SHIFT = 266,
+    tDAY = 267,
+    tDAYZONE = 268,
+    tLOCAL_ZONE = 269,
+    tMERIDIAN = 270,
+    tMONTH = 271,
+    tORDINAL = 272,
+    tZONE = 273,
+    tSNUMBER = 274,
+    tUNUMBER = 275,
+    tSDECIMAL_NUMBER = 276,
+    tUDECIMAL_NUMBER = 277
+  };
 #endif
 /* Tokens.  */
 #define tAGO 258
@@ -427,49 +424,33 @@ extern int yydebug;
 #define tSDECIMAL_NUMBER 276
 #define tUDECIMAL_NUMBER 277
 
-
-
+/* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
 {
-/* Line 387 of yacc.c  */
-#line 297 "./parse-datetime.y"
+#line 297 "./parse-datetime.y" /* yacc.c:355  */
 
   long int intval;
   textint textintval;
   struct timespec timespec;
   relative_time rel;
 
-
-/* Line 387 of yacc.c  */
-#line 446 "parse-datetime.c"
-} YYSTYPE;
+#line 440 "parse-datetime.c" /* yacc.c:355  */
+};
 # define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 #endif
 
 
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
 int yyparse (parser_control *pc);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
 
 
 
 /* Copy the second part of user declarations.  */
 
-/* Line 390 of yacc.c  */
-#line 473 "parse-datetime.c"
+#line 454 "parse-datetime.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -483,11 +464,8 @@ typedef unsigned char yytype_uint8;
 
 #ifdef YYTYPE_INT8
 typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
 #else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
 #endif
 
 #ifdef YYTYPE_UINT16
@@ -507,8 +485,7 @@ typedef short int yytype_int16;
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined size_t
 #  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
@@ -530,6 +507,33 @@ typedef short int yytype_int16;
 # endif
 #endif
 
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
 # define YYUSE(E) ((void) (E))
@@ -537,24 +541,26 @@ typedef short int yytype_int16;
 # define YYUSE(E) /* empty */
 #endif
 
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
 #else
-static int
-YYID (yyi)
-    int yyi;
+# define YY_INITIAL_VALUE(Value) Value
 #endif
-{
-  return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
 #endif
 
+
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
@@ -572,8 +578,7 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
@@ -585,8 +590,8 @@ YYID (yyi)
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
     /* The OS might guarantee only one guard page at the bottom of the stack,
        and a page size can be as small as 4096 bytes.  So we cannot safely
@@ -602,7 +607,7 @@ YYID (yyi)
 #  endif
 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
-            && (defined YYFREE || defined free)))
+             && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #   ifndef EXIT_SUCCESS
 #    define EXIT_SUCCESS 0
@@ -610,15 +615,13 @@ YYID (yyi)
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined malloc && ! defined EXIT_SUCCESS
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
+#   if ! defined free && ! defined EXIT_SUCCESS
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
@@ -628,7 +631,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
-        || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -653,16 +656,16 @@ union yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \
-    do                                                                 \
-      {                                                                        \
-       YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-       Stack = &yyptr->Stack_alloc;                                    \
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-       yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                        \
-    while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
 
 #endif
 
@@ -681,7 +684,7 @@ union yyalloc
           for (yyi = 0; yyi < (Count); yyi++)   \
             (Dst)[yyi] = (Src)[yyi];            \
         }                                       \
-      while (YYID (0))
+      while (0)
 #  endif
 # endif
 #endif /* !YYCOPY_NEEDED */
@@ -697,17 +700,19 @@ union yyalloc
 #define YYNNTS  26
 /* YYNRULES -- Number of rules.  */
 #define YYNRULES  91
-/* YYNRULES -- Number of states.  */
+/* YYNSTATES -- Number of states.  */
 #define YYNSTATES  114
 
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
 #define YYMAXUTOK   277
 
-#define YYTRANSLATE(YYX)                                               \
+#define YYTRANSLATE(YYX)                                                \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -741,54 +746,7 @@ static const yytype_uint8 yytranslate[] =
 };
 
 #if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint8 yyprhs[] =
-{
-       0,     0,     3,     5,     7,    10,    11,    14,    16,    18,
-      20,    22,    24,    26,    28,    30,    32,    34,    38,    41,
-      46,    53,    55,    58,    63,    70,    71,    73,    76,    78,
-      81,    83,    85,    88,    91,    95,    97,   100,   102,   105,
-     108,   111,   115,   121,   125,   129,   132,   137,   140,   144,
-     146,   150,   153,   155,   157,   160,   163,   165,   168,   171,
-     173,   176,   179,   181,   184,   187,   189,   192,   195,   197,
-     200,   203,   206,   209,   211,   213,   216,   219,   222,   225,
-     228,   231,   233,   235,   237,   239,   241,   243,   245,   247,
-     250,   251
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int8 yyrhs[] =
-{
-      29,     0,    -1,    30,    -1,    31,    -1,    23,    48,    -1,
-      -1,    31,    32,    -1,    33,    -1,    35,    -1,    39,    -1,
-      40,    -1,    42,    -1,    41,    -1,    44,    -1,    51,    -1,
-      52,    -1,    34,    -1,    43,    24,    36,    -1,    20,    15,
-      -1,    20,    25,    20,    15,    -1,    20,    25,    20,    25,
-      50,    15,    -1,    36,    -1,    20,    38,    -1,    20,    25,
-      20,    37,    -1,    20,    25,    20,    25,    50,    37,    -1,
-      -1,    38,    -1,    19,    53,    -1,    14,    -1,    14,     4,
-      -1,    18,    -1,    24,    -1,    18,    46,    -1,    24,    46,
-      -1,    18,    19,    53,    -1,    13,    -1,    18,     4,    -1,
-      12,    -1,    12,    26,    -1,    17,    12,    -1,    20,    12,
-      -1,    20,    27,    20,    -1,    20,    27,    20,    27,    20,
-      -1,    20,    16,    19,    -1,    16,    19,    19,    -1,    16,
-      20,    -1,    16,    20,    26,    20,    -1,    20,    16,    -1,
-      20,    16,    20,    -1,    43,    -1,    20,    19,    19,    -1,
-      45,     3,    -1,    45,    -1,    47,    -1,    17,     5,    -1,
-      20,     5,    -1,     5,    -1,    17,     6,    -1,    20,     6,
-      -1,     6,    -1,    17,    10,    -1,    20,    10,    -1,    10,
-      -1,    17,     7,    -1,    20,     7,    -1,     7,    -1,    17,
-       8,    -1,    20,     8,    -1,     8,    -1,    17,     9,    -1,
-      20,     9,    -1,    21,     9,    -1,    22,     9,    -1,     9,
-      -1,    46,    -1,    19,     5,    -1,    19,     6,    -1,    19,
-      10,    -1,    19,     7,    -1,    19,     8,    -1,    19,     9,
-      -1,    11,    -1,    49,    -1,    50,    -1,    21,    -1,    19,
-      -1,    22,    -1,    20,    -1,    20,    -1,    20,    46,    -1,
-      -1,    25,    20,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
        0,   324,   324,   325,   329,   336,   338,   342,   344,   346,
@@ -818,13 +776,13 @@ static const char *const yytname[] =
   "iso_8601_time", "o_zone_offset", "zone_offset", "local_zone", "zone",
   "day", "date", "iso_8601_date", "rel", "relunit", "relunit_snumber",
   "dayshift", "seconds", "signed_seconds", "unsigned_seconds", "number",
-  "hybrid", "o_colon_minutes", YY_NULL
+  "hybrid", "o_colon_minutes", YY_NULLPTR
 };
 #endif
 
 # ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
@@ -833,66 +791,18 @@ static const yytype_uint16 yytoknum[] =
 };
 # endif
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    28,    29,    29,    30,    31,    31,    32,    32,    32,
-      32,    32,    32,    32,    32,    32,    33,    34,    35,    35,
-      35,    35,    36,    36,    36,    37,    37,    38,    39,    39,
-      40,    40,    40,    40,    40,    40,    40,    41,    41,    41,
-      41,    42,    42,    42,    42,    42,    42,    42,    42,    42,
-      43,    44,    44,    44,    45,    45,    45,    45,    45,    45,
-      45,    45,    45,    45,    45,    45,    45,    45,    45,    45,
-      45,    45,    45,    45,    45,    46,    46,    46,    46,    46,
-      46,    47,    48,    48,    49,    49,    50,    50,    51,    52,
-      53,    53
-};
+#define YYPACT_NINF -93
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     1,     1,     2,     0,     2,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     3,     2,     4,
-       6,     1,     2,     4,     6,     0,     1,     2,     1,     2,
-       1,     1,     2,     2,     3,     1,     2,     1,     2,     2,
-       2,     3,     5,     3,     3,     2,     4,     2,     3,     1,
-       3,     2,     1,     1,     2,     2,     1,     2,     2,     1,
-       2,     2,     1,     2,     2,     1,     2,     2,     1,     2,
-       2,     2,     2,     1,     1,     2,     2,     2,     2,     2,
-       2,     1,     1,     1,     1,     1,     1,     1,     1,     2,
-       0,     2
-};
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-93)))
 
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       5,     0,     0,     2,     3,    85,    87,    84,    86,     4,
-      82,    83,     1,    56,    59,    65,    68,    73,    62,    81,
-      37,    35,    28,     0,     0,    30,     0,    88,     0,     0,
-      31,     6,     7,    16,     8,    21,     9,    10,    12,    11,
-      49,    13,    52,    74,    53,    14,    15,    38,    29,     0,
-      45,    54,    57,    63,    66,    69,    60,    39,    36,    90,
-      32,    75,    76,    78,    79,    80,    77,    55,    58,    64,
-      67,    70,    61,    40,    18,    47,    90,     0,     0,    22,
-      89,    71,    72,    33,     0,    51,    44,     0,     0,    34,
-      43,    48,    50,    27,    25,    41,     0,    17,    46,    91,
-      19,    90,     0,    23,    26,     0,     0,    25,    42,    25,
-      20,    24,     0,    25
-};
+#define YYTABLE_NINF -1
 
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
-{
-      -1,     2,     3,     4,    31,    32,    33,    34,    35,   103,
-     104,    36,    37,    38,    39,    40,    41,    42,    43,    44,
-       9,    10,    11,    45,    46,    93
-};
+#define yytable_value_is_error(Yytable_value) \
+  0
 
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -93
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
 static const yytype_int8 yypact[] =
 {
       38,    27,    77,   -93,    46,   -93,   -93,   -93,   -93,   -93,
@@ -909,7 +819,26 @@ static const yytype_int8 yypact[] =
      -93,   -93,    69,    91
 };
 
-/* YYPGOTO[NTERM-NUM].  */
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       5,     0,     0,     2,     3,    85,    87,    84,    86,     4,
+      82,    83,     1,    56,    59,    65,    68,    73,    62,    81,
+      37,    35,    28,     0,     0,    30,     0,    88,     0,     0,
+      31,     6,     7,    16,     8,    21,     9,    10,    12,    11,
+      49,    13,    52,    74,    53,    14,    15,    38,    29,     0,
+      45,    54,    57,    63,    66,    69,    60,    39,    36,    90,
+      32,    75,    76,    78,    79,    80,    77,    55,    58,    64,
+      67,    70,    61,    40,    18,    47,    90,     0,     0,    22,
+      89,    71,    72,    33,     0,    51,    44,     0,     0,    34,
+      43,    48,    50,    27,    25,    41,     0,    17,    46,    91,
+      19,    90,     0,    23,    26,     0,     0,    25,    42,    25,
+      20,    24,     0,    25
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
      -93,   -93,   -93,   -93,   -93,   -93,   -93,   -93,    20,   -68,
@@ -917,10 +846,17 @@ static const yytype_int8 yypgoto[] =
      -93,   -93,   -92,   -93,   -93,    43
 };
 
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -1
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     2,     3,     4,    31,    32,    33,    34,    35,   103,
+     104,    36,    37,    38,    39,    40,    41,    42,    43,    44,
+       9,    10,    11,    45,    46,    93
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_uint8 yytable[] =
 {
       79,    67,    68,    69,    70,    71,    72,    58,    73,   100,
@@ -937,12 +873,6 @@ static const yytype_uint8 yytable[] =
      101,     0,    88
 };
 
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-93)))
-
-#define yytable_value_is_error(Yytable_value) \
-  YYID (0)
-
 static const yytype_int8 yycheck[] =
 {
       27,     5,     6,     7,     8,     9,    10,     4,    12,    15,
@@ -959,8 +889,8 @@ static const yytype_int8 yycheck[] =
       19,    -1,    25
 };
 
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
        0,    23,    29,    30,    31,    19,    20,    21,    22,    48,
@@ -977,30 +907,46 @@ static const yytype_uint8 yystos[] =
       15,    37,    25,    50
 };
 
-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin      (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF          0
-
-#define YYACCEPT       goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
-
-#define YYFAIL         goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    28,    29,    29,    30,    31,    31,    32,    32,    32,
+      32,    32,    32,    32,    32,    32,    33,    34,    35,    35,
+      35,    35,    36,    36,    36,    37,    37,    38,    39,    39,
+      40,    40,    40,    40,    40,    40,    40,    41,    41,    41,
+      41,    42,    42,    42,    42,    42,    42,    42,    42,    42,
+      43,    44,    44,    44,    45,    45,    45,    45,    45,    45,
+      45,    45,    45,    45,    45,    45,    45,    45,    45,    45,
+      45,    45,    45,    45,    45,    46,    46,    46,    46,    46,
+      46,    47,    48,    48,    49,    49,    50,    50,    51,    52,
+      53,    53
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     1,     1,     2,     0,     2,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     3,     2,     4,
+       6,     1,     2,     4,     6,     0,     1,     2,     1,     2,
+       1,     1,     2,     2,     3,     1,     2,     1,     2,     2,
+       2,     3,     5,     3,     3,     2,     4,     2,     3,     1,
+       3,     2,     1,     1,     2,     2,     1,     2,     2,     1,
+       2,     2,     1,     2,     2,     1,     2,     2,     1,     2,
+       2,     2,     2,     1,     1,     2,     2,     2,     2,     2,
+       2,     1,     1,     1,     1,     1,     1,     1,     1,     2,
+       0,     2
+};
+
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -1017,27 +963,15 @@ do                                                              \
   else                                                          \
     {                                                           \
       yyerror (pc, YY_("syntax error: cannot back up")); \
-      YYERROR;                                                 \
-    }                                                          \
-while (YYID (0))
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
 
 /* Error token number */
-#define YYTERROR       1
-#define YYERRCODE      256
+#define YYTERROR        1
+#define YYERRCODE       256
 
 
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, pc)
-#endif
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -1047,58 +981,47 @@ while (YYID (0))
 #  define YYFPRINTF fprintf
 # endif
 
-# define YYDPRINTF(Args)                       \
-do {                                           \
-  if (yydebug)                                 \
-    YYFPRINTF Args;                            \
-} while (YYID (0))
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                   \
-do {                                                                     \
-  if (yydebug)                                                           \
-    {                                                                    \
-      YYFPRINTF (stderr, "%s ", Title);                                          \
-      yy_symbol_print (stderr,                                           \
-                 Type, Value, pc); \
-      YYFPRINTF (stderr, "\n");                                                  \
-    }                                                                    \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value, pc); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    parser_control *pc;
-#endif
 {
   FILE *yyo = yyoutput;
   YYUSE (yyo);
+  YYUSE (pc);
   if (!yyvaluep)
     return;
-  YYUSE (pc);
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
 # endif
-  switch (yytype)
-    {
-      default:
-        break;
-    }
+  YYUSE (yytype);
 }
 
 
@@ -1106,23 +1029,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, pc)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    parser_control *pc;
-#endif
 {
-  if (yytype < YYNTOKENS)
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+  YYFPRINTF (yyoutput, "%s %s (",
+             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
   yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc);
   YYFPRINTF (yyoutput, ")");
@@ -1133,16 +1044,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, pc)
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
 {
   YYFPRINTF (stderr, "Stack now");
   for (; yybottom <= yytop; yybottom++)
@@ -1153,50 +1056,42 @@ yy_stack_print (yybottom, yytop)
   YYFPRINTF (stderr, "\n");
 }
 
-# define YY_STACK_PRINT(Bottom, Top)                           \
-do {                                                           \
-  if (yydebug)                                                 \
-    yy_stack_print ((Bottom), (Top));                          \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
 
 
 /*------------------------------------------------.
 | Report that the YYRULE is going to be reduced.  |
 `------------------------------------------------*/
 
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, parser_control *pc)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, pc)
-    YYSTYPE *yyvsp;
-    int yyrule;
-    parser_control *pc;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_control *pc)
 {
+  unsigned long int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
-  unsigned long int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-            yyrule - 1, yylno);
+             yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-                      &(yyvsp[(yyi + 1) - (yynrhs)])
-                                      , pc);
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                                              , pc);
       YYFPRINTF (stderr, "\n");
     }
 }
 
-# define YY_REDUCE_PRINT(Rule)         \
-do {                                   \
-  if (yydebug)                         \
-    yy_reduce_print (yyvsp, Rule, pc); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule, pc); \
+} while (0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -1210,7 +1105,7 @@ int yydebug;
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef        YYINITDEPTH
+#ifndef YYINITDEPTH
 # define YYINITDEPTH 200
 #endif
 
@@ -1233,15 +1128,8 @@ int yydebug;
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static YYSIZE_T
 yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
 {
   YYSIZE_T yylen;
   for (yylen = 0; yystr[yylen]; yylen++)
@@ -1257,16 +1145,8 @@ yystrlen (yystr)
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static char *
 yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
 {
   char *yyd = yydest;
   const char *yys = yysrc;
@@ -1296,27 +1176,27 @@ yytnamerr (char *yyres, const char *yystr)
       char const *yyp = yystr;
 
       for (;;)
-       switch (*++yyp)
-         {
-         case '\'':
-         case ',':
-           goto do_not_strip_quotes;
-
-         case '\\':
-           if (*++yyp != '\\')
-             goto do_not_strip_quotes;
-           /* Fall through.  */
-         default:
-           if (yyres)
-             yyres[yyn] = *yyp;
-           yyn++;
-           break;
-
-         case '"':
-           if (yyres)
-             yyres[yyn] = '\0';
-           return yyn;
-         }
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
     do_not_strip_quotes: ;
     }
 
@@ -1339,11 +1219,11 @@ static int
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = YY_NULL;
+  const char *yyformat = YY_NULLPTR;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -1351,10 +1231,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
   int yycount = 0;
 
   /* There are many possibilities here to consider:
-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
-       for details.  YYERROR is fine as it does not invoke this
-       function.
      - If this state is a consistent state with a default action, then
        the only way this function was invoked is if the default action
        is an error action.  In that case, don't check for expected
@@ -1404,7 +1280,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                   }
                 yyarg[yycount++] = yytname[yyx];
                 {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
                   if (! (yysize <= yysize1
                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                     return 2;
@@ -1471,33 +1347,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 static void
 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_control *pc)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, pc)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-    parser_control *pc;
-#endif
 {
   YYUSE (yyvaluep);
   YYUSE (pc);
-
   if (!yymsg)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  switch (yytype)
-    {
-
-      default:
-        break;
-    }
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -1507,56 +1368,18 @@ yydestruct (yymsg, yytype, yyvaluep, pc)
 | yyparse.  |
 `----------*/
 
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (parser_control *pc)
-#else
-int
-yyparse (pc)
-    parser_control *pc;
-#endif
-#endif
 {
 /* The lookahead symbol.  */
 int yychar;
 
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma ("GCC diagnostic pop")
-#else
+/* The semantic value of the lookahead symbol.  */
 /* Default value used for initialization, for pacifying older GCCs
    or non-GCC compilers.  */
-static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
 
     /* Number of syntax errors so far.  */
     int yynerrs;
@@ -1566,8 +1389,8 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
     int yyerrstatus;
 
     /* The stacks and their tools:
-       `yyss': related to states.
-       `yyvs': related to semantic values.
+       'yyss': related to states.
+       'yyvs': related to semantic values.
 
        Refer to the stacks through separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
@@ -1635,23 +1458,23 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
 
 #ifdef yyoverflow
       {
-       /* Give user a chance to reallocate the stack.  Use copies of
-          these so that the &'s don't force the real ones into
-          memory.  */
-       YYSTYPE *yyvs1 = yyvs;
-       yytype_int16 *yyss1 = yyss;
-
-       /* Each stack pointer address is followed by the size of the
-          data in use in that stack, in bytes.  This used to be a
-          conditional around just the two extra args, but that might
-          be undefined if yyoverflow is a macro.  */
-       yyoverflow (YY_("memory exhausted"),
-                   &yyss1, yysize * sizeof (*yyssp),
-                   &yyvs1, yysize * sizeof (*yyvsp),
-                   &yystacksize);
-
-       yyss = yyss1;
-       yyvs = yyvs1;
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * sizeof (*yyssp),
+                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yystacksize);
+
+        yyss = yyss1;
+        yyvs = yyvs1;
       }
 #else /* no yyoverflow */
 # ifndef YYSTACK_RELOCATE
@@ -1659,22 +1482,22 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
 # else
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-       goto yyexhaustedlab;
+        goto yyexhaustedlab;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
-       yystacksize = YYMAXDEPTH;
+        yystacksize = YYMAXDEPTH;
 
       {
-       yytype_int16 *yyss1 = yyss;
-       union yyalloc *yyptr =
-         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-       if (! yyptr)
-         goto yyexhaustedlab;
-       YYSTACK_RELOCATE (yyss_alloc, yyss);
-       YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-       if (yyss1 != yyssa)
-         YYSTACK_FREE (yyss1);
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
       }
 # endif
 #endif /* no yyoverflow */
@@ -1683,10 +1506,10 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
       yyvsp = yyvs + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                 (unsigned long int) yystacksize));
+                  (unsigned long int) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
-       YYABORT;
+        YYABORT;
     }
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1715,7 +1538,7 @@ yybackup:
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
+      yychar = yylex (&yylval, pc);
     }
 
   if (yychar <= YYEOF)
@@ -1780,7 +1603,7 @@ yyreduce:
   yylen = yyr2[yyn];
 
   /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
+     '$$ = $1'.
 
      Otherwise, the following line sets YYVAL to garbage.
      This behavior is undocumented and Bison
@@ -1794,541 +1617,540 @@ yyreduce:
   switch (yyn)
     {
         case 4:
-/* Line 1792 of yacc.c  */
-#line 330 "./parse-datetime.y"
+#line 330 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->seconds = (yyvsp[(2) - (2)].timespec);
+        pc->seconds = (yyvsp[0].timespec);
         pc->timespec_seen = true;
       }
+#line 1626 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 7:
-/* Line 1792 of yacc.c  */
-#line 343 "./parse-datetime.y"
+#line 343 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->times_seen++; pc->dates_seen++; }
+#line 1632 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 8:
-/* Line 1792 of yacc.c  */
-#line 345 "./parse-datetime.y"
+#line 345 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->times_seen++; }
+#line 1638 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 9:
-/* Line 1792 of yacc.c  */
-#line 347 "./parse-datetime.y"
+#line 347 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->local_zones_seen++; }
+#line 1644 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 10:
-/* Line 1792 of yacc.c  */
-#line 349 "./parse-datetime.y"
+#line 349 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->zones_seen++; }
+#line 1650 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 11:
-/* Line 1792 of yacc.c  */
-#line 351 "./parse-datetime.y"
+#line 351 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->dates_seen++; }
+#line 1656 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 12:
-/* Line 1792 of yacc.c  */
-#line 353 "./parse-datetime.y"
+#line 353 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->days_seen++; }
+#line 1662 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 18:
-/* Line 1792 of yacc.c  */
-#line 369 "./parse-datetime.y"
+#line 369 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
-        pc->meridian = (yyvsp[(2) - (2)].intval);
+        set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
+        pc->meridian = (yyvsp[0].intval);
       }
+#line 1671 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 19:
-/* Line 1792 of yacc.c  */
-#line 374 "./parse-datetime.y"
+#line 374 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
-        pc->meridian = (yyvsp[(4) - (4)].intval);
+        set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
+        pc->meridian = (yyvsp[0].intval);
       }
+#line 1680 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 20:
-/* Line 1792 of yacc.c  */
-#line 379 "./parse-datetime.y"
+#line 379 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
-        pc->meridian = (yyvsp[(6) - (6)].intval);
+        set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
+        pc->meridian = (yyvsp[0].intval);
       }
+#line 1689 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 22:
-/* Line 1792 of yacc.c  */
-#line 388 "./parse-datetime.y"
+#line 388 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
+        set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
         pc->meridian = MER24;
       }
+#line 1698 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 23:
-/* Line 1792 of yacc.c  */
-#line 393 "./parse-datetime.y"
+#line 393 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
+        set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
         pc->meridian = MER24;
       }
+#line 1707 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 24:
-/* Line 1792 of yacc.c  */
-#line 398 "./parse-datetime.y"
+#line 398 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
+        set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
         pc->meridian = MER24;
       }
+#line 1716 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 27:
-/* Line 1792 of yacc.c  */
-#line 411 "./parse-datetime.y"
+#line 411 "./parse-datetime.y" /* yacc.c:1646  */
     {
         pc->zones_seen++;
-        pc->time_zone = time_zone_hhmm (pc, (yyvsp[(1) - (2)].textintval), (yyvsp[(2) - (2)].intval));
+        pc->time_zone = time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval));
       }
+#line 1725 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 28:
-/* Line 1792 of yacc.c  */
-#line 419 "./parse-datetime.y"
+#line 419 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->local_isdst = (yyvsp[(1) - (1)].intval);
-        pc->dsts_seen += (0 < (yyvsp[(1) - (1)].intval));
+        pc->local_isdst = (yyvsp[0].intval);
+        pc->dsts_seen += (0 < (yyvsp[0].intval));
       }
+#line 1734 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 29:
-/* Line 1792 of yacc.c  */
-#line 424 "./parse-datetime.y"
+#line 424 "./parse-datetime.y" /* yacc.c:1646  */
     {
         pc->local_isdst = 1;
-        pc->dsts_seen += (0 < (yyvsp[(1) - (2)].intval)) + 1;
+        pc->dsts_seen += (0 < (yyvsp[-1].intval)) + 1;
       }
+#line 1743 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 30:
-/* Line 1792 of yacc.c  */
-#line 434 "./parse-datetime.y"
-    { pc->time_zone = (yyvsp[(1) - (1)].intval); }
+#line 434 "./parse-datetime.y" /* yacc.c:1646  */
+    { pc->time_zone = (yyvsp[0].intval); }
+#line 1749 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 31:
-/* Line 1792 of yacc.c  */
-#line 436 "./parse-datetime.y"
+#line 436 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->time_zone = HOUR(7); }
+#line 1755 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 32:
-/* Line 1792 of yacc.c  */
-#line 438 "./parse-datetime.y"
-    { pc->time_zone = (yyvsp[(1) - (2)].intval);
-        apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+#line 438 "./parse-datetime.y" /* yacc.c:1646  */
+    { pc->time_zone = (yyvsp[-1].intval);
+        apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1762 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 33:
-/* Line 1792 of yacc.c  */
-#line 441 "./parse-datetime.y"
+#line 441 "./parse-datetime.y" /* yacc.c:1646  */
     { pc->time_zone = HOUR(7);
-        apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+        apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1769 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 34:
-/* Line 1792 of yacc.c  */
-#line 444 "./parse-datetime.y"
-    { pc->time_zone = (yyvsp[(1) - (3)].intval) + time_zone_hhmm (pc, (yyvsp[(2) - (3)].textintval), (yyvsp[(3) - (3)].intval)); }
+#line 444 "./parse-datetime.y" /* yacc.c:1646  */
+    { pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval)); }
+#line 1775 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 35:
-/* Line 1792 of yacc.c  */
-#line 446 "./parse-datetime.y"
-    { pc->time_zone = (yyvsp[(1) - (1)].intval) + 60; }
+#line 446 "./parse-datetime.y" /* yacc.c:1646  */
+    { pc->time_zone = (yyvsp[0].intval) + 60; }
+#line 1781 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 36:
-/* Line 1792 of yacc.c  */
-#line 448 "./parse-datetime.y"
-    { pc->time_zone = (yyvsp[(1) - (2)].intval) + 60; }
+#line 448 "./parse-datetime.y" /* yacc.c:1646  */
+    { pc->time_zone = (yyvsp[-1].intval) + 60; }
+#line 1787 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 37:
-/* Line 1792 of yacc.c  */
-#line 453 "./parse-datetime.y"
+#line 453 "./parse-datetime.y" /* yacc.c:1646  */
     {
         pc->day_ordinal = 0;
-        pc->day_number = (yyvsp[(1) - (1)].intval);
+        pc->day_number = (yyvsp[0].intval);
       }
+#line 1796 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 38:
-/* Line 1792 of yacc.c  */
-#line 458 "./parse-datetime.y"
+#line 458 "./parse-datetime.y" /* yacc.c:1646  */
     {
         pc->day_ordinal = 0;
-        pc->day_number = (yyvsp[(1) - (2)].intval);
+        pc->day_number = (yyvsp[-1].intval);
       }
+#line 1805 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 39:
-/* Line 1792 of yacc.c  */
-#line 463 "./parse-datetime.y"
+#line 463 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->day_ordinal = (yyvsp[(1) - (2)].intval);
-        pc->day_number = (yyvsp[(2) - (2)].intval);
+        pc->day_ordinal = (yyvsp[-1].intval);
+        pc->day_number = (yyvsp[0].intval);
       }
+#line 1814 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 40:
-/* Line 1792 of yacc.c  */
-#line 468 "./parse-datetime.y"
+#line 468 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->day_ordinal = (yyvsp[(1) - (2)].textintval).value;
-        pc->day_number = (yyvsp[(2) - (2)].intval);
+        pc->day_ordinal = (yyvsp[-1].textintval).value;
+        pc->day_number = (yyvsp[0].intval);
       }
+#line 1823 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 41:
-/* Line 1792 of yacc.c  */
-#line 476 "./parse-datetime.y"
+#line 476 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->month = (yyvsp[(1) - (3)].textintval).value;
-        pc->day = (yyvsp[(3) - (3)].textintval).value;
+        pc->month = (yyvsp[-2].textintval).value;
+        pc->day = (yyvsp[0].textintval).value;
       }
+#line 1832 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 42:
-/* Line 1792 of yacc.c  */
-#line 481 "./parse-datetime.y"
+#line 481 "./parse-datetime.y" /* yacc.c:1646  */
     {
         /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
            otherwise as MM/DD/YY.
            The goal in recognizing YYYY/MM/DD is solely to support legacy
            machine-generated dates like those in an RCS log listing.  If
            you want portability, use the ISO 8601 format.  */
-        if (4 <= (yyvsp[(1) - (5)].textintval).digits)
+        if (4 <= (yyvsp[-4].textintval).digits)
           {
-            pc->year = (yyvsp[(1) - (5)].textintval);
-            pc->month = (yyvsp[(3) - (5)].textintval).value;
-            pc->day = (yyvsp[(5) - (5)].textintval).value;
+            pc->year = (yyvsp[-4].textintval);
+            pc->month = (yyvsp[-2].textintval).value;
+            pc->day = (yyvsp[0].textintval).value;
           }
         else
           {
-            pc->month = (yyvsp[(1) - (5)].textintval).value;
-            pc->day = (yyvsp[(3) - (5)].textintval).value;
-            pc->year = (yyvsp[(5) - (5)].textintval);
+            pc->month = (yyvsp[-4].textintval).value;
+            pc->day = (yyvsp[-2].textintval).value;
+            pc->year = (yyvsp[0].textintval);
           }
       }
+#line 1856 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 43:
-/* Line 1792 of yacc.c  */
-#line 501 "./parse-datetime.y"
+#line 501 "./parse-datetime.y" /* yacc.c:1646  */
     {
         /* e.g. 17-JUN-1992.  */
-        pc->day = (yyvsp[(1) - (3)].textintval).value;
-        pc->month = (yyvsp[(2) - (3)].intval);
-        pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
-        pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+        pc->day = (yyvsp[-2].textintval).value;
+        pc->month = (yyvsp[-1].intval);
+        pc->year.value = -(yyvsp[0].textintval).value;
+        pc->year.digits = (yyvsp[0].textintval).digits;
       }
+#line 1868 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 44:
-/* Line 1792 of yacc.c  */
-#line 509 "./parse-datetime.y"
+#line 509 "./parse-datetime.y" /* yacc.c:1646  */
     {
         /* e.g. JUN-17-1992.  */
-        pc->month = (yyvsp[(1) - (3)].intval);
-        pc->day = -(yyvsp[(2) - (3)].textintval).value;
-        pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
-        pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+        pc->month = (yyvsp[-2].intval);
+        pc->day = -(yyvsp[-1].textintval).value;
+        pc->year.value = -(yyvsp[0].textintval).value;
+        pc->year.digits = (yyvsp[0].textintval).digits;
       }
+#line 1880 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 45:
-/* Line 1792 of yacc.c  */
-#line 517 "./parse-datetime.y"
+#line 517 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->month = (yyvsp[(1) - (2)].intval);
-        pc->day = (yyvsp[(2) - (2)].textintval).value;
+        pc->month = (yyvsp[-1].intval);
+        pc->day = (yyvsp[0].textintval).value;
       }
+#line 1889 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 46:
-/* Line 1792 of yacc.c  */
-#line 522 "./parse-datetime.y"
+#line 522 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->month = (yyvsp[(1) - (4)].intval);
-        pc->day = (yyvsp[(2) - (4)].textintval).value;
-        pc->year = (yyvsp[(4) - (4)].textintval);
+        pc->month = (yyvsp[-3].intval);
+        pc->day = (yyvsp[-2].textintval).value;
+        pc->year = (yyvsp[0].textintval);
       }
+#line 1899 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 47:
-/* Line 1792 of yacc.c  */
-#line 528 "./parse-datetime.y"
+#line 528 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->day = (yyvsp[(1) - (2)].textintval).value;
-        pc->month = (yyvsp[(2) - (2)].intval);
+        pc->day = (yyvsp[-1].textintval).value;
+        pc->month = (yyvsp[0].intval);
       }
+#line 1908 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 48:
-/* Line 1792 of yacc.c  */
-#line 533 "./parse-datetime.y"
+#line 533 "./parse-datetime.y" /* yacc.c:1646  */
     {
-        pc->day = (yyvsp[(1) - (3)].textintval).value;
-        pc->month = (yyvsp[(2) - (3)].intval);
-        pc->year = (yyvsp[(3) - (3)].textintval);
+        pc->day = (yyvsp[-2].textintval).value;
+        pc->month = (yyvsp[-1].intval);
+        pc->year = (yyvsp[0].textintval);
       }
+#line 1918 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 50:
-/* Line 1792 of yacc.c  */
-#line 543 "./parse-datetime.y"
+#line 543 "./parse-datetime.y" /* yacc.c:1646  */
     {
         /* ISO 8601 format.  YYYY-MM-DD.  */
-        pc->year = (yyvsp[(1) - (3)].textintval);
-        pc->month = -(yyvsp[(2) - (3)].textintval).value;
-        pc->day = -(yyvsp[(3) - (3)].textintval).value;
+        pc->year = (yyvsp[-2].textintval);
+        pc->month = -(yyvsp[-1].textintval).value;
+        pc->day = -(yyvsp[0].textintval).value;
       }
+#line 1929 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 51:
-/* Line 1792 of yacc.c  */
-#line 553 "./parse-datetime.y"
-    { apply_relative_time (pc, (yyvsp[(1) - (2)].rel), (yyvsp[(2) - (2)].intval)); }
+#line 553 "./parse-datetime.y" /* yacc.c:1646  */
+    { apply_relative_time (pc, (yyvsp[-1].rel), (yyvsp[0].intval)); }
+#line 1935 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 52:
-/* Line 1792 of yacc.c  */
-#line 555 "./parse-datetime.y"
-    { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 555 "./parse-datetime.y" /* yacc.c:1646  */
+    { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1941 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 53:
-/* Line 1792 of yacc.c  */
-#line 557 "./parse-datetime.y"
-    { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 557 "./parse-datetime.y" /* yacc.c:1646  */
+    { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1947 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 54:
-/* Line 1792 of yacc.c  */
-#line 562 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].intval); }
+#line 562 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); }
+#line 1953 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 55:
-/* Line 1792 of yacc.c  */
-#line 564 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 564 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 1959 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 56:
-/* Line 1792 of yacc.c  */
-#line 566 "./parse-datetime.y"
+#line 566 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; }
+#line 1965 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 57:
-/* Line 1792 of yacc.c  */
-#line 568 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].intval); }
+#line 568 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); }
+#line 1971 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 58:
-/* Line 1792 of yacc.c  */
-#line 570 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 570 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 1977 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 59:
-/* Line 1792 of yacc.c  */
-#line 572 "./parse-datetime.y"
+#line 572 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; }
+#line 1983 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 60:
-/* Line 1792 of yacc.c  */
-#line 574 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].intval) * (yyvsp[(2) - (2)].intval); }
+#line 574 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * (yyvsp[0].intval); }
+#line 1989 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 61:
-/* Line 1792 of yacc.c  */
-#line 576 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 576 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 1995 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 62:
-/* Line 1792 of yacc.c  */
-#line 578 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 578 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2001 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 63:
-/* Line 1792 of yacc.c  */
-#line 580 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].intval); }
+#line 580 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); }
+#line 2007 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 64:
-/* Line 1792 of yacc.c  */
-#line 582 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 582 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2013 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 65:
-/* Line 1792 of yacc.c  */
-#line 584 "./parse-datetime.y"
+#line 584 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; }
+#line 2019 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 66:
-/* Line 1792 of yacc.c  */
-#line 586 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].intval); }
+#line 586 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); }
+#line 2025 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 67:
-/* Line 1792 of yacc.c  */
-#line 588 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 588 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2031 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 68:
-/* Line 1792 of yacc.c  */
-#line 590 "./parse-datetime.y"
+#line 590 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; }
+#line 2037 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 69:
-/* Line 1792 of yacc.c  */
-#line 592 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].intval); }
+#line 592 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); }
+#line 2043 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 70:
-/* Line 1792 of yacc.c  */
-#line 594 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 594 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2049 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 71:
-/* Line 1792 of yacc.c  */
-#line 596 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 596 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2055 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 72:
-/* Line 1792 of yacc.c  */
-#line 598 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 598 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2061 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 73:
-/* Line 1792 of yacc.c  */
-#line 600 "./parse-datetime.y"
+#line 600 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; }
+#line 2067 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 75:
-/* Line 1792 of yacc.c  */
-#line 606 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 606 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 2073 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 76:
-/* Line 1792 of yacc.c  */
-#line 608 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 608 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 2079 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 77:
-/* Line 1792 of yacc.c  */
-#line 610 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 610 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 2085 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 78:
-/* Line 1792 of yacc.c  */
-#line 612 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 612 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2091 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 79:
-/* Line 1792 of yacc.c  */
-#line 614 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 614 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2097 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 80:
-/* Line 1792 of yacc.c  */
-#line 616 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 616 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2103 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 81:
-/* Line 1792 of yacc.c  */
-#line 621 "./parse-datetime.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 621 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2109 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 85:
-/* Line 1792 of yacc.c  */
-#line 629 "./parse-datetime.y"
-    { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 629 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2115 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 87:
-/* Line 1792 of yacc.c  */
-#line 635 "./parse-datetime.y"
-    { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 635 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2121 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 88:
-/* Line 1792 of yacc.c  */
-#line 640 "./parse-datetime.y"
-    { digits_to_date_time (pc, (yyvsp[(1) - (1)].textintval)); }
+#line 640 "./parse-datetime.y" /* yacc.c:1646  */
+    { digits_to_date_time (pc, (yyvsp[0].textintval)); }
+#line 2127 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 89:
-/* Line 1792 of yacc.c  */
-#line 645 "./parse-datetime.y"
+#line 645 "./parse-datetime.y" /* yacc.c:1646  */
     {
         /* Hybrid all-digit and relative offset, so that we accept e.g.,
            "YYYYMMDD +N days" as well as "YYYYMMDD N days".  */
-        digits_to_date_time (pc, (yyvsp[(1) - (2)].textintval));
-        apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1);
+        digits_to_date_time (pc, (yyvsp[-1].textintval));
+        apply_relative_time (pc, (yyvsp[0].rel), 1);
       }
+#line 2138 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 90:
-/* Line 1792 of yacc.c  */
-#line 655 "./parse-datetime.y"
+#line 655 "./parse-datetime.y" /* yacc.c:1646  */
     { (yyval.intval) = -1; }
+#line 2144 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
   case 91:
-/* Line 1792 of yacc.c  */
-#line 657 "./parse-datetime.y"
-    { (yyval.intval) = (yyvsp[(2) - (2)].textintval).value; }
+#line 657 "./parse-datetime.y" /* yacc.c:1646  */
+    { (yyval.intval) = (yyvsp[0].textintval).value; }
+#line 2150 "parse-datetime.c" /* yacc.c:1646  */
     break;
 
 
-/* Line 1792 of yacc.c  */
-#line 2332 "parse-datetime.c"
+#line 2154 "parse-datetime.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -2350,7 +2172,7 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-  /* Now `shift' the result of the reduction.  Determine what state
+  /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
@@ -2365,9 +2187,9 @@ yyreduce:
   goto yynewstate;
 
 
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error |
+`--------------------------------------*/
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
@@ -2418,20 +2240,20 @@ yyerrlab:
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
-        error, discard it.  */
+         error, discard it.  */
 
       if (yychar <= YYEOF)
-       {
-         /* Return failure if at end of input.  */
-         if (yychar == YYEOF)
-           YYABORT;
-       }
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
       else
-       {
-         yydestruct ("Error: discarding",
-                     yytoken, &yylval, pc);
-         yychar = YYEMPTY;
-       }
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval, pc);
+          yychar = YYEMPTY;
+        }
     }
 
   /* Else will try to reuse lookahead token after shifting the error
@@ -2450,7 +2272,7 @@ yyerrorlab:
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  /* Do not reclaim the symbols of the rule which action triggered
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
   yylen = 0;
@@ -2463,29 +2285,29 @@ yyerrorlab:
 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 `-------------------------------------------------------------*/
 yyerrlab1:
-  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
   for (;;)
     {
       yyn = yypact[yystate];
       if (!yypact_value_is_default (yyn))
-       {
-         yyn += YYTERROR;
-         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-           {
-             yyn = yytable[yyn];
-             if (0 < yyn)
-               break;
-           }
-       }
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
 
       /* Pop the current state because it cannot handle the error token.  */
       if (yyssp == yyss)
-       YYABORT;
+        YYABORT;
 
 
       yydestruct ("Error: popping",
-                 yystos[yystate], yyvsp, pc);
+                  yystos[yystate], yyvsp, pc);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
@@ -2536,14 +2358,14 @@ yyreturn:
       yydestruct ("Cleanup: discarding lookahead",
                   yytoken, &yylval, pc);
     }
-  /* Do not reclaim the symbols of the rule which action triggered
+  /* Do not reclaim the symbols of the rule whose action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
   YY_STACK_PRINT (yyss, yyssp);
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-                 yystos[*yyssp], yyvsp, pc);
+                  yystos[*yyssp], yyvsp, pc);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
@@ -2554,13 +2376,9 @@ yyreturn:
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
+  return yyresult;
 }
-
-
-/* Line 2055 of yacc.c  */
-#line 660 "./parse-datetime.y"
+#line 660 "./parse-datetime.y" /* yacc.c:1906  */
 
 
 static table const meridian_table[] =
@@ -2935,7 +2753,7 @@ lookup_word (parser_control const *pc, char *word)
 }
 
 static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
 {
   unsigned char c;
   size_t count;
index 9c9bb93f70e9b7842e1810be08cc6d53e954d845..443edb94da6b06527766ea40ce5a60ee9dc8f0b3 100644 (file)
@@ -1,6 +1,6 @@
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2014 Free Software
+   Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 52e6a0c21517aa0837684e0ff30077e0bfb3d07a..1b1fec75927a275c6d7117a771964613b351d079 100644 (file)
@@ -1,7 +1,7 @@
 %{
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2015 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
@@ -1031,7 +1031,7 @@ lookup_word (parser_control const *pc, char *word)
 }
 
 static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
 {
   unsigned char c;
   size_t count;
index 33fc3553d7563f4529fff97ece10d96c84a66546..2f3b64f457ce26ad52e4cd8c5a66da14b9f64759 100644 (file)
@@ -1,5 +1,5 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 70fb40f8e0b6a9d92dd6e81c61ee538d26ac2723..91b0fe77159783285b00960891531b4e4566496d 100644 (file)
@@ -1,5 +1,5 @@
 /* Invoke pipe, but avoid some glitches.
-   Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2015 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
index 39cd0a4fffe36bd487f79a26e82f6723c407de0f..da17efbd53f820296c5c0ceb7f9e81faaf09483e 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 9364eed5092cf955bc958285b3b7c2246043c1ac..387976cca063fb0ddf3639f730a0eac4f15515b6 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2014 Free Software
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 131d0f00a550b113043973f5cfd747402ed483fe..40d0a2264eae6e1a2b2e1cc9e8ae81cce5659ab9 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2015 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
index 2651195f23049bc236f5117b385161001b180dbe..fda6704f9b1b99ce77de9876b9cec5e7319f12df 100644 (file)
@@ -1,5 +1,5 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2014 Free Software
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
index 2919be999a9e85f6627dcb54de62d1c1f335d12f..fe93bcaf2aef4f8e7c48e7fc2d81149073bf7594 100644 (file)
@@ -1,5 +1,5 @@
 /* Program name management.
-   Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
index fa15871df55872f32042606e41d58b608591d858..d1e034f92a387913fee2f4d59575a572fa8bcf9b 100644 (file)
@@ -1,5 +1,5 @@
 /* Program name management.
-   Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2006, 2009-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
index fb338a77a10491ddaca61a7eb5951a3a1a3d18ff..28c05fdd067cbe1576810c4c7b7b163b75a02365 100644 (file)
@@ -1,6 +1,6 @@
 /* quote.h - prototypes for quote.c
 
-   Copyright (C) 1998-2001, 2003, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1998-2001, 2003, 2009-2015 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
index bef7b98b8be8418835cb30ff4878a2ad39cdb3a9..9f916592f6c25455f398cd5b293a6ab636d6bfb2 100644 (file)
@@ -1,6 +1,6 @@
 /* quotearg.c - quote arguments for output
 
-   Copyright (C) 1998-2002, 2004-2014 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2004-2015 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
index da29d7b5fc2fa38300b19c2cfb0c7d56f8ce9e05..d0ccd8beb194f1c2eb2228b99e111f51c2959f2b 100644 (file)
@@ -1,6 +1,6 @@
 /* quotearg.h - quote arguments for output
 
-   Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
+   Copyright (C) 1998-2002, 2004, 2006, 2008-2015 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
index cf58a7e955913ba9be5d0569dc0abb0ba43170cb..d6ba2a173518137b3d7ed2fa4442d9ed3b87ed19 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a non-threads replacement for the POSIX raise function.
 
-   Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2006, 2009-2015 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
index b74aebe07f813512800b0025bb67d486d682f9b7..8646aac43bdb5a924aebfeeb8d3cf5cc90a0f7a2 100644 (file)
@@ -1,5 +1,5 @@
 /* Read the next entry of a directory.
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index 4c49639517640a30dcfc4c57795f95287cf0f103..965c3e2558663da11c7cd893b7da62768a0d5bbc 100644 (file)
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2015 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
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
new file mode 100644 (file)
index 0000000..f4826f9
--- /dev/null
@@ -0,0 +1,61 @@
+/* Read a symlink relative to an open directory.
+   Copyright (C) 2009-2015 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 <unistd.h>
+
+#if HAVE_READLINKAT
+
+# undef readlinkat
+
+ssize_t
+rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
+{
+  return readlinkat (fd, file, buf, len);
+}
+
+#else
+
+/* Gnulib provides a readlink stub for mingw; use it for distinction
+   between EINVAL and ENOENT, rather than always failing with ENOSYS.  */
+
+/* POSIX 2008 says that unlike readlink, readlinkat returns 0 for
+   success instead of the buffer length.  But this would render
+   readlinkat worthless since readlink does not guarantee a
+   NUL-terminated buffer.  Assume this was a bug in POSIX.  */
+
+/* Read the contents of symlink FILE into buffer BUF of size LEN, in the
+   directory open on descriptor FD.  If possible, do it without changing
+   the working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then readlink/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+# define AT_FUNC_NAME readlinkat
+# define AT_FUNC_F1 readlink
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len
+# define AT_FUNC_POST_FILE_ARGS        , buf, len
+# define AT_FUNC_RESULT ssize_t
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+
+#endif
index 8dfcfbe5a58360fccb53184080b36c908e1f1f58..068b081f9404f2e6e35ec4de32d8c320866a5e33 100644 (file)
@@ -1,6 +1,6 @@
 /* realloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2014 Free Software
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index 0e140229650b08da2d218838e330d99cf27d8173..6cbe5b540bce3804b69db6e25e0e13cfa789fe56 100644 (file)
@@ -1,6 +1,6 @@
 # Add this package to a list of references stored in a text file.
 #
-#   Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+#   Copyright (C) 2000, 2009-2015 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
index 2dbcf7b2c1278b7f20ded9443b69706741d3c8bb..f50cf0aa42197b46d79eb4baf57cbdea5125fcd3 100644 (file)
@@ -1,6 +1,6 @@
 # Remove this package from a list of references stored in a text file.
 #
-#   Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+#   Copyright (C) 2000, 2009-2015 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
index 608f83873a290b53d50c3f4df79c75a96d9e2ef9..43be743db406c5589fc2ef4f45130600eecd0588 100644 (file)
@@ -1,6 +1,6 @@
 /* Work around rename bugs in some systems.
 
-   Copyright (C) 2001-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2006, 2009-2015 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
diff --git a/lib/renameat.c b/lib/renameat.c
new file mode 100644 (file)
index 0000000..fa416f0
--- /dev/null
@@ -0,0 +1,157 @@
+/* Rename a file relative to open directories.
+   Copyright (C) 2009-2015 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 <stdio.h>
+
+#if HAVE_RENAMEAT
+
+# include <errno.h>
+# include <stdbool.h>
+# include <stdlib.h>
+# include <string.h>
+# include <sys/stat.h>
+
+# include "dirname.h"
+# include "openat.h"
+
+# undef renameat
+
+/* renameat does not honor trailing / on Solaris 10.  Solve it in a
+   similar manner to rename.  No need to worry about bugs not present
+   on Solaris, since all other systems either lack renameat or honor
+   trailing slash correctly.  */
+
+int
+rpl_renameat (int fd1, char const *src, int fd2, char const *dst)
+{
+  size_t src_len = strlen (src);
+  size_t dst_len = strlen (dst);
+  char *src_temp = (char *) src;
+  char *dst_temp = (char *) dst;
+  bool src_slash;
+  bool dst_slash;
+  int ret_val = -1;
+  int rename_errno = ENOTDIR;
+  struct stat src_st;
+  struct stat dst_st;
+
+  /* Let strace see any ENOENT failure.  */
+  if (!src_len || !dst_len)
+    return renameat (fd1, src, fd2, dst);
+
+  src_slash = src[src_len - 1] == '/';
+  dst_slash = dst[dst_len - 1] == '/';
+  if (!src_slash && !dst_slash)
+    return renameat (fd1, src, fd2, dst);
+
+  /* Presence of a trailing slash requires directory semantics.  If
+     the source does not exist, or if the destination cannot be turned
+     into a directory, give up now.  Otherwise, strip trailing slashes
+     before calling rename.  */
+  if (lstatat (fd1, src, &src_st))
+    return -1;
+  if (lstatat (fd2, dst, &dst_st))
+    {
+      if (errno != ENOENT || !S_ISDIR (src_st.st_mode))
+        return -1;
+    }
+  else if (!S_ISDIR (dst_st.st_mode))
+    {
+      errno = ENOTDIR;
+      return -1;
+    }
+  else if (!S_ISDIR (src_st.st_mode))
+    {
+      errno = EISDIR;
+      return -1;
+    }
+
+# if RENAME_TRAILING_SLASH_SOURCE_BUG
+  /* See the lengthy comment in rename.c why Solaris 9 is forced to
+     GNU behavior, while Solaris 10 is left with POSIX behavior,
+     regarding symlinks with trailing slash.  */
+  if (src_slash)
+    {
+      src_temp = strdup (src);
+      if (!src_temp)
+        {
+          /* Rather than rely on strdup-posix, we set errno ourselves.  */
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (src_temp);
+      if (lstatat (fd1, src_temp, &src_st))
+        {
+          rename_errno = errno;
+          goto out;
+        }
+      if (S_ISLNK (src_st.st_mode))
+        goto out;
+    }
+  if (dst_slash)
+    {
+      dst_temp = strdup (dst);
+      if (!dst_temp)
+        {
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (dst_temp);
+      if (lstatat (fd2, dst_temp, &dst_st))
+        {
+          if (errno != ENOENT)
+            {
+              rename_errno = errno;
+              goto out;
+            }
+        }
+      else if (S_ISLNK (dst_st.st_mode))
+        goto out;
+    }
+# endif /* RENAME_TRAILING_SLASH_SOURCE_BUG */
+
+  ret_val = renameat (fd1, src_temp, fd2, dst_temp);
+  rename_errno = errno;
+ out:
+  if (src_temp != src)
+    free (src_temp);
+  if (dst_temp != dst)
+    free (dst_temp);
+  errno = rename_errno;
+  return ret_val;
+}
+
+#else /* !HAVE_RENAMEAT */
+
+# include "openat-priv.h"
+
+/* Rename FILE1, in the directory open on descriptor FD1, to FILE2, in
+   the directory open on descriptor FD2.  If possible, do it without
+   changing the working directory.  Otherwise, resort to using
+   save_cwd/fchdir, then rename/restore_cwd.  If either the save_cwd or
+   the restore_cwd fails, then give a diagnostic and exit nonzero.  */
+
+int
+renameat (int fd1, char const *file1, int fd2, char const *file2)
+{
+  return at_func2 (fd1, file1, fd2, file2, rename);
+}
+
+#endif /* !HAVE_RENAMEAT */
index ec7a586f70224762866aa43e41041b2fa6cace62..ae21d54195adff5e9f7146dcd7c8fff9637294fa 100644 (file)
@@ -1,6 +1,6 @@
 /* Work around rmdir bugs.
 
-   Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2014 Free Software
+   Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index c9b8828a18b035031d0c9dd1dbb85413a77bb65e..dbb63380059991974210c4145cf3d312417aab31 100644 (file)
@@ -1,6 +1,6 @@
 /* An interface to read and write that retries after interrupts.
 
-   Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2014 Free Software
+   Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index bf72dd4d5710860ec72ec2ec7c50a5ee6f1f0588..4c178f529b796df7db0a65d636214c61adfadc47 100644 (file)
@@ -1,5 +1,5 @@
 /* An interface to write that retries after interrupts.
-   Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2015 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
index ae186572cd611a6cd48317c3db425552ccacb260..86a32b2aea70027fcfc204891ce3fde35971070b 100644 (file)
@@ -1,5 +1,5 @@
 /* An interface to write() that retries after interrupts.
-   Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2015 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
index 584f606500807f6b85490dc7589dc1477a3c5d40..ecc3049d744ca7dd497901bb0e2efc0a344f3bf6 100644 (file)
@@ -1,6 +1,6 @@
 /* Determine whether two stat buffers refer to the same file.
 
-   Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2015 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
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
new file mode 100644 (file)
index 0000000..159d8a8
--- /dev/null
@@ -0,0 +1,99 @@
+/* save-cwd.c -- Save and restore current working directory.
+
+   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2015 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 Jim Meyering.  */
+
+#include <config.h>
+
+#include "save-cwd.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "chdir-long.h"
+#include "unistd--.h"
+#include "cloexec.h"
+
+#if GNULIB_FCNTL_SAFER
+# include "fcntl--.h"
+#else
+# define GNULIB_FCNTL_SAFER 0
+#endif
+
+/* Record the location of the current working directory in CWD so that
+   the program may change to other directories and later use restore_cwd
+   to return to the recorded location.  This function may allocate
+   space using malloc (via getcwd) or leave a file descriptor open;
+   use free_cwd to perform the necessary free or close.  Upon failure,
+   no memory is allocated, any locally opened file descriptors are
+   closed;  return non-zero -- in that case, free_cwd need not be
+   called, but doing so is ok.  Otherwise, return zero.
+
+   The _raison d'etre_ for this interface is that the working directory
+   is sometimes inaccessible, and getcwd is not robust or as efficient.
+   So, we prefer to use the open/fchdir approach, but fall back on
+   getcwd if necessary.  This module works for most cases with just
+   the getcwd-lgpl module, but to be truly robust, use the getcwd module.
+
+   Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
+   SCO Xenix.  Also, SunOS 4 and Irix 5.3 provide the function, yet it
+   doesn't work for partitions on which auditing is enabled.  If
+   you're still using an obsolete system with these problems, please
+   send email to the maintainer of this code.  */
+
+int
+save_cwd (struct saved_cwd *cwd)
+{
+  cwd->name = NULL;
+
+  cwd->desc = open (".", O_SEARCH);
+  if (!GNULIB_FCNTL_SAFER)
+    cwd->desc = fd_safer (cwd->desc);
+  if (cwd->desc < 0)
+    {
+      cwd->name = getcwd (NULL, 0);
+      return cwd->name ? 0 : -1;
+    }
+
+  set_cloexec_flag (cwd->desc, true);
+  return 0;
+}
+
+/* Change to recorded location, CWD, in directory hierarchy.
+   Upon failure, return -1 (errno is set by chdir or fchdir).
+   Upon success, return zero.  */
+
+int
+restore_cwd (const struct saved_cwd *cwd)
+{
+  if (0 <= cwd->desc)
+    return fchdir (cwd->desc);
+  else
+    return chdir_long (cwd->name);
+}
+
+void
+free_cwd (struct saved_cwd *cwd)
+{
+  if (cwd->desc >= 0)
+    close (cwd->desc);
+  free (cwd->name);
+}
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
new file mode 100644 (file)
index 0000000..890f7fb
--- /dev/null
@@ -0,0 +1,34 @@
+/* Save and restore current working directory.
+
+   Copyright (C) 1995, 1997-1998, 2003, 2009-2015 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 Jim Meyering.  */
+
+#ifndef SAVE_CWD_H
+# define SAVE_CWD_H 1
+
+struct saved_cwd
+  {
+    int desc;
+    char *name;
+  };
+
+int save_cwd (struct saved_cwd *cwd);
+int restore_cwd (const struct saved_cwd *cwd);
+void free_cwd (struct saved_cwd *cwd);
+
+#endif /* SAVE_CWD_H */
index 32819e6d2d28f8c5dae948c4901190c3146f39cf..31aad1fd009cb9f809b1bd250b5398bf2c26dd80 100644 (file)
@@ -1,6 +1,6 @@
 /* Look up an environment variable more securely.
 
-   Copyright 2013-2014 Free Software Foundation, Inc.
+   Copyright 2013-2015 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
index 06791a90596aeac8e92ba115283ab30ffa7b13cf..6b16fd584182ced82a9f56eb9d150fc205eab84b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index 925e16f2b0ec8c81c89111289d41acc388b62771..0f2ff5af8435a9a8928f4070a64a8148435fad6d 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index 461ff1cadef770ee4cb7b97ddd32d21db3340140..5a0568e5f5adb050cd394acc283e59a3b8850d03 100644 (file)
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index b3df6eb816d28aef1e5e5f80d541969143e15051..b67d1798353817b56a35f1d6a268dd23356eb0f4 100644 (file)
@@ -1,6 +1,6 @@
 /* stat-related time functions.
 
-   Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2015 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
@@ -54,7 +54,7 @@ _GL_INLINE_HEADER_BEGIN
 #endif
 
 /* Return the nanosecond component of *ST's access time.  */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
 get_stat_atime_ns (struct stat const *st)
 {
 # if defined STAT_TIMESPEC
@@ -67,7 +67,7 @@ get_stat_atime_ns (struct stat const *st)
 }
 
 /* Return the nanosecond component of *ST's status change time.  */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
 get_stat_ctime_ns (struct stat const *st)
 {
 # if defined STAT_TIMESPEC
@@ -80,7 +80,7 @@ get_stat_ctime_ns (struct stat const *st)
 }
 
 /* Return the nanosecond component of *ST's data modification time.  */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
 get_stat_mtime_ns (struct stat const *st)
 {
 # if defined STAT_TIMESPEC
@@ -93,7 +93,7 @@ get_stat_mtime_ns (struct stat const *st)
 }
 
 /* Return the nanosecond component of *ST's birth time.  */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
 get_stat_birthtime_ns (struct stat const *st)
 {
 # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
@@ -108,7 +108,7 @@ get_stat_birthtime_ns (struct stat const *st)
 }
 
 /* Return *ST's access time.  */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
 get_stat_atime (struct stat const *st)
 {
 #ifdef STAT_TIMESPEC
@@ -122,7 +122,7 @@ get_stat_atime (struct stat const *st)
 }
 
 /* Return *ST's status change time.  */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
 get_stat_ctime (struct stat const *st)
 {
 #ifdef STAT_TIMESPEC
@@ -136,7 +136,7 @@ get_stat_ctime (struct stat const *st)
 }
 
 /* Return *ST's data modification time.  */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
 get_stat_mtime (struct stat const *st)
 {
 #ifdef STAT_TIMESPEC
@@ -151,7 +151,7 @@ get_stat_mtime (struct stat const *st)
 
 /* Return *ST's birth time, if available; otherwise return a value
    with tv_sec and tv_nsec both equal to -1.  */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
 get_stat_birthtime (struct stat const *st)
 {
   struct timespec t;
index 35f4b0b1a51bec9c6a9231d6a70dd571bb63fa27..2209826fc31084bc9759e2308173a35fa2bded50 100644 (file)
@@ -1,5 +1,5 @@
 /* Work around platform bugs in stat.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
diff --git a/lib/statat.c b/lib/statat.c
new file mode 100644 (file)
index 0000000..8cdb17e
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define STATAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
index 5b37dd3601a9f10aef13ed1ee0ad5394b0d3aabc..5239f51af76db138a04652444ab3146a4cbaed7f 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <stdarg.h>.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index 651e8dffdb34ba935e729e4f4b3581c0de69ee9a..64a17618255ff8e7bfb4e5cc9b817c8c609a2ba0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
index f5c0e0565541d9f384d6abe2d4db900d5fbe7ddc..44db24173c4c7438ce0b1ac710cba78d9b4b1684 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
@@ -39,7 +39,6 @@
 
 # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
 #  ifdef __need_wint_t
-#   undef _@GUARD_PREFIX@_STDDEF_H
 #   define _GL_STDDEF_WINT_T
 #  endif
 #  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
 
 #  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
 
-#  ifndef _@GUARD_PREFIX@_STDDEF_H
-#   define _@GUARD_PREFIX@_STDDEF_H
-
 /* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
-#if @REPLACE_NULL@
-# undef NULL
-# ifdef __cplusplus
+#  if (@REPLACE_NULL@ \
+       && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
+#   undef NULL
+#   ifdef __cplusplus
    /* ISO C++ says that the macro NULL must expand to an integer constant
       expression, hence '((void *) 0)' is not allowed in C++.  */
-#  if __GNUG__ >= 3
+#    if __GNUG__ >= 3
     /* GNU C++ has a __null macro that behaves like an integer ('int' or
        'long') but has the same size as a pointer.  Use that, to avoid
        warnings.  */
-#   define NULL __null
-#  else
-#   define NULL 0L
+#     define NULL __null
+#    else
+#     define NULL 0L
+#    endif
+#   else
+#    define NULL ((void *) 0)
+#   endif
 #  endif
-# else
-#  define NULL ((void *) 0)
-# endif
-#endif
+
+#  ifndef _@GUARD_PREFIX@_STDDEF_H
+#   define _@GUARD_PREFIX@_STDDEF_H
 
 /* Some platforms lack wchar_t.  */
 #if !@HAVE_WCHAR_T@
 # define wchar_t int
 #endif
 
+/* Some platforms lack max_align_t.  */
+#if !@HAVE_MAX_ALIGN_T@
+typedef union
+{
+  char *__p;
+  double __d;
+  long double __ld;
+  long int __i;
+} max_align_t;
+#endif
+
 #  endif /* _@GUARD_PREFIX@_STDDEF_H */
 # endif /* _@GUARD_PREFIX@_STDDEF_H */
 #endif /* __need_XXX */
index 247f0d89619fd5f69f5e8f97ae3aa42a6c07f319..378de2ec6d49a2d4684db091ac379b4f1f61c9f8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2015 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
index 1e1fe84c77db22ebbad781942f20064a46db9157..759c94d7abf8edf026348d23f69a76a600ba5fa9 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2015 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
    except that it indicates to GCC that the supported format string directives
    are the ones of the system printf(), rather than the ones standardized by
    ISO C99 and POSIX.  */
-#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+  _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
+#else
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+#endif
 
 /* _GL_ATTRIBUTE_FORMAT_SCANF
    indicates to GCC that the function takes a format string and arguments,
index ee643247d85b6bad8b0ba282835eff82a1464656..428a119188c84d331314eb2d0cb66faa028452d1 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2015 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
diff --git a/lib/strdup.c b/lib/strdup.c
new file mode 100644 (file)
index 0000000..4fdd0bd
--- /dev/null
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2015 Free Software
+   Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   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, 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/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Get specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#undef __strdup
+#ifdef _LIBC
+# undef strdup
+#endif
+
+#ifndef weak_alias
+# define __strdup strdup
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+char *
+__strdup (const char *s)
+{
+  size_t len = strlen (s) + 1;
+  void *new = malloc (len);
+
+  if (new == NULL)
+    return NULL;
+
+  return (char *) memcpy (new, s, len);
+}
+#ifdef libc_hidden_def
+libc_hidden_def (__strdup)
+#endif
+#ifdef weak_alias
+weak_alias (__strdup, strdup)
+#endif
index 0e62fb939a7a06d24ba73f60e8220e5080362e1d..6107fc6bd224b40b8ab7f88c7da049b4538ac7a6 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized string comparison.
-   Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2009-2015 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
index 255d933346fbe43579f3fddbb9834c13cce06597..2bb4d7457d7c22b73f4015c09f4e1a292af3cb42 100644 (file)
@@ -1,6 +1,6 @@
 /* strerror-override.c --- POSIX compatible system error routine
 
-   Copyright (C) 2010-2014 Free Software Foundation, Inc.
+   Copyright (C) 2010-2015 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
index e98c1c16bc6bcb6c07ad2a1873cefd010a26f498..7af36dfd45eab049c2d6e8e547d74d877a069144 100644 (file)
@@ -1,6 +1,6 @@
 /* strerror-override.h --- POSIX compatible system error routine
 
-   Copyright (C) 2010-2014 Free Software Foundation, Inc.
+   Copyright (C) 2010-2015 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
index e54f0cc906bc2ff50879c34c9133b28c343e8e6f..adba738b7b40e84611e02d4a392a83ca7637f30c 100644 (file)
@@ -1,6 +1,6 @@
 /* strerror.c --- POSIX compatible system error routine
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 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
index 906214205985b8f8a014f1c659b09f0c52362e8c..ebd727eda147dda0e86d940a193781d8e6f3818d 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2015 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
index 6f802d4c23c406872a06828bb7b0c5a913c2f06a..12359cf7bf5fc2a0941224ecf90215e3efcdc9bd 100644 (file)
@@ -1,6 +1,6 @@
 /* stripslash.c -- remove redundant trailing slashes from a file name
 
-   Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+   Copyright (C) 1990, 2001, 2003-2006, 2009-2015 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
index cc1a4843ca42c52d76e6aec9dd049f4f75475e77..793d599035a3d179bf77340608a49504d73d1a24 100644 (file)
@@ -1,6 +1,6 @@
 /* A replacement function, for systems that lack strndup.
 
-   Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2014 Free Software
+   Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
index ddccebc6b1a4fedfc9cc2c38030feb3a146c886c..79e250c4d7389f31258942cdd870c895c14a195e 100644 (file)
@@ -1,5 +1,5 @@
 /* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index 0e3fae255c21a63eaa90c32b3fee49ffc3132951..14356c30e7c956ab53941cb8fc7b05d8dc24c00f 100644 (file)
@@ -1,5 +1,5 @@
 /* Stub for symlink().
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
diff --git a/lib/symlinkat.c b/lib/symlinkat.c
new file mode 100644 (file)
index 0000000..ce10d94
--- /dev/null
@@ -0,0 +1,93 @@
+/* Create a symlink relative to an open directory.
+   Copyright (C) 2009-2015 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 <unistd.h>
+#include <errno.h>
+
+#if HAVE_SYMLINKAT
+# undef symlinkat
+
+/* Create a symlink, but reject trailing slash.  */
+int
+rpl_symlinkat (char const *contents, int fd, char const *name)
+{
+  size_t len = strlen (name);
+  if (len && name[len - 1] == '/')
+    {
+      struct stat st;
+      if (fstatat (fd, name, &st, 0) == 0)
+        errno = EEXIST;
+      return -1;
+    }
+  return symlinkat (contents, fd, name);
+}
+
+#elif !HAVE_SYMLINK
+/* Mingw lacks symlink, and it is more efficient to provide a trivial
+   wrapper than to go through at-func.c to call rpl_symlink.  */
+
+int
+symlinkat (char const *path1 _GL_UNUSED, int fd _GL_UNUSED,
+           char const *path2 _GL_UNUSED)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_SYMLINK */
+
+/* Our openat helper functions expect the directory parameter first,
+   not second.  These shims make life easier.  */
+
+/* Like symlink, but with arguments reversed.  */
+static int
+symlink_reversed (char const *file, char const *contents)
+{
+  return symlink (contents, file);
+}
+
+/* Like symlinkat, but with arguments reversed.  */
+
+static int
+symlinkat_reversed (int fd, char const *file, char const *contents);
+
+# define AT_FUNC_NAME symlinkat_reversed
+# define AT_FUNC_F1 symlink_reversed
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char const *contents
+# define AT_FUNC_POST_FILE_ARGS        , contents
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+/* Create a symlink FILE, in the directory open on descriptor FD,
+   holding CONTENTS.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then symlink/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+int
+symlinkat (char const *contents, int fd, char const *file)
+{
+  return symlinkat_reversed (fd, file, contents);
+}
+
+#endif /* HAVE_SYMLINK */
index b47a7ff0ae7e2b9c0fda5c488af6be9d1e090816..9f5e85369f7bb1362f7ec14308f0e3bcd3d347dc 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2015 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
index 30057ad49fd7310d47c6f43616b8a66c4df0a19b..c556c5db23312cdf04ff7ffbf69a2f16366dfaab 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 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
index deb5d67d1d7d2d8a573984911bfc89ea24dbe192..814bc179b0e0e60f3ec35c12d4006a2d037c62d2 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/types.h.
 
-   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Copyright (C) 2011-2015 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
index 9b713cb04c94166c50556793fe18ff6f9c234d2d..088b224ab96784c2d6f856aeb7eebba4f219642e 100644 (file)
@@ -1,6 +1,6 @@
 /* tempname.c - generate the name of a temporary file.
 
-   Copyright (C) 1991-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1991-2003, 2005-2007, 2009-2015 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
index 44d5f04bbf928fb5e41c804b164626f3376998eb..b560ee5cb147dcea2d6dd36748ce4b01f5af128f 100644 (file)
@@ -1,6 +1,6 @@
 /* Create a temporary file or directory.
 
-   Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2015 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
index 81abdf46e0bb729bf55fbdcfca7eb504beb075d3..1a6b746ccab289cc4ac1534195162231ecebfa82 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 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
@@ -55,6 +55,8 @@
 #   include <sys/time.h>
 #  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
 #   include <pthread.h>
+#  elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+#   include <unistd.h>
 #  else
 
 #   ifdef __cplusplus
index a848d544fe2fe0ca7d6d35edd9c501499dabf900..0b512de99fe24be0163072d05acebb202656177a 100644 (file)
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2015 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
index 872cbb76e3765261d4f4fbd191ad26f8c3ee8900..9ec495a08d1ba39ed8b2761931ed93c18de26ed9 100644 (file)
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2014 Free Software
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -74,7 +74,7 @@ make_timespec (time_t s, long int ns)
 
    The (int) cast avoids a gcc -Wconversion warning.  */
 
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
 timespec_cmp (struct timespec a, struct timespec b)
 {
   return (a.tv_sec < b.tv_sec ? -1
@@ -84,7 +84,7 @@ timespec_cmp (struct timespec a, struct timespec b)
 
 /* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
    nonnegative.  */
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
 timespec_sign (struct timespec a)
 {
   return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
index 9d0e54d106a33f676fbe351945abe2f67ff44558..ada1f6b7bf17dcb853683e5f24011c1cec9e4929 100644 (file)
@@ -1,6 +1,6 @@
 /* Like unistd.h, but redefine some names to avoid glitches.
 
-   Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009-2015 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
index 4b0ca6abce9ac5b7d2d637139ecfdfa927923d6f..d4251b3ee1ff85123df4f1a2a04f7d05a664168b 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke unistd-like functions, but avoid some glitches.
 
-   Copyright (C) 2001, 2003, 2005, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2009-2015 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
index 219f43d9310b8eba0547194fce13d78a60c1244f..958fea2a576ce58cff32c3af6bfa82db99d718f6 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003-2015 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
@@ -402,7 +402,7 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
    "VARIABLE=VALUE", terminated with a NULL.  */
 #  if defined __APPLE__ && defined __MACH__
 #   include <TargetConditionals.h>
-#   if !defined TARGET_OS_IPHONE && !defined TARGET_IPHONE_SIMULATOR
+#   if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
 #    define _GL_USE_CRT_EXTERNS
 #   endif
 #  endif
index a234be4a3f553b2fb52407f968b1f6341a708a5d..e006273af76d49d74714b231e3ae3a6af6d32478 100644 (file)
@@ -1,6 +1,6 @@
 /* Work around unlink bugs.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 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
diff --git a/lib/unlinkat.c b/lib/unlinkat.c
new file mode 100644 (file)
index 0000000..0d89bf9
--- /dev/null
@@ -0,0 +1,109 @@
+/* Work around unlinkat bugs on Solaris 9 and Hurd.
+
+   Copyright (C) 2009-2015 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 <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <stdlib.h>
+
+#include "dosname.h"
+#include "openat.h"
+
+#if HAVE_UNLINKAT
+
+# undef unlinkat
+
+/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris
+   9.  Solve it in a similar manner to unlink.  Hurd has the same
+   issue. */
+
+int
+rpl_unlinkat (int fd, char const *name, int flag)
+{
+  size_t len;
+  int result = 0;
+  /* rmdir behavior has no problems with trailing slash.  */
+  if (flag & AT_REMOVEDIR)
+    return unlinkat (fd, name, flag);
+
+  len = strlen (name);
+  if (len && ISSLASH (name[len - 1]))
+    {
+      /* See the lengthy comment in unlink.c why we disobey the POSIX
+         rule of letting unlink("link-to-dir/") attempt to unlink a
+         directory.  */
+      struct stat st;
+      result = lstatat (fd, name, &st);
+      if (result == 0)
+        {
+          /* Trailing NUL will overwrite the trailing slash.  */
+          char *short_name = malloc (len);
+          if (!short_name)
+            {
+              errno = EPERM;
+              return -1;
+            }
+          memcpy (short_name, name, len);
+          while (len && ISSLASH (short_name[len - 1]))
+            short_name[--len] = '\0';
+          if (len && (lstatat (fd, short_name, &st) || S_ISLNK (st.st_mode)))
+            {
+              free (short_name);
+              errno = EPERM;
+              return -1;
+            }
+          free (short_name);
+        }
+    }
+  if (!result)
+    result = unlinkat (fd, name, flag);
+  return result;
+}
+
+#else /* !HAVE_UNLINKAT */
+
+/* Replacement for Solaris' function by the same name.
+   <http://www.google.com/search?q=unlinkat+site:docs.sun.com>
+   First, try to simulate it via (unlink|rmdir) ("/proc/self/fd/FD/FILE").
+   Failing that, simulate it via save_cwd/fchdir/(unlink|rmdir)/restore_cwd.
+   If either the save_cwd or the restore_cwd fails (relatively unlikely),
+   then give a diagnostic and exit nonzero.
+   Otherwise, this function works just like Solaris' unlinkat.  */
+
+# define AT_FUNC_NAME unlinkat
+# define AT_FUNC_F1 rmdir
+# define AT_FUNC_F2 unlink
+# define AT_FUNC_USE_F1_COND AT_REMOVEDIR
+# define AT_FUNC_POST_FILE_PARAM_DECLS , int flag
+# define AT_FUNC_POST_FILE_ARGS        /* empty */
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#endif /* !HAVE_UNLINKAT */
index 53721fc440be95e18ba87ed510c2fcb5e4eb3c8c..87f41d59a5071d821d5fb102ef38621ec03a810f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index dd3ec668f3753a7bc9cb70a8c0e15324d0c397c2..7386dcf210de32fa122d082cf55264409a1da0d3 100644 (file)
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright (C) 2003-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003-2015 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
@@ -24,7 +24,6 @@
 #define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
 #include "utimens.h"
 
-#include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdbool.h>
@@ -87,7 +86,6 @@ validate_timespec (struct timespec timespec[2])
 {
   int result = 0;
   int utime_omit_count = 0;
-  assert (timespec);
   if ((timespec[0].tv_nsec != UTIME_NOW
        && timespec[0].tv_nsec != UTIME_OMIT
        && ! (0 <= timespec[0].tv_nsec
index faaf3c7006bad547f8c6a10d53ba9a6a3ad156b4..cbd06cc7f09df624612c11626f80ec4675b6e414 100644 (file)
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright 2012-2014 Free Software Foundation, Inc.
+   Copyright 2012-2015 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
diff --git a/lib/utimensat.c b/lib/utimensat.c
new file mode 100644 (file)
index 0000000..59839d4
--- /dev/null
@@ -0,0 +1,158 @@
+/* Set the access and modification time of a file relative to directory fd.
+   Copyright (C) 2009-2015 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 <errno.h>
+#include <fcntl.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+#include "utimens.h"
+
+#if HAVE_UTIMENSAT
+
+# undef utimensat
+
+/* If we have a native utimensat, but are compiling this file, then
+   utimensat was defined to rpl_utimensat by our replacement
+   sys/stat.h.  We assume the native version might fail with ENOSYS,
+   or succeed without properly affecting ctime (as is the case when
+   using newer glibc but older Linux kernel).  In this scenario,
+   rpl_utimensat checks whether the native version is usable, and
+   local_utimensat provides the fallback manipulation.  */
+
+static int local_utimensat (int, char const *, struct timespec const[2], int);
+# define AT_FUNC_NAME local_utimensat
+
+/* Like utimensat, but work around native bugs.  */
+
+int
+rpl_utimensat (int fd, char const *file, struct timespec const times[2],
+               int flag)
+{
+# if defined __linux__ || defined __sun
+  struct timespec ts[2];
+# endif
+
+  /* See comments in utimens.c for details.  */
+  static int utimensat_works_really; /* 0 = unknown, 1 = yes, -1 = no.  */
+  if (0 <= utimensat_works_really)
+    {
+      int result;
+# if defined __linux__ || defined __sun
+      struct stat st;
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory [l]stat prior
+         to calling utimensat; fortunately, there is not much timing
+         impact due to the extra syscall even on file systems where
+         UTIME_OMIT would have worked.
+
+         The same bug occurs in Solaris 11.1 (Apr 2013).
+
+         FIXME: Simplify this for Linux in 2016 and for Solaris in
+         2024, when file system bugs are no longer common.  */
+      if (times && (times[0].tv_nsec == UTIME_OMIT
+                    || times[1].tv_nsec == UTIME_OMIT))
+        {
+          if (fstatat (fd, file, &st, flag))
+            return -1;
+          if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
+            return 0;
+          if (times[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else
+            ts[0] = times[0];
+          if (times[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          else
+            ts[1] = times[1];
+          times = ts;
+        }
+#  ifdef __hppa__
+      /* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
+         values.  */
+      else if (times
+               && ((times[0].tv_nsec != UTIME_NOW
+                    && ! (0 <= times[0].tv_nsec
+                          && times[0].tv_nsec < TIMESPEC_RESOLUTION))
+                   || (times[1].tv_nsec != UTIME_NOW
+                       && ! (0 <= times[1].tv_nsec
+                             && times[1].tv_nsec < TIMESPEC_RESOLUTION))))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+#  endif
+# endif
+      result = utimensat (fd, file, times, flag);
+      /* Linux kernel 2.6.25 has a bug where it returns EINVAL for
+         UTIME_NOW or UTIME_OMIT with non-zero tv_sec, which
+         local_utimensat works around.  Meanwhile, EINVAL for a bad
+         flag is indeterminate whether the native utimensat works, but
+         local_utimensat will also reject it.  */
+      if (result == -1 && errno == EINVAL && (flag & ~AT_SYMLINK_NOFOLLOW))
+        return result;
+      if (result == 0 || (errno != ENOSYS && errno != EINVAL))
+        {
+          utimensat_works_really = 1;
+          return result;
+        }
+    }
+  /* No point in trying openat/futimens, since on Linux, futimens is
+     implemented with the same syscall as utimensat.  Only avoid the
+     native utimensat due to an ENOSYS failure; an EINVAL error was
+     data-dependent, and the next caller may pass valid data.  */
+  if (0 <= utimensat_works_really && errno == ENOSYS)
+    utimensat_works_really = -1;
+  return local_utimensat (fd, file, times, flag);
+}
+
+#else /* !HAVE_UTIMENSAT */
+
+# define AT_FUNC_NAME utimensat
+
+#endif /* !HAVE_UTIMENSAT */
+
+/* Set the access and modification time stamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively; relative to directory
+   FD.  If flag is AT_SYMLINK_NOFOLLOW, change the times of a symlink,
+   or fail with ENOSYS if not possible.  If TIMESPEC is null, set the
+   time stamps to the current time.  If possible, do it without
+   changing the working directory.  Otherwise, resort to using
+   save_cwd/fchdir, then utimens/restore_cwd.  If either the save_cwd
+   or the restore_cwd fails, then give a diagnostic and exit nonzero.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+/* AT_FUNC_NAME is now utimensat or local_utimensat.  */
+#define AT_FUNC_F1 lutimens
+#define AT_FUNC_F2 utimens
+#define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , struct timespec const ts[2], int flag
+#define AT_FUNC_POST_FILE_ARGS        , ts
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_F2
+#undef AT_FUNC_USE_F1_COND
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
index ec7302a96e61f3e18d7ef470db1de50dc7708711..246831f8d235474a22a76e2d777bc2a614569b24 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2015 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
@@ -5179,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                         /* SNPRINTF or sprintf failed.  Save and use the errno
                            that it has set, if any.  */
                         int saved_errno = errno;
+                        if (saved_errno == 0)
+                          {
+                            if (dp->conversion == 'c' || dp->conversion == 's')
+                              saved_errno = EILSEQ;
+                            else
+                              saved_errno = EINVAL;
+                          }
 
                         if (!(result == resultbuf || result == NULL))
                           free (result);
                         if (buf_malloced != NULL)
                           free (buf_malloced);
                         CLEANUP ();
-                        errno =
-                          (saved_errno != 0
-                           ? saved_errno
-                           : (dp->conversion == 'c' || dp->conversion == 's'
-                              ? EILSEQ
-                              : EINVAL));
+
+                        errno = saved_errno;
                         return NULL;
                       }
 
index daa946dc9322ce29cad73eb9ba34401b8aee5929..3494eef374cd3fdd310ade668d305a889157215b 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2015 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
index eed903749c17ed5cba04305bc754402df016df63..5dd4abd46134eb84a6843e25b8f73ba2a9f36c18 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2015 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
index a25e514668a0617b889817654fb796fc7482e03a..60eba498110747ec1fd31b9b03e4802cf565ec40 100644 (file)
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2015 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
index 9388f62247c71e85ca011a57a2a8e7bb8455afcc..81a2ffcb67e79363ce6ba5f3fe9ecd4f3c7be0c2 100644 (file)
@@ -1,5 +1,5 @@
 /* va_list error handler for noninteractive utilities
-   Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2009-2015 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
index c6292bc65c29eaaa7795e5633488e6f700d5e8d8..5aaa63cf24ccf4d3953c090df9fb6d916edf4ef5 100644 (file)
@@ -1,5 +1,5 @@
 /* Declaration for va_list error-reporting function
-   Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2009-2015 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
index 473285fb2809f9acde3c71fd5e66ecbe4107349f..fc06d2789300ef90b0265c88a8a6ed267e3113f7 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 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
index ab06653958f2819931f44960049384932eb7d6a6..9050b7e5878d28812ad39ff57f93f043b0a2a517 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
 
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 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
index ff31dbb6ca78a3529741487482441d72ac6379d2..ed2d3b7bf49fc8317010883bf4ac93dfaaa6ada9 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX compatible write() function.
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
index 7bdd2a3113b5a0a2918ffff0c3e7016fd3c839dc..3cea6386c552c7ca15cde10c45a04655d98f32cb 100644 (file)
@@ -1,6 +1,6 @@
 /* Report a memory allocation failure and exit.
 
-   Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2014 Free Software
+   Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2015 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
index f3329228ec0a1bf44ff37cf37d224f61d2d549ff..f0e9778f7382bcdac604dcdc8deaaf8371c1ba2f 100644 (file)
@@ -1,6 +1,6 @@
 /* xalloc-oversized.h -- memory allocation size checking
 
-   Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2003-2004, 2006-2015 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
index 3f6b5b80f8dd2b7188b2adca4333d856575799e0..3dfaa87fe408a46b8e06a52122db9c4591c99df3 100644 (file)
@@ -1,6 +1,6 @@
 /* xalloc.h -- malloc with out-of-memory checking
 
-   Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2003-2004, 2006-2015 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
index 4e0b5b16ff024f4cc76998923665a031356ebe70..f8eef97802ba1aa585778234c96fe9109f701ffd 100644 (file)
@@ -1,5 +1,5 @@
 /* vasprintf and asprintf with out-of-memory checking.
-   Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
+   Copyright (C) 1999, 2002-2004, 2006, 2009-2015 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
index 264d44afd4ee44f085ae8f03c0582288fc59a5f3..e246559f873bcc5f497526a235a268363a813444 100644 (file)
@@ -1,6 +1,6 @@
 /* xmalloc.c -- malloc with out of memory checking
 
-   Copyright (C) 1990-2000, 2002-2006, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2002-2006, 2008-2015 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
index 8e36813ab8884b473d72cd03cf3b6504f78b7475..46b0f0537c59d9b01c3157f4a33b50b8ea9a8bbd 100644 (file)
@@ -1,6 +1,6 @@
 /* xmemdup0.c -- copy a block of arbitrary bytes, plus a trailing NUL
 
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index 278f62599f2d869832cd5bc4ba3b7c83d73c6b71..673a47bb01753fc25aa14dedd06c47626e5543db 100644 (file)
@@ -1,6 +1,6 @@
 /* xmemdup0.h -- copy a block of arbitrary bytes, plus a trailing NUL
 
-   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2008-2015 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
index fd12c67060aa5f1b4c231906d66711a66242d584..b2a786a8ee842a11473f5b4b78562a4209722112 100644 (file)
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008-2015 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
index d2259c8253c7878f8bdbfa3a0e2949f108d6d534..51831d8c25856e8fcba24476f6fed1cd2a0bfa58 100644 (file)
@@ -1,6 +1,6 @@
 /* Duplicate a bounded initial segment of a string, with out-of-memory
    checking.
-   Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2009-2015 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
index 6a409f7a6724ee31ef545de0a894306cb1eb763d..d510bf3762504a136026a482c795990a74a86650 100644 (file)
@@ -1,6 +1,6 @@
 /* Duplicate a bounded initial segment of a string, with out-of-memory
    checking.
-   Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009-2015 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
index 7a4029e7908aa9ab9fc8493e5335266209beba2e..441ab598d6598c68a135d05b99d22a9225b7536d 100644 (file)
@@ -1,5 +1,5 @@
 /* vasprintf and asprintf with out-of-memory checking.
-   Copyright (C) 1999, 2002-2004, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2004, 2006-2015 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
index 407a5e0d439773d3a0a1a4af01c75603c45898ba..3b7f5ad8639cf7493980591808cbaae74b8c23c0 100644 (file)
@@ -1,5 +1,5 @@
 /* vasprintf and asprintf with out-of-memory checking.
-   Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2006-2015 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
index 8eca5518ad64a5925ee4b2c8d194fbf7d1591b6b..c7103ed52f505ac77e5c54a229dedee39eae3ffe 100644 (file)
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 3
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
index ce3e39e9b7d2e938fcfc49a0a8f3c5be8cb5db6b..bc19dfc3010071ff39ef3cfe4922450611b13ff9 100644 (file)
@@ -1,5 +1,5 @@
 # absolute-header.m4 serial 16
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
index d7bdea631ff310b189b5c5e1f6a8946e3c448a85..8408bed2882a3eff189abc3c823f72b1076088cd 100644 (file)
@@ -1,5 +1,5 @@
 # alloca.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 69249449c663b0d7457898b4e9fec69e69b74757..fe1a5ab0bd5043c09b034d4d9daea1bcc2c64f47 100644 (file)
@@ -1,5 +1,5 @@
 # backupfile.m4 serial 14
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
index c003367bcf55905625a115b1e0669da5471a3dba..acfca7805051c6b9aa10b87f9824cd85a322b802 100644 (file)
@@ -1,6 +1,6 @@
 # serial 7
 
-# Copyright (C) 2002, 2005, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 2009-2015 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.
index ace45566142f83d7c2c6afe677c191772e2a3dfc..6d932fd1ab6cb7924ca5f586bbf890ca17be6e18 100644 (file)
@@ -1,6 +1,6 @@
 # canonicalize.m4 serial 26
 
-dnl Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/chdir-long.m4 b/m4/chdir-long.m4
new file mode 100644 (file)
index 0000000..1448583
--- /dev/null
@@ -0,0 +1,30 @@
+#serial 15
+
+# Use Gnulib's robust chdir function.
+# It can handle arbitrarily long directory names, which means
+# that when it is given the name of an existing directory, it
+# never fails with ENAMETOOLONG.
+# Arrange to compile chdir-long.c only on systems that define PATH_MAX.
+
+dnl Copyright (C) 2004-2007, 2009-2015 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 Jim Meyering.
+
+AC_DEFUN([gl_FUNC_CHDIR_LONG],
+[
+  AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
+  AC_CACHE_CHECK([whether this system has an arbitrary file name length limit],
+    gl_cv_have_arbitrary_file_name_length_limit,
+    [AC_EGREP_CPP([have_arbitrary_file_name_length_limit],
+                  gl_PATHMAX_SNIPPET[
+#ifdef PATH_MAX
+have_arbitrary_file_name_length_limit
+#endif],
+    gl_cv_have_arbitrary_file_name_length_limit=yes,
+    gl_cv_have_arbitrary_file_name_length_limit=no)])
+])
+
+AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:])
diff --git a/m4/chown.m4 b/m4/chown.m4
new file mode 100644 (file)
index 0000000..633ea3a
--- /dev/null
@@ -0,0 +1,204 @@
+# serial 27
+# Determine whether we need the chown wrapper.
+
+dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2015 Free Software
+dnl 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.
+
+# chown should accept arguments of -1 for uid and gid, and it should
+# dereference symlinks.  If it doesn't, arrange to use the replacement
+# function.
+
+# From Jim Meyering.
+
+m4_version_prereq([2.70], [] ,[
+
+# This is taken from the following Autoconf patch:
+# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([AC_FUNC_CHOWN],
+[
+  AC_REQUIRE([AC_TYPE_UID_T])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CHECK_HEADERS([unistd.h])
+  AC_CACHE_CHECK([for working chown],
+    [ac_cv_func_chown_works],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [AC_INCLUDES_DEFAULT
+           [#include <fcntl.h>
+          ]],
+          [[
+            char *f = "conftest.chown";
+            struct stat before, after;
+
+            if (creat (f, 0600) < 0)
+              return 1;
+            if (stat (f, &before) < 0)
+              return 1;
+            if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+              return 1;
+            if (stat (f, &after) < 0)
+              return 1;
+            return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+          ]])
+       ],
+       [ac_cv_func_chown_works=yes],
+       [ac_cv_func_chown_works=no],
+       [case "$host_os" in # ((
+                  # Guess yes on glibc systems.
+          *-gnu*) ac_cv_func_chown_works=yes ;;
+                  # If we don't know, assume the worst.
+          *)      ac_cv_func_chown_works=no ;;
+        esac
+       ])
+     rm -f conftest.chown
+    ])
+  if test $ac_cv_func_chown_works = yes; then
+    AC_DEFINE([HAVE_CHOWN], [1],
+      [Define to 1 if your system has a working `chown' function.])
+  fi
+])# AC_FUNC_CHOWN
+
+])
+
+AC_DEFUN_ONCE([gl_FUNC_CHOWN],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_TYPE_UID_T])
+  AC_REQUIRE([AC_FUNC_CHOWN])
+  AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([chown fchown])
+
+  dnl mingw lacks chown altogether.
+  if test $ac_cv_func_chown = no; then
+    HAVE_CHOWN=0
+  else
+    dnl Some old systems treated chown like lchown.
+    if test $gl_cv_func_chown_follows_symlink = no; then
+      REPLACE_CHOWN=1
+    fi
+
+    dnl Some old systems tried to use uid/gid -1 literally.
+    if test $ac_cv_func_chown_works = no; then
+      AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1],
+        [Define if chown is not POSIX compliant regarding IDs of -1.])
+      REPLACE_CHOWN=1
+    fi
+
+    dnl Solaris 9 ignores trailing slash.
+    dnl FreeBSD 7.2 mishandles trailing slash on symlinks.
+    dnl Likewise for AIX 7.1.
+    AC_CACHE_CHECK([whether chown honors trailing slash],
+      [gl_cv_func_chown_slash_works],
+      [touch conftest.file && rm -f conftest.link
+       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+]], [[    if (symlink ("conftest.file", "conftest.link")) return 1;
+          if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
+        ]])],
+        [gl_cv_func_chown_slash_works=yes],
+        [gl_cv_func_chown_slash_works=no],
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_chown_slash_works="guessing no" ;;
+         esac
+        ])
+      rm -f conftest.link conftest.file])
+    case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([CHOWN_TRAILING_SLASH_BUG], [1],
+          [Define to 1 if chown mishandles trailing slash.])
+        REPLACE_CHOWN=1
+        ;;
+    esac
+
+    dnl OpenBSD fails to update ctime if ownership does not change.
+    AC_CACHE_CHECK([whether chown always updates ctime],
+      [gl_cv_func_chown_ctime_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+]], [[    struct stat st1, st2;
+          if (close (creat ("conftest.file", 0600))) return 1;
+          if (stat ("conftest.file", &st1)) return 2;
+          sleep (1);
+          if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
+          if (stat ("conftest.file", &st2)) return 4;
+          if (st2.st_ctime <= st1.st_ctime) return 5;
+        ]])],
+        [gl_cv_func_chown_ctime_works=yes],
+        [gl_cv_func_chown_ctime_works=no],
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_chown_ctime_works="guessing no" ;;
+         esac
+        ])
+      rm -f conftest.file])
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([CHOWN_CHANGE_TIME_BUG], [1], [Define to 1 if chown fails
+          to change ctime when at least one argument was not -1.])
+        REPLACE_CHOWN=1
+        ;;
+    esac
+  fi
+])
+
+# Determine whether chown follows symlinks (it should).
+AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK],
+[
+  AC_CACHE_CHECK(
+    [whether chown dereferences symlinks],
+    [gl_cv_func_chown_follows_symlink],
+    [
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+        int
+        main ()
+        {
+          int result = 0;
+          char const *dangling_symlink = "conftest.dangle";
+
+          unlink (dangling_symlink);
+          if (symlink ("conftest.no-such", dangling_symlink))
+            abort ();
+
+          /* Exit successfully on a conforming system,
+             i.e., where chown must fail with ENOENT.  */
+          if (chown (dangling_symlink, getuid (), getgid ()) == 0)
+            result |= 1;
+          if (errno != ENOENT)
+            result |= 2;
+          return result;
+        }
+        ]])],
+        [gl_cv_func_chown_follows_symlink=yes],
+        [gl_cv_func_chown_follows_symlink=no],
+        [gl_cv_func_chown_follows_symlink=yes]
+      )
+    ]
+  )
+
+  if test $gl_cv_func_chown_follows_symlink = no; then
+    AC_DEFINE([CHOWN_MODIFIES_SYMLINK], [1],
+      [Define if chown modifies symlinks.])
+  fi
+])
index 6c4a637dc6281cb3373ddb8a888803ea985051ad..a903e582ea85e6634a3b79349cf153ae2fbbd802 100644 (file)
@@ -1,5 +1,5 @@
 # clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
index 68510c5c5212ed78324f9b0406e55409fd89c86d..d04aefbeebc73f1b4aded989737b50f20711d646 100644 (file)
@@ -1,5 +1,5 @@
 # close.m4 serial 8
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index d234a52239a90d7a49fffc722fae5620f01b47bf..a4403b4adbc5c43f8345516c135a0ca2f662390f 100644 (file)
@@ -1,5 +1,5 @@
 # closedir.m4 serial 2
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index d7de8d67e0d2c0a70dcdb911f6ac7893d2c3bca4..1c52ffc1be16d1e3408f085cb2d062b3779ef13b 100644 (file)
@@ -1,5 +1,5 @@
 # codeset.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2000-2002, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2006, 2008-2015 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.
index 0cd86cf99215ad40fef56e88b572c5ee3d00f795..49d3a13e36b208bdfdf429ac18c8a30402569aee 100644 (file)
@@ -1,5 +1,5 @@
 # configmake.m4 serial 2
-dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2015 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.
index 5ccb733c801f6407c6c4184d353bfaa18ae3cc27..aa9b24373f5b9d5e70b560412cf65fecb6b6772e 100644 (file)
@@ -5,7 +5,7 @@ dnl
 dnl Check whether struct dirent has a member named d_ino.
 dnl
 
-# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2014 Free Software
+# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2015 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
index 0a197fbcc13dcd480c8708e157603a0e4f13d407..200957507780598a4265696adeee6db7a7118b9c 100644 (file)
@@ -1,5 +1,5 @@
 #serial 2
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
index 3f2b16b1212adb86b21a0827e1a10b4f8f6eeddd..7abd1d05e1966d1bd27b18ffed78cbe87a50939a 100644 (file)
@@ -1,5 +1,5 @@
 # dirent_h.m4 serial 16
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index b422769484a560604bf101ce8fbf0117eaff466b..ce56cff6912a80d594f97835641647bb6aef8813 100644 (file)
@@ -2,7 +2,7 @@
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 
-# Copyright (C) 2001-2006, 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2006, 2008-2015 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.
index d2627b8a8ec4ac6420a691a810d4ed1e4e424f99..2a0be516e83e740305b6e1e693bbb72736128391 100644 (file)
@@ -1,5 +1,5 @@
 #serial 10   -*- autoconf -*-
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
index 937f4bca9a9991dd5a103d19e552421f9ae47823..f307eb2ffcfcc08d585ecc261d43c05d63b4d751 100644 (file)
@@ -1,5 +1,5 @@
 # double-slash-root.m4 serial 4   -*- Autoconf -*-
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2015 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.
index 6498fc202455d6e6369842146a48a1a23d8a835d..0354c6ad478fc65dcc3222a72ef739374cfc4a5c 100644 (file)
@@ -1,5 +1,5 @@
 #serial 20
-dnl Copyright (C) 2002, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2007, 2009-2015 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.
index 8a51fe7c55151468c5128940e429f973f7376749..322bdd50b419a7d14c8cdb5c6f77e9c942f45de1 100644 (file)
@@ -1,5 +1,5 @@
 # eealloc.m4 serial 3
-dnl Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2015 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.
index cfabe46f5674e9b8062cc244687c4231a6f114b2..4dbf9473e149ec1afdacb416f376f86c8144d63d 100644 (file)
@@ -1,5 +1,5 @@
 # environ.m4 serial 6
-dnl Copyright (C) 2001-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2015 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.
index 4ee9e6a14514e6987fa99ba9a29ed91df430cb0b..cfaa687615348895e0c4c38a7c7dfb662b2073ef 100644 (file)
@@ -1,5 +1,5 @@
 # errno_h.m4 serial 12
-dnl Copyright (C) 2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008-2015 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.
index f08ae50f3bfb86bfe9675760971d31e365004641..b3bd7f6c6ca1f56b5d00d061a947a8e5d8a415ca 100644 (file)
@@ -1,6 +1,6 @@
 #serial 14
 
-# Copyright (C) 1996-1998, 2001-2004, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998, 2001-2004, 2009-2015 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 7bee635716a6af8b4aeaccb49c19786a77a56cc5..84f1691a655730dd77c4b7300b4571c29fc0e726 100644 (file)
@@ -1,5 +1,5 @@
 # exponentd.m4 serial 3
-dnl Copyright (C) 2007-2008, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2008, 2010-2015 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.
index 37f55ca3d155220a09276b97984a456b99dccc45..35bc49c97bffdf361a23de1f3bb1da243d9d5038 100644 (file)
@@ -1,7 +1,7 @@
 # serial 13  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2015 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.
@@ -68,6 +68,10 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
+/* Use GNU style printf and scanf.  */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
 /* Enable threading extensions on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
@@ -100,6 +104,7 @@ dnl configure.ac when using autoheader 2.62.
   AC_DEFINE([_ALL_SOURCE])
   AC_DEFINE([_DARWIN_C_SOURCE])
   AC_DEFINE([_GNU_SOURCE])
+  AC_DEFINE([__USE_MINGW_ANSI_STDIO])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])
   AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
index 0edbe3c81c6f5f25420410f84a1ead33f1f3c9bc..e74339a165e0a78085d550a30a119ad012a1ca2e 100644 (file)
@@ -1,6 +1,6 @@
 dnl 'extern inline' a la ISO C99.
 
-dnl Copyright 2012-2014 Free Software Foundation, Inc.
+dnl Copyright 2012-2015 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.
diff --git a/m4/fchdir.m4 b/m4/fchdir.m4
new file mode 100644 (file)
index 0000000..3d2d97b
--- /dev/null
@@ -0,0 +1,61 @@
+# fchdir.m4 serial 21
+dnl Copyright (C) 2006-2015 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.
+
+AC_DEFUN([gl_FUNC_FCHDIR],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_DECLS_ONCE([fchdir])
+  if test $ac_cv_have_decl_fchdir = no; then
+    HAVE_DECL_FCHDIR=0
+  fi
+
+  AC_REQUIRE([gl_TEST_FCHDIR])
+  if test $HAVE_FCHDIR = 0; then
+    AC_LIBOBJ([fchdir])
+    gl_PREREQ_FCHDIR
+    AC_DEFINE([REPLACE_FCHDIR], [1],
+      [Define to 1 if gnulib's fchdir() replacement is used.])
+    dnl We must also replace anything that can manipulate a directory fd,
+    dnl to keep our bookkeeping up-to-date.  We don't have to replace
+    dnl fstatat, since no platform has fstatat but lacks fchdir.
+    AC_CACHE_CHECK([whether open can visit directories],
+      [gl_cv_func_open_directory_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
+]], [return open(".", O_RDONLY) < 0;])],
+        [gl_cv_func_open_directory_works=yes],
+        [gl_cv_func_open_directory_works=no],
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_open_directory_works="guessing no" ;;
+         esac
+        ])])
+    case "$gl_cv_func_open_directory_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
+work around the inability to open a directory.])
+        ;;
+    esac
+  fi
+])
+
+# Determine whether to use the overrides in lib/fchdir.c.
+AC_DEFUN([gl_TEST_FCHDIR],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fchdir])
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+])
+
+# Prerequisites of lib/fchdir.c.
+AC_DEFUN([gl_PREREQ_FCHDIR], [:])
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
new file mode 100644 (file)
index 0000000..b64ff5f
--- /dev/null
@@ -0,0 +1,17 @@
+# fchmodat.m4 serial 1
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+AC_DEFUN([gl_FUNC_FCHMODAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([fchmodat lchmod])
+  if test $ac_cv_func_fchmodat != yes; then
+    HAVE_FCHMODAT=0
+  fi
+])
diff --git a/m4/fchownat.m4 b/m4/fchownat.m4
new file mode 100644 (file)
index 0000000..f55d2d5
--- /dev/null
@@ -0,0 +1,108 @@
+# fchownat.m4 serial 1
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+# If we have the fchownat function, and it has the bug (in glibc-2.4)
+# that it dereferences symlinks even with AT_SYMLINK_NOFOLLOW, then
+# use the replacement function.
+# Also if the fchownat function, like chown, has the trailing slash bug,
+# use the replacement function.
+# Also use the replacement function if fchownat is simply not available.
+AC_DEFUN([gl_FUNC_FCHOWNAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_CHOWN])
+  AC_CHECK_FUNC([fchownat],
+    [gl_FUNC_FCHOWNAT_DEREF_BUG(
+       [REPLACE_FCHOWNAT=1
+        AC_DEFINE([FCHOWNAT_NOFOLLOW_BUG], [1],
+                  [Define to 1 if your platform has fchownat, but it cannot
+                   perform lchown tasks.])
+       ])
+     gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG(
+       [REPLACE_FCHOWNAT=1
+        AC_DEFINE([FCHOWNAT_EMPTY_FILENAME_BUG], [1],
+                  [Define to 1 if your platform has fchownat, but it does
+                   not reject an empty file name.])
+       ])
+     if test $REPLACE_CHOWN = 1; then
+       REPLACE_FCHOWNAT=1
+     fi],
+    [HAVE_FCHOWNAT=0])
+])
+
+# gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
+[
+  dnl Persuade glibc's <unistd.h> to declare fchownat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_CACHE_CHECK([whether fchownat works with AT_SYMLINK_NOFOLLOW],
+    gl_cv_func_fchownat_nofollow_works,
+    [
+     gl_dangle=conftest.dangle
+     # Remove any remnants of a previous test.
+     rm -f $gl_dangle
+     # Arrange for deletion of the temporary file this test creates.
+     ac_clean_files="$ac_clean_files $gl_dangle"
+     ln -s conftest.no-such $gl_dangle
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+          [[
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+  return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+                    AT_SYMLINK_NOFOLLOW) != 0
+          && errno == ENOENT);
+}
+          ]])],
+    [gl_cv_func_fchownat_nofollow_works=yes],
+    [gl_cv_func_fchownat_nofollow_works=no],
+    [gl_cv_func_fchownat_nofollow_works=no],
+    )
+  ])
+  AS_IF([test $gl_cv_func_fchownat_nofollow_works = no], [$1], [$2])
+])
+
+# gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
+[
+  dnl Persuade glibc's <unistd.h> to declare fchownat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_CACHE_CHECK([whether fchownat works with an empty file name],
+    [gl_cv_func_fchownat_empty_filename_works],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <unistd.h>
+            #include <fcntl.h>
+          ]],
+          [[int fd;
+            int ret;
+            if (mkdir ("conftestdir", 0700) < 0)
+              return 2;
+            fd = open ("conftestdir", O_RDONLY);
+            if (fd < 0)
+              return 3;
+            ret = fchownat (fd, "", -1, -1, 0);
+            close (fd);
+            rmdir ("conftestdir");
+            return ret == 0;
+          ]])],
+       [gl_cv_func_fchownat_empty_filename_works=yes],
+       [gl_cv_func_fchownat_empty_filename_works=no],
+       [gl_cv_func_fchownat_empty_filename_works="guessing no"])
+    ])
+  AS_IF([test "$gl_cv_func_fchownat_empty_filename_works" != yes], [$1], [$2])
+])
index 43c93124ed5874a66282ed01b365a4fcfb9c1632..891a62fb6a36a93332669c95235c6d1b383a1aff 100644 (file)
@@ -1,5 +1,5 @@
 # fcntl-o.m4 serial 4
-dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2015 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.
index f824beb659724b120d0b2670f10cbf0426362906..733cd2d701b2d1ee54271dad658b2d544861e515 100644 (file)
@@ -1,5 +1,5 @@
 # fcntl.m4 serial 5
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
index fb2556d37e3b21baa89eb35279963392df330ef1..b279162a17ce5c28901aeca6c33a6b9b98252a39 100644 (file)
@@ -1,6 +1,6 @@
 # serial 15
 # Configure fcntl.h.
-dnl Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2015 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.
diff --git a/m4/filenamecat.m4 b/m4/filenamecat.m4
new file mode 100644 (file)
index 0000000..bedb58d
--- /dev/null
@@ -0,0 +1,16 @@
+# filenamecat.m4 serial 11
+dnl Copyright (C) 2002-2006, 2009-2015 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.
+
+AC_DEFUN([gl_FILE_NAME_CONCAT],
+[
+  AC_REQUIRE([gl_FILE_NAME_CONCAT_LGPL])
+])
+
+AC_DEFUN([gl_FILE_NAME_CONCAT_LGPL],
+[
+  dnl Prerequisites of lib/filenamecat-lgpl.c.
+  AC_CHECK_FUNCS_ONCE([mempcpy])
+])
index a27ef7f9732e189400a944692857bc7389e7d63f..e4853f3b091aa699c8771d50511321bca0d87f83 100644 (file)
@@ -1,5 +1,5 @@
 # float_h.m4 serial 9
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
index ddd3fb976801d8f2bcbd02854d698b9a671aa960..d6a928827e1774cf28455a74c5abc9b41769140a 100644 (file)
@@ -1,5 +1,5 @@
 # fstat.m4 serial 4
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
new file mode 100644 (file)
index 0000000..e5f9f90
--- /dev/null
@@ -0,0 +1,60 @@
+# fstatat.m4 serial 3
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+# If we have the fstatat function, and it has the bug (in AIX 7.1)
+# that it does not fill in st_size correctly, use the replacement function.
+AC_DEFUN([gl_FUNC_FSTATAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([fstatat])
+
+  if test $ac_cv_func_fstatat = no; then
+    HAVE_FSTATAT=0
+  else
+    dnl Test for an AIX 7.1 bug; see
+    dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>.
+    AC_CACHE_CHECK([whether fstatat (..., 0) works],
+      [gl_cv_func_fstatat_zero_flag],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+            [[
+              #include <fcntl.h>
+              #include <sys/stat.h>
+              int
+              main (void)
+              {
+                struct stat a;
+                return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+              }
+            ]])],
+         [gl_cv_func_fstatat_zero_flag=yes],
+         [gl_cv_func_fstatat_zero_flag=no],
+         [case "$host_os" in
+            aix*) gl_cv_func_fstatat_zero_flag="guessing no";;
+            *)    gl_cv_func_fstatat_zero_flag="guessing yes";;
+          esac
+         ])
+      ])
+
+    case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+    *yes+*yes) ;;
+    *) REPLACE_FSTATAT=1
+       case $gl_cv_func_fstatat_zero_flag in
+       *yes)
+         AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1],
+           [Define to 1 if fstatat (..., 0) works.
+            For example, it does not work in AIX 7.1.])
+         ;;
+       esac
+       ;;
+    esac
+  fi
+])
diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
new file mode 100644 (file)
index 0000000..b9fbcec
--- /dev/null
@@ -0,0 +1,160 @@
+# getcwd.m4 - check for working getcwd that is compatible with glibc
+
+# Copyright (C) 2001, 2003-2007, 2009-2015 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.
+
+# Written by Paul Eggert.
+# serial 12
+
+AC_DEFUN([gl_FUNC_GETCWD_NULL],
+  [
+   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+   AC_CHECK_HEADERS_ONCE([unistd.h])
+   AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
+     [gl_cv_func_getcwd_null],
+     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#        if HAVE_UNISTD_H
+#         include <unistd.h>
+#        else /* on Windows with MSVC */
+#         include <direct.h>
+#        endif
+#        ifndef getcwd
+         char *getcwd ();
+#        endif
+]], [[
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* mingw cwd does not start with '/', but getcwd does allocate.
+   However, mingw fails to honor non-zero size.  */
+#else
+           if (chdir ("/") != 0)
+             return 1;
+           else
+             {
+               char *f = getcwd (NULL, 0);
+               if (! f)
+                 return 2;
+               if (f[0] != '/')
+                 return 3;
+               if (f[1] != '\0')
+                 return 4;
+               return 0;
+             }
+#endif
+         ]])],
+        [gl_cv_func_getcwd_null=yes],
+        [gl_cv_func_getcwd_null=no],
+        [[case "$host_os" in
+                     # Guess yes on glibc systems.
+            *-gnu*)  gl_cv_func_getcwd_null="guessing yes";;
+                     # Guess yes on Cygwin.
+            cygwin*) gl_cv_func_getcwd_null="guessing yes";;
+                     # If we don't know, assume the worst.
+            *)       gl_cv_func_getcwd_null="guessing no";;
+          esac
+        ]])])
+])
+
+AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
+[
+  AC_CACHE_CHECK([for getcwd with POSIX signature],
+    [gl_cv_func_getcwd_posix_signature],
+    [AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[#include <unistd.h>]],
+         [[extern
+           #ifdef __cplusplus
+           "C"
+           #endif
+           char *getcwd (char *, size_t);
+         ]])
+      ],
+      [gl_cv_func_getcwd_posix_signature=yes],
+      [gl_cv_func_getcwd_posix_signature=no])
+   ])
+])
+
+dnl Guarantee that getcwd will malloc with a NULL first argument.  Assumes
+dnl that either the system getcwd is robust, or that calling code is okay
+dnl with spurious failures when run from a directory with an absolute name
+dnl larger than 4k bytes.
+dnl
+dnl Assumes that getcwd exists; if you are worried about obsolete
+dnl platforms that lacked getcwd(), then you need to use the GPL module.
+AC_DEFUN([gl_FUNC_GETCWD_LGPL],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+
+  case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+  *yes,yes) ;;
+  *)
+    dnl Minimal replacement lib/getcwd-lgpl.c.
+    REPLACE_GETCWD=1
+    ;;
+  esac
+])
+
+dnl Check for all known getcwd bugs; useful for a program likely to be
+dnl executed from an arbitrary location.
+AC_DEFUN([gl_FUNC_GETCWD],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  gl_abort_bug=no
+  case "$host_os" in
+    mingw*)
+      gl_cv_func_getcwd_path_max=yes
+      ;;
+    *)
+      gl_FUNC_GETCWD_PATH_MAX
+      case "$gl_cv_func_getcwd_null" in
+        *yes)
+          gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
+          ;;
+      esac
+      ;;
+  esac
+  dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
+  dnl if appropriate.
+  case "$gl_cv_func_getcwd_path_max" in
+    "no"|"no, it has the AIX bug") ;;
+    *)
+      AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd minimally works, that is, its result can be
+         trusted when it succeeds.])
+      ;;
+  esac
+  case "$gl_cv_func_getcwd_path_max" in
+    "no, but it is partly working")
+      AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd works, except it sometimes fails when it
+         shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
+      ;;
+    "yes, but with shorter paths")
+      AC_DEFINE([HAVE_GETCWD_SHORTER], [1],
+        [Define to 1 if getcwd works, but with shorter paths
+         than is generally tested with the replacement.])
+      ;;
+  esac
+
+  if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \
+     || test $gl_cv_func_getcwd_posix_signature != yes \
+     || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \
+     || test $gl_abort_bug = yes; then
+    REPLACE_GETCWD=1
+  fi
+])
+
+# Prerequisites of lib/getcwd.c, when full replacement is in effect.
+AC_DEFUN([gl_PREREQ_GETCWD],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
+  :
+])
index aa523b63d7bf0e97f530d4d3952ac85ce59e7ae5..a6b6c1b6c52c671e18619b555a6ced64767bb7ed 100644 (file)
@@ -1,5 +1,5 @@
 # getdtablesize.m4 serial 5
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index f127028f9486e18c471eb628e4e9cd42555c46e8..e76e501fdd6d6a459199eba4fcb5a17199129e60 100644 (file)
@@ -1,5 +1,5 @@
 # getopt.m4 serial 44
-dnl Copyright (C) 2002-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2015 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.
index c5ec2643917e7dbeef0ec084347c4352ecdea0ef..cd499ff5d79c956445886e58d018d0f731c6fa83 100644 (file)
@@ -1,5 +1,5 @@
 # gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2006, 2009-2015 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.
index 1c2d66ee261f90b739ea3efce59529a08cfeb817..ce246e18bc2b7d452c19d56818f4527abd7f07f1 100644 (file)
@@ -1,6 +1,6 @@
 # serial 21
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 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.
index ab58b712137677e1f8aafd8ee561dad5ffac77aa..3a971c5a240f82b560815d9a1ffd52c1bdca46fa 100644 (file)
@@ -1,5 +1,5 @@
 # glibc21.m4 serial 5
-dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2014 Free Software Foundation,
+dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 31e5f9499e0064d548b899ec0848fa552bedd22c..b301abeda055ac020108463dce6e22e9bf281e08 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-common.m4 serial 36
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
index 0aa4db8b2d1d07013394b89185a79c2c7868bb99..00de6add3aeb2a8ce779d504bd6f2775d943b189 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -41,6 +41,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module absolute-header:
   # Code from module alloca-opt:
   # Code from module argmatch:
+  # Code from module assure:
+  # Code from module at-internal:
   # Code from module backupfile:
   # Code from module bitrotate:
   # Code from module c-ctype:
@@ -48,7 +50,10 @@ AC_DEFUN([gl_EARLY],
   # Code from module c-strcaseeq:
   # Code from module canonicalize-lgpl:
   # Code from module chdir:
+  # Code from module chdir-long:
+  # Code from module chown:
   # Code from module clock-time:
+  # Code from module cloexec:
   # Code from module close:
   # Code from module closedir:
   # Code from module configmake:
@@ -69,13 +74,19 @@ AC_DEFUN([gl_EARLY],
   # Code from module extensions:
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   # Code from module extern-inline:
+  # Code from module fchdir:
+  # Code from module fchmodat:
+  # Code from module fchownat:
   # Code from module fcntl:
   # Code from module fcntl-h:
   # Code from module fd-hook:
   # Code from module filename:
+  # Code from module filenamecat-lgpl:
   # Code from module float:
   # Code from module fstat:
+  # Code from module fstatat:
   # Code from module full-write:
+  # Code from module getcwd-lgpl:
   # Code from module getdate:
   # Code from module getdtablesize:
   # Code from module getopt-gnu:
@@ -92,7 +103,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module intprops:
   # Code from module largefile:
   AC_REQUIRE([AC_SYS_LARGEFILE])
-  # Code from module lchmod:
+  # Code from module lchown:
   # Code from module linked-list:
   # Code from module list:
   # Code from module localcharset:
@@ -106,13 +117,20 @@ AC_DEFUN([gl_EARLY],
   # Code from module mbrtowc:
   # Code from module mbsinit:
   # Code from module memchr:
+  # Code from module mempcpy:
+  # Code from module memrchr:
   # Code from module minmax:
   # Code from module mkdir:
+  # Code from module mkdirat:
   # Code from module mktime:
   # Code from module msvc-inval:
   # Code from module msvc-nothrow:
   # Code from module multiarch:
   # Code from module nocrash:
+  # Code from module open:
+  # Code from module openat:
+  # Code from module openat-die:
+  # Code from module openat-h:
   # Code from module opendir:
   # Code from module parse-datetime:
   # Code from module pathmax:
@@ -123,13 +141,16 @@ AC_DEFUN([gl_EARLY],
   # Code from module raise:
   # Code from module readdir:
   # Code from module readlink:
+  # Code from module readlinkat:
   # Code from module realloc:
   # Code from module realloc-gnu:
   # Code from module realloc-posix:
   # Code from module rename:
+  # Code from module renameat:
   # Code from module rmdir:
   # Code from module safe-write:
   # Code from module same-inode:
+  # Code from module save-cwd:
   # Code from module secure_getenv:
   # Code from module setenv:
   # Code from module signal:
@@ -142,6 +163,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module ssize_t:
   # Code from module stat:
   # Code from module stat-time:
+  # Code from module statat:
   # Code from module stdarg:
   dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
   dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
@@ -153,6 +175,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module stdint:
   # Code from module stdio:
   # Code from module stdlib:
+  # Code from module strdup-posix:
   # Code from module streq:
   # Code from module strerror:
   # Code from module strerror-override:
@@ -160,6 +183,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module strndup:
   # Code from module strnlen:
   # Code from module symlink:
+  # Code from module symlinkat:
   # Code from module sys_stat:
   # Code from module sys_time:
   # Code from module sys_types:
@@ -170,10 +194,12 @@ AC_DEFUN([gl_EARLY],
   # Code from module unistd:
   # Code from module unistd-safer:
   # Code from module unlink:
+  # Code from module unlinkat:
   # Code from module unsetenv:
   # Code from module update-copyright:
   # Code from module useless-if-before-free:
   # Code from module utimens:
+  # Code from module utimensat:
   # Code from module vasnprintf:
   # Code from module vasprintf:
   # Code from module vc-list-files:
@@ -210,6 +236,7 @@ AC_DEFUN([gl_INIT],
   gl_COMMON
   gl_source_base='lib'
   gl_FUNC_ALLOCA
+  AC_LIBOBJ([openat-proc])
   gl_BACKUPFILE
   gl_CANONICALIZE_LGPL
   if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
@@ -219,7 +246,21 @@ AC_DEFUN([gl_INIT],
   gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
   gl_STDLIB_MODULE_INDICATOR([realpath])
   gl_UNISTD_MODULE_INDICATOR([chdir])
+  gl_FUNC_CHDIR_LONG
+  if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then
+    AC_LIBOBJ([chdir-long])
+    gl_PREREQ_CHDIR_LONG
+  fi
+  gl_FUNC_CHOWN
+  if test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1; then
+    AC_LIBOBJ([chown])
+  fi
+  if test $REPLACE_CHOWN = 1 && test $ac_cv_func_fchown = no; then
+    AC_LIBOBJ([fchown-stub])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([chown])
   gl_CLOCK_TIME
+  gl_MODULE_INDICATOR_FOR_TESTS([cloexec])
   gl_FUNC_CLOSE
   if test $REPLACE_CLOSE = 1; then
     AC_LIBOBJ([close])
@@ -263,12 +304,27 @@ AC_DEFUN([gl_INIT],
     [AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
      AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
   AC_REQUIRE([gl_EXTERN_INLINE])
+  gl_FUNC_FCHDIR
+  gl_UNISTD_MODULE_INDICATOR([fchdir])
+  gl_FUNC_FCHMODAT
+  if test $HAVE_FCHMODAT = 0; then
+    AC_LIBOBJ([fchmodat])
+  fi
+  gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
+  gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
+  gl_FUNC_FCHOWNAT
+  if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
+    AC_LIBOBJ([fchownat])
+  fi
+  gl_MODULE_INDICATOR([fchownat]) dnl for lib/openat.h
+  gl_UNISTD_MODULE_INDICATOR([fchownat])
   gl_FUNC_FCNTL
   if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
     AC_LIBOBJ([fcntl])
   fi
   gl_FCNTL_MODULE_INDICATOR([fcntl])
   gl_FCNTL_H
+  gl_FILE_NAME_CONCAT_LGPL
   gl_FLOAT_H
   if test $REPLACE_FLOAT_LDBL = 1; then
     AC_LIBOBJ([float])
@@ -282,6 +338,16 @@ AC_DEFUN([gl_INIT],
     gl_PREREQ_FSTAT
   fi
   gl_SYS_STAT_MODULE_INDICATOR([fstat])
+  gl_FUNC_FSTATAT
+  if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
+    AC_LIBOBJ([fstatat])
+  fi
+  gl_SYS_STAT_MODULE_INDICATOR([fstatat])
+  gl_FUNC_GETCWD_LGPL
+  if test $REPLACE_GETCWD = 1; then
+    AC_LIBOBJ([getcwd-lgpl])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([getcwd])
   gl_FUNC_GETDTABLESIZE
   if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then
     AC_LIBOBJ([getdtablesize])
@@ -327,8 +393,11 @@ AC_DEFUN([gl_INIT],
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
           [GNUmakefile=$GNUmakefile])])
   AC_REQUIRE([gl_LARGEFILE])
-  gl_FUNC_LCHMOD
-  gl_SYS_STAT_MODULE_INDICATOR([lchmod])
+  gl_FUNC_LCHOWN
+  if test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1; then
+    AC_LIBOBJ([lchown])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([lchown])
   gl_LOCALCHARSET
   LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
   AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
@@ -370,11 +439,29 @@ AC_DEFUN([gl_INIT],
     gl_PREREQ_MEMCHR
   fi
   gl_STRING_MODULE_INDICATOR([memchr])
+  gl_FUNC_MEMPCPY
+  if test $HAVE_MEMPCPY = 0; then
+    AC_LIBOBJ([mempcpy])
+    gl_PREREQ_MEMPCPY
+  fi
+  gl_STRING_MODULE_INDICATOR([mempcpy])
+  gl_FUNC_MEMRCHR
+  if test $ac_cv_func_memrchr = no; then
+    AC_LIBOBJ([memrchr])
+    gl_PREREQ_MEMRCHR
+  fi
+  gl_STRING_MODULE_INDICATOR([memrchr])
   gl_MINMAX
   gl_FUNC_MKDIR
   if test $REPLACE_MKDIR = 1; then
     AC_LIBOBJ([mkdir])
   fi
+  gl_FUNC_MKDIRAT
+  if test $HAVE_MKDIRAT = 0; then
+    AC_LIBOBJ([mkdirat])
+    gl_PREREQ_MKDIRAT
+  fi
+  gl_SYS_STAT_MODULE_INDICATOR([mkdirat])
   gl_FUNC_MKTIME
   if test $REPLACE_MKTIME = 1; then
     AC_LIBOBJ([mktime])
@@ -390,6 +477,19 @@ AC_DEFUN([gl_INIT],
     AC_LIBOBJ([msvc-nothrow])
   fi
   gl_MULTIARCH
+  gl_FUNC_OPEN
+  if test $REPLACE_OPEN = 1; then
+    AC_LIBOBJ([open])
+    gl_PREREQ_OPEN
+  fi
+  gl_FCNTL_MODULE_INDICATOR([open])
+  gl_FUNC_OPENAT
+  if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
+    AC_LIBOBJ([openat])
+    gl_PREREQ_OPENAT
+  fi
+  gl_MODULE_INDICATOR([openat]) dnl for lib/getcwd.c
+  gl_FCNTL_MODULE_INDICATOR([openat])
   gl_FUNC_OPENDIR
   if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then
     AC_LIBOBJ([opendir])
@@ -418,6 +518,11 @@ AC_DEFUN([gl_INIT],
     gl_PREREQ_READLINK
   fi
   gl_UNISTD_MODULE_INDICATOR([readlink])
+  gl_FUNC_READLINKAT
+  if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
+    AC_LIBOBJ([readlinkat])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([readlinkat])
   gl_FUNC_REALLOC_GNU
   if test $REPLACE_REALLOC = 1; then
     AC_LIBOBJ([realloc])
@@ -433,12 +538,21 @@ AC_DEFUN([gl_INIT],
     AC_LIBOBJ([rename])
   fi
   gl_STDIO_MODULE_INDICATOR([rename])
+  gl_FUNC_RENAMEAT
+  if test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1; then
+    AC_LIBOBJ([renameat])
+  fi
+  if test $HAVE_RENAMEAT = 0; then
+    AC_LIBOBJ([at-func2])
+  fi
+  gl_STDIO_MODULE_INDICATOR([renameat])
   gl_FUNC_RMDIR
   if test $REPLACE_RMDIR = 1; then
     AC_LIBOBJ([rmdir])
   fi
   gl_UNISTD_MODULE_INDICATOR([rmdir])
   gl_PREREQ_SAFE_WRITE
+  gl_SAVE_CWD
   gl_FUNC_SECURE_GETENV
   if test $HAVE_SECURE_GETENV = 0; then
     AC_LIBOBJ([secure_getenv])
@@ -461,12 +575,19 @@ AC_DEFUN([gl_INIT],
   gl_SYS_STAT_MODULE_INDICATOR([stat])
   gl_STAT_TIME
   gl_STAT_BIRTHTIME
+  gl_MODULE_INDICATOR([statat]) dnl for lib/openat.h
   gl_STDARG_H
   AM_STDBOOL_H
   gl_STDDEF_H
   gl_STDINT_H
   gl_STDIO_H
   gl_STDLIB_H
+  gl_FUNC_STRDUP_POSIX
+  if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+    AC_LIBOBJ([strdup])
+    gl_PREREQ_STRDUP
+  fi
+  gl_STRING_MODULE_INDICATOR([strdup])
   gl_FUNC_STRERROR
   if test $REPLACE_STRERROR = 1; then
     AC_LIBOBJ([strerror])
@@ -496,6 +617,11 @@ AC_DEFUN([gl_INIT],
     AC_LIBOBJ([symlink])
   fi
   gl_UNISTD_MODULE_INDICATOR([symlink])
+  gl_FUNC_SYMLINKAT
+  if test $HAVE_SYMLINKAT = 0 || test $REPLACE_SYMLINKAT = 1; then
+    AC_LIBOBJ([symlinkat])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([symlinkat])
   gl_HEADER_SYS_STAT_H
   AC_PROG_MKDIR_P
   gl_HEADER_SYS_TIME_H
@@ -518,6 +644,11 @@ AC_DEFUN([gl_INIT],
     AC_LIBOBJ([unlink])
   fi
   gl_UNISTD_MODULE_INDICATOR([unlink])
+  gl_FUNC_UNLINKAT
+  if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+    AC_LIBOBJ([unlinkat])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([unlinkat])
   gl_FUNC_UNSETENV
   if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
     AC_LIBOBJ([unsetenv])
@@ -525,6 +656,11 @@ AC_DEFUN([gl_INIT],
   fi
   gl_STDLIB_MODULE_INDICATOR([unsetenv])
   gl_UTIMENS
+  gl_FUNC_UTIMENSAT
+  if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then
+    AC_LIBOBJ([utimensat])
+  fi
+  gl_SYS_STAT_MODULE_INDICATOR([utimensat])
   gl_FUNC_VASNPRINTF
   gl_FUNC_VASPRINTF
   gl_STDIO_MODULE_INDICATOR([vasprintf])
@@ -705,6 +841,9 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/argmatch.h
   lib/asnprintf.c
   lib/asprintf.c
+  lib/assure.h
+  lib/at-func.c
+  lib/at-func2.c
   lib/backupfile.c
   lib/backupfile.h
   lib/basename-lgpl.c
@@ -718,6 +857,13 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/c-strcaseeq.h
   lib/c-strncasecmp.c
   lib/canonicalize-lgpl.c
+  lib/chdir-long.c
+  lib/chdir-long.h
+  lib/chmodat.c
+  lib/chown.c
+  lib/chownat.c
+  lib/cloexec.c
+  lib/cloexec.h
   lib/close.c
   lib/closedir.c
   lib/config.charset
@@ -738,18 +884,26 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/error.h
   lib/exitfail.c
   lib/exitfail.h
+  lib/fchdir.c
+  lib/fchmodat.c
+  lib/fchown-stub.c
+  lib/fchownat.c
   lib/fcntl.c
   lib/fcntl.in.h
   lib/fd-hook.c
   lib/fd-hook.h
   lib/fd-safer.c
   lib/filename.h
+  lib/filenamecat-lgpl.c
+  lib/filenamecat.h
   lib/float+.h
   lib/float.c
   lib/float.in.h
   lib/fstat.c
+  lib/fstatat.c
   lib/full-write.c
   lib/full-write.h
+  lib/getcwd-lgpl.c
   lib/getdate.h
   lib/getdtablesize.c
   lib/getopt.c
@@ -772,6 +926,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/ignore-value.h
   lib/intprops.h
   lib/itold.c
+  lib/lchown.c
   lib/localcharset.c
   lib/localcharset.h
   lib/lstat.c
@@ -783,14 +938,23 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/mbsinit.c
   lib/memchr.c
   lib/memchr.valgrind
+  lib/mempcpy.c
+  lib/memrchr.c
   lib/minmax.h
   lib/mkdir.c
+  lib/mkdirat.c
   lib/mktime-internal.h
   lib/mktime.c
   lib/msvc-inval.c
   lib/msvc-inval.h
   lib/msvc-nothrow.c
   lib/msvc-nothrow.h
+  lib/open.c
+  lib/openat-die.c
+  lib/openat-priv.h
+  lib/openat-proc.c
+  lib/openat.c
+  lib/openat.h
   lib/opendir-safer.c
   lib/opendir.c
   lib/parse-datetime.h
@@ -809,15 +973,19 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/raise.c
   lib/readdir.c
   lib/readlink.c
+  lib/readlinkat.c
   lib/realloc.c
   lib/ref-add.sin
   lib/ref-del.sin
   lib/rename.c
+  lib/renameat.c
   lib/rmdir.c
   lib/safe-read.c
   lib/safe-write.c
   lib/safe-write.h
   lib/same-inode.h
+  lib/save-cwd.c
+  lib/save-cwd.h
   lib/secure_getenv.c
   lib/setenv.c
   lib/signal.in.h
@@ -825,12 +993,14 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/stat-time.c
   lib/stat-time.h
   lib/stat.c
+  lib/statat.c
   lib/stdarg.in.h
   lib/stdbool.in.h
   lib/stddef.in.h
   lib/stdint.in.h
   lib/stdio.in.h
   lib/stdlib.in.h
+  lib/strdup.c
   lib/streq.h
   lib/strerror-override.c
   lib/strerror-override.h
@@ -840,6 +1010,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/strndup.c
   lib/strnlen.c
   lib/symlink.c
+  lib/symlinkat.c
   lib/sys_stat.in.h
   lib/sys_time.in.h
   lib/sys_types.in.h
@@ -854,9 +1025,11 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/unistd.c
   lib/unistd.in.h
   lib/unlink.c
+  lib/unlinkat.c
   lib/unsetenv.c
   lib/utimens.c
   lib/utimens.h
+  lib/utimensat.c
   lib/vasnprintf.c
   lib/vasnprintf.h
   lib/vasprintf.c
@@ -886,6 +1059,8 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/backupfile.m4
   m4/bison.m4
   m4/canonicalize.m4
+  m4/chdir-long.m4
+  m4/chown.m4
   m4/clock_time.m4
   m4/close.m4
   m4/closedir.m4
@@ -905,11 +1080,17 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/exponentd.m4
   m4/extensions.m4
   m4/extern-inline.m4
+  m4/fchdir.m4
+  m4/fchmodat.m4
+  m4/fchownat.m4
   m4/fcntl-o.m4
   m4/fcntl.m4
   m4/fcntl_h.m4
+  m4/filenamecat.m4
   m4/float_h.m4
   m4/fstat.m4
+  m4/fstatat.m4
+  m4/getcwd.m4
   m4/getdtablesize.m4
   m4/getopt.m4
   m4/gettime.m4
@@ -920,7 +1101,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/intmax_t.m4
   m4/inttypes_h.m4
   m4/largefile.m4
-  m4/lchmod.m4
+  m4/lchown.m4
   m4/localcharset.m4
   m4/locale-fr.m4
   m4/locale-ja.m4
@@ -935,15 +1116,21 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/mbsinit.m4
   m4/mbstate_t.m4
   m4/memchr.m4
+  m4/mempcpy.m4
+  m4/memrchr.m4
   m4/minmax.m4
   m4/mkdir.m4
+  m4/mkdirat.m4
   m4/mktime.m4
   m4/mmap-anon.m4
+  m4/mode_t.m4
   m4/msvc-inval.m4
   m4/msvc-nothrow.m4
   m4/multiarch.m4
   m4/nocrash.m4
   m4/off_t.m4
+  m4/open.m4
+  m4/openat.m4
   m4/opendir.m4
   m4/parse-datetime.m4
   m4/pathmax.m4
@@ -953,11 +1140,14 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/raise.m4
   m4/readdir.m4
   m4/readlink.m4
+  m4/readlinkat.m4
   m4/realloc.m4
   m4/rename.m4
+  m4/renameat.m4
   m4/rmdir.m4
   m4/safe-read.m4
   m4/safe-write.m4
+  m4/save-cwd.m4
   m4/secure_getenv.m4
   m4/setenv.m4
   m4/signal_h.m4
@@ -972,11 +1162,13 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/stdint_h.m4
   m4/stdio_h.m4
   m4/stdlib_h.m4
+  m4/strdup.m4
   m4/strerror.m4
   m4/string_h.m4
   m4/strndup.m4
   m4/strnlen.m4
   m4/symlink.m4
+  m4/symlinkat.m4
   m4/sys_socket_h.m4
   m4/sys_stat_h.m4
   m4/sys_time_h.m4
@@ -989,8 +1181,10 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/unistd-safer.m4
   m4/unistd_h.m4
   m4/unlink.m4
+  m4/unlinkat.m4
   m4/utimbuf.m4
   m4/utimens.m4
+  m4/utimensat.m4
   m4/utimes.m4
   m4/vasnprintf.m4
   m4/vasprintf.m4
index 69ad3dbb0f736436fa9a39c3445ff5a30af04ff2..233d254e808ded18d19b5c6937bcea8fac95608c 100644 (file)
@@ -1,5 +1,5 @@
 # include_next.m4 serial 23
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
index af5561e5d483432e7ee24fe3305de769fd0df0d3..4bd8155c83d5151fe2860f51565a548d9bc9fc93 100644 (file)
@@ -1,5 +1,5 @@
 # intmax_t.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 87be9cfb560a4ccf09b45f8a0aa3db8fb477255f..d0b5f5d98298824228a36d63943c26c4733c3672 100644 (file)
@@ -1,5 +1,5 @@
 # inttypes_h.m4 serial 10
-dnl Copyright (C) 1997-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2015 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.
index a1b564ad9afbc598da1ce9e57b8feca53f16f497..b7a6c48b68020f876a2fbaee3ecf2197421dc8c2 100644 (file)
@@ -1,6 +1,6 @@
 # Enable large files on systems where this is not the default.
 
-# Copyright 1992-1996, 1998-2014 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2015 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.
diff --git a/m4/lchmod.m4 b/m4/lchmod.m4
deleted file mode 100644 (file)
index f227e78..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#serial 3
-
-dnl Copyright (C) 2005-2006, 2008-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.
-
-dnl From Paul Eggert.
-dnl Provide a replacement for lchmod on hosts that lack it.
-
-AC_DEFUN([gl_FUNC_LCHMOD],
-[
-  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-
-  dnl Persuade glibc <sys/stat.h> to declare lchmod().
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
-  AC_CHECK_FUNCS_ONCE([lchmod])
-  if test $ac_cv_func_lchmod = no; then
-    HAVE_LCHMOD=0
-  fi
-])
diff --git a/m4/lchown.m4 b/m4/lchown.m4
new file mode 100644 (file)
index 0000000..e47b779
--- /dev/null
@@ -0,0 +1,38 @@
+# serial 17
+# Determine whether we need the lchown wrapper.
+
+dnl Copyright (C) 1998, 2001, 2003-2007, 2009-2015 Free Software Foundation,
+dnl 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.
+
+dnl From Jim Meyering.
+dnl Provide lchown on systems that lack it, and work around bugs
+dnl on systems that have it.
+
+AC_DEFUN([gl_FUNC_LCHOWN],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_CHOWN])
+  AC_CHECK_FUNCS_ONCE([lchmod])
+  AC_CHECK_FUNCS([lchown])
+  if test $ac_cv_func_lchown = no; then
+    HAVE_LCHOWN=0
+  else
+    dnl Trailing slash and ctime bugs in chown also occur in lchown.
+    case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
+  fi
+])
index ada2f01f6f75fa767b8fd09db47d2d6e731f7639..f03916c024e0800b364692b78d7bf9d11fc08caa 100644 (file)
@@ -1,5 +1,5 @@
 # localcharset.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2009-2015 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.
index 27db5ab87ef0ad630bb27ee421878c6d5921d289..92ff55250edbf4c22d003e8aee5d4fecee6d6998 100644 (file)
@@ -1,5 +1,5 @@
 # locale-fr.m4 serial 17
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
index c88fe8b4e59d58bfbc4769dfee813605ada7d15c..a3abef87773352ca6f88457f1072533dbb57f981 100644 (file)
@@ -1,5 +1,5 @@
 # locale-ja.m4 serial 12
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
index d3b23474208c49006ae15034f5cd7c7b4418cbad..c5c4ef6592812ae2bb20968a4b6c79c438c56d99 100644 (file)
@@ -1,5 +1,5 @@
 # locale-zh.m4 serial 12
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
index eefb37c455eba6d20963c8756825ae243a0d0fa8..d57bc700d4f5c5bacbc6bda57798073913c93c9e 100644 (file)
@@ -1,5 +1,5 @@
 # longlong.m4 serial 17
-dnl Copyright (C) 1999-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2007, 2009-2015 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.
index c5e72b81e824f4a84378145699b6a2968973f591..f6c7dd1ce449b99c68d73cd87e51ec70a06665ed 100644 (file)
@@ -1,6 +1,6 @@
 # serial 26
 
-# Copyright (C) 1997-2001, 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2015 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 322ad6effe81a598f0fcb69edda846b074df0feb..31368ab97fbc790d2b269a667e112002fcad129d 100644 (file)
@@ -1,5 +1,5 @@
 # malloc.m4 serial 14
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
index dcc1a0843e94a586e3c121aeffefbaf606a6b0a0..72489517460d3fa65ee67fb0d7ea76fe2aefc426 100644 (file)
@@ -1,5 +1,5 @@
 # malloca.m4 serial 1
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 3e6dd215ced4b4cec993d84d60f428da4fe3205b..44da98e38daf981525e88d802e8bb04fd3f22133 100644 (file)
@@ -1,5 +1,5 @@
 # manywarnings.m4 serial 7
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index 45696f54f6930b180bbe97bd479716982cd5b128..c0d751dc84e3a304c52e2b9c56dc123d1182ef46 100644 (file)
@@ -1,5 +1,5 @@
 # mbrtowc.m4 serial 26
-dnl Copyright (C) 2001-2002, 2004-2005, 2008-2014 Free Software Foundation,
+dnl Copyright (C) 2001-2002, 2004-2005, 2008-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index e1598a1d7c62c4e4548026fc8f46fb5f0d59d10d..61c40329021e95777884776cb52a3d940dd385f9 100644 (file)
@@ -1,5 +1,5 @@
 # mbsinit.m4 serial 8
-dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2010-2015 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.
index 068155a52c323a2abfd759068086eded3dffc413..42ad6cd632ef7ddc8fcf910add7823dda1702cf1 100644 (file)
@@ -1,5 +1,5 @@
 # mbstate_t.m4 serial 13
-dnl Copyright (C) 2000-2002, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2008-2015 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.
index b9f126cfad484e80f4dd72652c91bb604cf6183e..cb958d86268913758b1f1f2bb2560b1cabfa6b01 100644 (file)
@@ -1,5 +1,5 @@
 # memchr.m4 serial 12
-dnl Copyright (C) 2002-2004, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2015 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.
diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4
new file mode 100644 (file)
index 0000000..aff590e
--- /dev/null
@@ -0,0 +1,26 @@
+# mempcpy.m4 serial 11
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2015 Free Software Foundation,
+dnl 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.
+
+AC_DEFUN([gl_FUNC_MEMPCPY],
+[
+  dnl Persuade glibc <string.h> to declare mempcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS([mempcpy])
+  if test $ac_cv_func_mempcpy = no; then
+    HAVE_MEMPCPY=0
+  fi
+])
+
+# Prerequisites of lib/mempcpy.c.
+AC_DEFUN([gl_PREREQ_MEMPCPY], [
+  :
+])
diff --git a/m4/memrchr.m4 b/m4/memrchr.m4
new file mode 100644 (file)
index 0000000..f3f74b8
--- /dev/null
@@ -0,0 +1,23 @@
+# memrchr.m4 serial 10
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
+dnl 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.
+
+AC_DEFUN([gl_FUNC_MEMRCHR],
+[
+  dnl Persuade glibc <string.h> to declare memrchr().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([memrchr])
+  if test $ac_cv_have_decl_memrchr = no; then
+    HAVE_DECL_MEMRCHR=0
+  fi
+
+  AC_CHECK_FUNCS([memrchr])
+])
+
+# Prerequisites of lib/memrchr.c.
+AC_DEFUN([gl_PREREQ_MEMRCHR], [:])
index edbeb439cef03a62f9aeae0b01990b2fee25df5a..0df832c8337e539f3e005661d077374d1738221a 100644 (file)
@@ -1,5 +1,5 @@
 # minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2015 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.
index 51e78c13dbcb5d8ca30ba75e680f5b07f9758644..3d9868df136a02d814c44d1cbfc8b3bb377a0542 100644 (file)
@@ -1,6 +1,6 @@
 # serial 11
 
-# Copyright (C) 2001, 2003-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003-2004, 2006, 2008-2015 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.
diff --git a/m4/mkdirat.m4 b/m4/mkdirat.m4
new file mode 100644 (file)
index 0000000..0780b2b
--- /dev/null
@@ -0,0 +1,23 @@
+# mkdirat.m4 serial 1
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+AC_DEFUN([gl_FUNC_MKDIRAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([mkdirat])
+  if test $ac_cv_func_mkdirat != yes; then
+    HAVE_MKDIRAT=0
+  fi
+])
+
+# Prerequisite of mkdirat's declaration and of lib/mkdirat.c.
+AC_DEFUN([gl_PREREQ_MKDIRAT],
+[
+  AC_REQUIRE([AC_TYPE_MODE_T])
+])
index e8d340ac0957515bc8d878d5dda02bcf4b0f9777..3f0e1eee44082fab2bf9eeeb2066a18012d55159 100644 (file)
@@ -1,5 +1,5 @@
 # serial 25
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 94ae2e2f21894445f3f499c284dde0533b25782c..92a88d05fb0fe1dffc21c81ca4f876a0a65151c8 100644 (file)
@@ -1,5 +1,5 @@
 # mmap-anon.m4 serial 10
-dnl Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2015 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.
diff --git a/m4/mode_t.m4 b/m4/mode_t.m4
new file mode 100644 (file)
index 0000000..01badba
--- /dev/null
@@ -0,0 +1,26 @@
+# mode_t.m4 serial 2
+dnl Copyright (C) 2009-2015 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.
+
+# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
+# include <sys/types.h>.
+
+# Define PROMOTED_MODE_T to the type that is the result of "default argument
+# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
+AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
+[
+  AC_REQUIRE([AC_TYPE_MODE_T])
+  AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
+    dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
+    dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
+    dnl standard, but we don't know of any real-world counterexamples.
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
+      [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
+      [gl_cv_promoted_mode_t='int'],
+      [gl_cv_promoted_mode_t='mode_t'])
+  ])
+  AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
+    [Define to the type that is the result of default argument promotions of type mode_t.])
+])
index 7f26087e745fbde7ab4b7780128e29acb92b9aa4..9446fa585010885bf6d9806a2f20b2cb77605ebc 100644 (file)
@@ -1,5 +1,5 @@
 # msvc-inval.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index 9e32c171e899446f6c87a076d5b242f9f6e77a01..5d72a042da6dbaaff2c104bfad9ac73c51038812 100644 (file)
@@ -1,5 +1,5 @@
 # msvc-nothrow.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index 2cb956dee56e56d92f4fb1629dca097cf4ec26ed..fc575c1d43739153c89d05f32ec69eeaa32bf485 100644 (file)
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 7
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index 5a5d77d63b512d67f2b15d0f410f93583b3d6566..56283180f04f2bc15b59e681870917c5403aa3d1 100644 (file)
@@ -1,5 +1,5 @@
 # nocrash.m4 serial 4
-dnl Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2015 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.
index f5885b34b1c70f32f5ae4cdf4cc214d2570e8149..0eb14678be143389a8934a205958684deb5e0769 100644 (file)
@@ -1,5 +1,5 @@
 # off_t.m4 serial 1
-dnl Copyright (C) 2012-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2012-2015 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.
diff --git a/m4/open.m4 b/m4/open.m4
new file mode 100644 (file)
index 0000000..2accbaa
--- /dev/null
@@ -0,0 +1,91 @@
+# open.m4 serial 14
+dnl Copyright (C) 2007-2015 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.
+
+AC_DEFUN([gl_FUNC_OPEN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | pw*)
+      REPLACE_OPEN=1
+      ;;
+    *)
+      dnl open("foo/") should not create a file when the file name has a
+      dnl trailing slash.  FreeBSD only has the problem on symlinks.
+      AC_CHECK_FUNCS_ONCE([lstat])
+      AC_CACHE_CHECK([whether open recognizes a trailing slash],
+        [gl_cv_func_open_slash],
+        [# Assume that if we have lstat, we can also check symlinks.
+          if test $ac_cv_func_lstat = yes; then
+            touch conftest.tmp
+            ln -s conftest.tmp conftest.lnk
+          fi
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+int main ()
+{
+  int result = 0;
+#if HAVE_LSTAT
+  if (open ("conftest.lnk/", O_RDONLY) != -1)
+    result |= 1;
+#endif
+  if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
+    result |= 2;
+  return result;
+}]])],
+            [gl_cv_func_open_slash=yes],
+            [gl_cv_func_open_slash=no],
+            [
+changequote(,)dnl
+             case "$host_os" in
+               freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+                 gl_cv_func_open_slash="guessing no" ;;
+               *)
+                 gl_cv_func_open_slash="guessing yes" ;;
+             esac
+changequote([,])dnl
+            ])
+          rm -f conftest.sl conftest.tmp conftest.lnk
+        ])
+      case "$gl_cv_func_open_slash" in
+        *no)
+          AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
+            [Define to 1 if open() fails to recognize a trailing slash.])
+          REPLACE_OPEN=1
+          ;;
+      esac
+      ;;
+  esac
+  dnl Replace open() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    if test $REPLACE_OPEN = 0; then
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_OPEN=1
+      fi
+    fi
+  ])
+  dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    if test $REPLACE_OPEN = 0; then
+      gl_NONBLOCKING_IO
+      if test $gl_cv_have_open_O_NONBLOCK != yes; then
+        REPLACE_OPEN=1
+      fi
+    fi
+  ])
+])
+
+# Prerequisites of lib/open.c.
+AC_DEFUN([gl_PREREQ_OPEN],
+[
+  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+  :
+])
diff --git a/m4/openat.m4 b/m4/openat.m4
new file mode 100644 (file)
index 0000000..c928ff7
--- /dev/null
@@ -0,0 +1,36 @@
+# serial 45
+# See if we need to use our replacement for Solaris' openat et al functions.
+
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+AC_DEFUN([gl_FUNC_OPENAT],
+[
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([openat])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
+  yes+*yes)
+    ;;
+  yes+*)
+    # Solaris 9 has *at functions, but uniformly mishandles trailing
+    # slash in all of them.
+    REPLACE_OPENAT=1
+    ;;
+  *)
+    HAVE_OPENAT=0
+    ;;
+  esac
+])
+
+# Prerequisites of lib/openat.c.
+AC_DEFUN([gl_PREREQ_OPENAT],
+[
+  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+  :
+])
index fa29c643f9df18cc9b33e1caf448a09594a64073..cd83706a9cfb619302cf6869f5a500308a958720 100644 (file)
@@ -1,5 +1,5 @@
 # opendir.m4 serial 2
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index 787300969c7a97bd5e05845d45dcfa42a9fd18bf..2fc15c62980606747d673b9a6544606f1d45eb1c 100644 (file)
@@ -1,5 +1,5 @@
 # parse-datetime.m4 serial 21
-dnl Copyright (C) 2002-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2015 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.
index 114f91f04b5515ca9f5e20e414efdf5a1d606a32..0e3db7a237bd5d55aae50f4030dd958d130a5e0a 100644 (file)
@@ -1,5 +1,5 @@
 # pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 652fa1cdc1caf5b9e691f2afe9496bf477e403d0..ffbb235c6a0800597e3a824c7bff5b7eecc5d201 100644 (file)
@@ -1,5 +1,5 @@
 # printf.m4 serial 51
-dnl Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2015 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.
index 95b3e71b7152eb225d218406b15c0c7eeec3c78c..af72e964093808c22016b3c745d6dc3bae9f7db7 100644 (file)
@@ -1,5 +1,5 @@
 # quote.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index eaebbf638fc1170b0b3b2dd007dd2b9be2bb5c40..985b30d0ec3deb6a810878a88ba1bc2d8d37383c 100644 (file)
@@ -1,5 +1,5 @@
 # quotearg.m4 serial 9
-dnl Copyright (C) 2002, 2004-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2015 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.
index 8656578efc16a918f6b3e0a0300fca716d72e7ec..ed6aae03687aabe1c090e4176a12673c515b9bdc 100644 (file)
@@ -1,5 +1,5 @@
 # raise.m4 serial 3
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index bd7be5c3a66c3c71dbd46b90b4c36ff80da6f4c8..8aa348ff31a254e49baad8a257c155c0257e9086 100644 (file)
@@ -1,5 +1,5 @@
 # readdir.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index f9ce868c2e496b9f51bf33f7945b05431bcf2a4b..88c9bfef7170470176328bc961d78adc58a23871 100644 (file)
@@ -1,5 +1,5 @@
 # readlink.m4 serial 12
-dnl Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2015 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.
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
new file mode 100644 (file)
index 0000000..d0f5e69
--- /dev/null
@@ -0,0 +1,32 @@
+# serial 4
+# See if we need to provide readlinkat replacement.
+
+dnl Copyright (C) 2009-2015 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_READLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([readlinkat])
+  if test $ac_cv_func_readlinkat = no; then
+    HAVE_READLINKAT=0
+  else
+    AC_CACHE_CHECK([whether readlinkat signature is correct],
+      [gl_cv_decl_readlinkat_works],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+             /* Check whether original declaration has correct type.  */
+             ssize_t readlinkat (int, char const *, char *, size_t);]])],
+         [gl_cv_decl_readlinkat_works=yes],
+         [gl_cv_decl_readlinkat_works=no])])
+    if test "$gl_cv_decl_readlink_works" != yes; then
+      REPLACE_READLINKAT=1
+    fi
+  fi
+])
index f96537ba67199953c0ab0e74af6ade6a3b0d0aae..0e1d3386e70eb0ee1447111e774d83eb82cea6a3 100644 (file)
@@ -1,5 +1,5 @@
 # realloc.m4 serial 13
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
index ea57794915e14ff6c82f6c4317805b6bef9a60af..b5e4334574d8e0a826ab3df92503ebb1e9ad89a0 100644 (file)
@@ -1,6 +1,6 @@
 # serial 26
 
-# Copyright (C) 2001, 2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005-2006, 2009-2015 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.
diff --git a/m4/renameat.m4 b/m4/renameat.m4
new file mode 100644 (file)
index 0000000..943fe6b
--- /dev/null
@@ -0,0 +1,24 @@
+# serial 3
+# See if we need to provide renameat replacement.
+
+dnl Copyright (C) 2009-2015 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_RENAMEAT],
+[
+  AC_REQUIRE([gl_FUNC_OPENAT])
+  AC_REQUIRE([gl_FUNC_RENAME])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([renameat])
+  if test $ac_cv_func_renameat = no; then
+    HAVE_RENAMEAT=0
+  elif test $REPLACE_RENAME = 1; then
+    dnl Solaris 9 and 10 have the same bugs in renameat as in rename.
+    REPLACE_RENAMEAT=1
+  fi
+])
index db6a9399c42608c629d9fd6eb15a78fc9ffc0e96..09ed159e046c7de46074d3c4bd7b4c10c3f59b14 100644 (file)
@@ -1,5 +1,5 @@
 # rmdir.m4 serial 13
-dnl Copyright (C) 2002, 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2009-2015 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.
index f0c42e08f52a3f701c74da2da0c85407b17dcbdc..697a07cf85c66b51d1fa4c1da58d51722d5ebbab 100644 (file)
@@ -1,5 +1,5 @@
 # safe-read.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 66648bbb561e2d297897a0ad21bf4279add12ed0..1cef87c5a0e597103ba157b748b3f5201d676f99 100644 (file)
@@ -1,5 +1,5 @@
 # safe-write.m4 serial 4
-dnl Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 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.
diff --git a/m4/save-cwd.m4 b/m4/save-cwd.m4
new file mode 100644 (file)
index 0000000..8e61212
--- /dev/null
@@ -0,0 +1,11 @@
+# serial 10
+dnl Copyright (C) 2002-2006, 2009-2015 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.
+
+dnl Prerequisites for lib/save-cwd.c.
+AC_DEFUN([gl_SAVE_CWD],
+[
+  AC_CHECK_FUNCS_ONCE([fchdir])
+])
index 149888df4b99eacc45aada408c6eb1b392f47c41..6afe89fda57ba4329b0d21b7f4ad38f1e3477d07 100644 (file)
@@ -1,5 +1,5 @@
 # Look up an environment variable more securely.
-dnl Copyright 2013-2014 Free Software Foundation, Inc.
+dnl Copyright 2013-2015 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.
index 0f46a7bec02900a36437acd1a2197d26f0d4c164..3aa38d8958598a360b6f6542b561bb84c25017a3 100644 (file)
@@ -1,5 +1,5 @@
 # setenv.m4 serial 26
-dnl Copyright (C) 2001-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2015 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.
index c8f664fbf366249d155507424b578ef368da4934..f737c36ba829143f2b91bc594162bba1dd5d0ac3 100644 (file)
@@ -1,5 +1,5 @@
 # signal_h.m4 serial 18
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
index 7e192d5e962e858295d3f066ee14a0ebce3efb85..186e3fddabf374042cb0955d29408ec49409c2f0 100644 (file)
@@ -1,5 +1,5 @@
 # size_max.m4 serial 10
-dnl Copyright (C) 2003, 2005-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2015 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.
index fbe1d0687ef555f6314a3695ce9785148f236593..25bd45143438219b005f5643c6ba793d58660708 100644 (file)
@@ -1,5 +1,5 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2015 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.
index ea5c4fc5970aca217f9f988fae887002c3a31f8f..9c8ceec189396c37c2ff42e156586e7d4df4dfb5 100644 (file)
@@ -1,6 +1,6 @@
 # Checks for stat-related time functions.
 
-# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2014 Free Software
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
index 1ae327b3684511fe1e6ab5dec7b973c13416d03e..d1b37689632086289af0be2f13ad5384472dc365 100644 (file)
@@ -1,6 +1,6 @@
 # serial 11
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 732aa313b6aff04057f12c40975f6b57c59dee6d..d208eb35e432036cdcc09524e49d61b26071bbd0 100644 (file)
@@ -1,5 +1,5 @@
 # stdarg.m4 serial 6
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2015 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.
index 006ed52de5dc227a240dc92051b32d20bf7c324a..7273b8224658daca8ddfa4dd7ea39400d3d7185e 100644 (file)
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
index c555e29524458b98a7369b58e0f5470a5ded57a2..231050274adec7b2ec70e76775c3739b3166d0bf 100644 (file)
@@ -1,6 +1,6 @@
-dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 4
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl A placeholder for <stddef.h>, for platforms that have issues.
+# stddef_h.m4 serial 5
+dnl Copyright (C) 2009-2015 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.
@@ -10,6 +10,9 @@ AC_DEFUN([gl_STDDEF_H],
   AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
   AC_REQUIRE([gt_TYPE_WCHAR_T])
   STDDEF_H=
+  AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h],
+    [[#include <stddef.h>
+    ]])
   if test $gt_cv_c_wchar_t = no; then
     HAVE_WCHAR_T=0
     STDDEF_H=stddef.h
@@ -43,5 +46,6 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS],
 [
   dnl Assume proper GNU behavior unless another module says otherwise.
   REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
+  HAVE_MAX_ALIGN_T=1;            AC_SUBST([HAVE_MAX_ALIGN_T])
   HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
 ])
index 1981d9dbc2b5cf31781f4d43db2d520d2bc0c591..4011a4942a1abe3dc7ff22642e709b32443f13e1 100644 (file)
@@ -1,5 +1,5 @@
 # stdint.m4 serial 43
-dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2015 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.
index 7fc2ce9a83842cfc85ca1b444ff9b4a8bb126d12..5097c0b0dcbd73c847e43543d8e0848111e140a2 100644 (file)
@@ -1,5 +1,5 @@
 # stdint_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2015 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.
index d15913a3ca02e81bbe79791cbb783f2e7e275172..e0c4bde1f8e5cf39d248148741f027a6d7a752c4 100644 (file)
@@ -1,14 +1,35 @@
-# stdio_h.m4 serial 43
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# stdio_h.m4 serial 44
+dnl Copyright (C) 2007-2015 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.
 
 AC_DEFUN([gl_STDIO_H],
 [
+  dnl For __USE_MINGW_ANSI_STDIO
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_NEXT_HEADERS([stdio.h])
 
+  dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
+  dnl inttypes.h behave like gnu instead of system; we must give our
+  dnl printf wrapper the right attribute to match.
+  AC_CACHE_CHECK([whether inttypes macros match system or gnu printf],
+    [gl_cv_func_printf_attribute_flavor],
+    [AC_EGREP_CPP([findme .(ll|j)d. findme],
+      [#define __STDC_FORMAT_MACROS 1
+       #include <stdio.h>
+       #include <inttypes.h>
+       findme PRIdMAX findme
+      ], [gl_cv_func_printf_attribute_flavor=gnu],
+      [gl_cv_func_printf_attribute_flavor=system])])
+  if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
+    AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
+      [Define to 1 if printf and friends should be labeled with
+       attribute "__gnu_printf__" instead of "__printf__"])
+  fi
+
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   GNULIB_FSCANF=1
index 86aff16eb05218164789eafe78468ea9301daab2..0b4c623ec714087a76c62302080e87b7a30a4c79 100644 (file)
@@ -1,5 +1,5 @@
 # stdlib_h.m4 serial 42
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
diff --git a/m4/strdup.m4 b/m4/strdup.m4
new file mode 100644 (file)
index 0000000..90ea29d
--- /dev/null
@@ -0,0 +1,36 @@
+# strdup.m4 serial 13
+
+dnl Copyright (C) 2002-2015 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.
+
+AC_DEFUN([gl_FUNC_STRDUP],
+[
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([strdup])
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+AC_DEFUN([gl_FUNC_STRDUP_POSIX],
+[
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+  AC_CHECK_FUNCS_ONCE([strdup])
+  if test $ac_cv_func_strdup = yes; then
+    if test $gl_cv_func_malloc_posix != yes; then
+      REPLACE_STRDUP=1
+    fi
+  fi
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+# Prerequisites of lib/strdup.c.
+AC_DEFUN([gl_PREREQ_STRDUP], [:])
index 0763fe3b4d65c366c999f11d6b85f20bbbf20bc6..75a17f2012fd8b5a5e74eac1f267ffcd3539c3d0 100644 (file)
@@ -1,5 +1,5 @@
 # strerror.m4 serial 17
-dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2015 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.
index 64e683f9dc8ae56195bd6d426e1c2ff282beed5d..55d09ef407800fd5c591aeec58e7494673f983c5 100644 (file)
@@ -1,6 +1,6 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007-2015 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.
index 55df039987ba676e6d63b1c455a1d5641f79fcc0..e6e2300dec866f7180eee794611e849cd715827c 100644 (file)
@@ -1,5 +1,5 @@
 # strndup.m4 serial 21
-dnl Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2015 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.
index 94317f8a997fb650f0df6ab56e9f6f37f215da5a..5f85d3fa7dd46254fc6d9a00cd384b180478f837 100644 (file)
@@ -1,5 +1,5 @@
 # strnlen.m4 serial 13
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index de4924b431ad2d8616c3e3277500993cdee5f1ad..a59e2f0dd72dc3e42cdfcfd24c197cb6e7ef723e 100644 (file)
@@ -1,7 +1,7 @@
 # serial 6
 # See if we need to provide symlink replacement.
 
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
diff --git a/m4/symlinkat.m4 b/m4/symlinkat.m4
new file mode 100644 (file)
index 0000000..fd975c8
--- /dev/null
@@ -0,0 +1,53 @@
+# serial 6
+# See if we need to provide symlinkat replacement.
+
+dnl Copyright (C) 2009-2015 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_SYMLINKAT],
+[
+  AC_REQUIRE([gl_FUNC_OPENAT])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([symlinkat])
+  if test $ac_cv_func_symlinkat = no; then
+    HAVE_SYMLINKAT=0
+  else
+    AC_CACHE_CHECK([whether symlinkat handles trailing slash correctly],
+      [gl_cv_func_symlinkat_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <fcntl.h>
+             #include <unistd.h>
+           ]],
+           [[int result = 0;
+             if (!symlinkat ("a", AT_FDCWD, "conftest.link/"))
+               result |= 1;
+             if (symlinkat ("conftest.f", AT_FDCWD, "conftest.lnk2"))
+               result |= 2;
+             else if (!symlinkat ("a", AT_FDCWD, "conftest.lnk2/"))
+               result |= 4;
+             return result;
+           ]])],
+         [gl_cv_func_symlinkat_works=yes],
+         [gl_cv_func_symlinkat_works=no],
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_symlinkat_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_symlinkat_works="guessing no" ;;
+          esac
+         ])
+      rm -f conftest.f conftest.link conftest.lnk2])
+    case "$gl_cv_func_symlinkat_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINKAT=1
+        ;;
+    esac
+  fi
+])
index 114d828172a919e23ed517ccb7004617ddc686c8..eaeabe7d966ea969fceed76f2a3afbcb2dca091f 100644 (file)
@@ -1,5 +1,5 @@
 # sys_socket_h.m4 serial 23
-dnl Copyright (C) 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2015 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.
index eaa7642ba311bd74570887f5a8d6b9bead70a9b2..6c909e816a7444f62d8ce81c8da9bff886f27018 100644 (file)
@@ -1,5 +1,5 @@
 # sys_stat_h.m4 serial 28   -*- Autoconf -*-
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
index 5c79300f8ec66e55a7b7a35eca0f0bcac22b8912..50133b9ff9a95c215aa3395552bb21431d279668 100644 (file)
@@ -1,7 +1,7 @@
 # Configure a replacement for <sys/time.h>.
 # serial 8
 
-# Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2015 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.
index 9748905b5986ad97c588567c525987ae8472a84d..2232aece63ec0f4d42469f3885ea211f8ff9d51b 100644 (file)
@@ -1,5 +1,5 @@
 # sys_types_h.m4 serial 5
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
index 1594e1f5d0494af537062782dc209f34ddfda682..b1694d68475dadf8aff0e9950d0282759278dd10 100644 (file)
@@ -1,6 +1,6 @@
 #serial 5
 
-# Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007, 2009-2015 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.
index 9852778f9a5db376afbc8b2174cfc67ef96cc01a..d9c41a48f3392c9bc53578643fd47f97216788bd 100644 (file)
@@ -1,8 +1,8 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
 
-# serial 8
+# serial 9
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
 ])
 
 dnl Check whether 'struct timespec' is declared
-dnl in time.h, sys/time.h, or pthread.h.
+dnl in time.h, sys/time.h, pthread.h, or unistd.h.
 
 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
 [
@@ -44,6 +44,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
   TIME_H_DEFINES_STRUCT_TIMESPEC=0
   SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
   PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+  UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
   if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
     TIME_H_DEFINES_STRUCT_TIMESPEC=1
   else
@@ -70,12 +71,26 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
            [gl_cv_sys_struct_timespec_in_pthread_h=no])])
       if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
         PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+      else
+        AC_CACHE_CHECK([for struct timespec in <unistd.h>],
+          [gl_cv_sys_struct_timespec_in_unistd_h],
+          [AC_COMPILE_IFELSE(
+             [AC_LANG_PROGRAM(
+                [[#include <unistd.h>
+                ]],
+                [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+             [gl_cv_sys_struct_timespec_in_unistd_h=yes],
+             [gl_cv_sys_struct_timespec_in_unistd_h=no])])
+        if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+          UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+        fi
       fi
     fi
   fi
   AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
   AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
   AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
+  AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
 ])
 
 AC_DEFUN([gl_TIME_MODULE_INDICATOR],
index 7e15600f7b60f76850bfe0d057d1e5c26d1d18ff..8df7e139cf2efa043b12f8726cf7dbb65375917e 100644 (file)
@@ -1,6 +1,6 @@
 dnl Reentrant time functions: localtime_r, gmtime_r.
 
-dnl Copyright (C) 2003, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2015 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.
index 2ce654fe80478edde5eb0a11b10d53c8bdc4b0bc..06b3533e42f653087b0795efc7e364f997b0765d 100644 (file)
@@ -1,6 +1,6 @@
 #serial 15
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 486351b477a348baf5d01ab3ba9a61a2ef5264e2..71a88f92f49d876f9e102f1106f43bff33446211 100644 (file)
@@ -1,5 +1,5 @@
 # tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2015 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.
index 96cb7df7d55495bacdb949d37b42149e3a2e0217..006bba245bb1003443f23495385cfef1461cfb3d 100644 (file)
@@ -1,5 +1,5 @@
 #serial 9
-dnl Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 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.
index d7346a0b05b308faeb3811827218f19aec9285ff..b3c581f7b25e6efc72480e758356f2c39b02e2c1 100644 (file)
@@ -1,5 +1,5 @@
 # unistd_h.m4 serial 68
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
index 03cf8ae0b1780d9ae06a5029049bf3656d3de51e..094d69a0ba0604198d577e94a3cc9f01d4073f33 100644 (file)
@@ -1,5 +1,5 @@
 # unlink.m4 serial 11
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
diff --git a/m4/unlinkat.m4 b/m4/unlinkat.m4
new file mode 100644 (file)
index 0000000..6e5fa31
--- /dev/null
@@ -0,0 +1,33 @@
+# unlinkat.m4 serial 2
+dnl Copyright (C) 2004-2015 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 Jim Meyering.
+
+AC_DEFUN([gl_FUNC_UNLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([unlinkat])
+  AC_REQUIRE([gl_FUNC_UNLINK])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  if test $ac_cv_func_unlinkat = no; then
+    HAVE_UNLINKAT=0
+  else
+    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+      *no)
+        # Solaris 9 has *at functions, but uniformly mishandles trailing
+        # slash in all of them.
+        REPLACE_UNLINKAT=1
+        ;;
+      *)
+        # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+        if test $REPLACE_UNLINK = 1; then
+          REPLACE_UNLINKAT=1
+        fi
+        ;;
+    esac
+  fi
+])
index 822a063ce013d04b050586018108257f0ffadf01..7c33ae9492398cca1ea046f22563d72b35b3710a 100644 (file)
@@ -1,6 +1,6 @@
 # serial 9
 
-# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
 # Inc.
 #
 # This file is free software; the Free Software Foundation
index c9c44cf246209ff01c1a990a532defbdba1eadb4..b022cfdc8576314e8d0502d76503f9e34ab998e6 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2003-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2015 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.
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
new file mode 100644 (file)
index 0000000..9a80fa0
--- /dev/null
@@ -0,0 +1,71 @@
+# serial 5
+# See if we need to provide utimensat replacement.
+
+dnl Copyright (C) 2009-2015 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_UTIMENSAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([utimensat])
+  if test $ac_cv_func_utimensat = no; then
+    HAVE_UTIMENSAT=0
+  else
+    AC_CACHE_CHECK([whether utimensat works],
+      [gl_cv_func_utimensat_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+]],         [[int result = 0;
+              const char *f = "conftest.file";
+              if (close (creat (f, 0600)))
+                return 1;
+              /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported.  */
+              {
+                if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+                  result |= 2;
+              }
+              /* Test whether UTIME_NOW and UTIME_OMIT work.  */
+              {
+                struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 4;
+              }
+              sleep (1);
+              {
+                struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } };
+                struct stat st;
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 8;
+                if (stat (f, &st))
+                  result |= 16;
+                else if (st.st_ctime < st.st_atime)
+                  result |= 32;
+              }
+              return result;
+            ]])],
+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 utimensat in 2.6.22, but has bugs with UTIME_OMIT
+   in several file systems as recently as 2.6.32.  Always replace utimensat
+   to support older kernels.  */
+choke me
+#endif
+      ]])],
+           [gl_cv_func_utimensat_works=yes],
+           [gl_cv_func_utimensat_works="needs runtime check"])],
+         [gl_cv_func_utimensat_works=no],
+         [gl_cv_func_utimensat_works="guessing no"])])
+    if test "$gl_cv_func_utimensat_works" != yes; then
+      REPLACE_UTIMENSAT=1
+    fi
+  fi
+])
index c36135785e67ba18991a1bca69d48d114efa3e5c..e26a576b82052a8076804d9fa289c910b73e0b1e 100644 (file)
@@ -1,7 +1,7 @@
 # Detect some bugs in glibc's implementation of utimes.
 # serial 3
 
-dnl Copyright (C) 2003-2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2005, 2009-2015 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.
index 106192ea2fd7a06f6d77022874959a48287aa43b..4708f2b8e296b5f89662265ff55c05dd0fc0dc7e 100644 (file)
@@ -1,5 +1,5 @@
 # vasnprintf.m4 serial 36
-dnl Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2015 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.
index c76c99c3b14cd93e874da0024d1b5a32440ac712..b785dc328990d1904248ff3e5b5b8ff6d2e4ba85 100644 (file)
@@ -1,5 +1,5 @@
 # vasprintf.m4 serial 6
-dnl Copyright (C) 2002-2003, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2006-2007, 2009-2015 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index cc690f8e2cb766766a4b14628e71e70420cd955a..1e98dc9b77512ecd0b479afdf7516397ad0616cc 100644 (file)
@@ -1,5 +1,5 @@
 # warn-on-use.m4 serial 5
-dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2015 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.
index 43156f450066369b17991bdd7520843457fdcb90..5ae01def133fb451019e908a8056aff7b4988e7e 100644 (file)
@@ -1,5 +1,5 @@
 # warnings.m4 serial 11
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index 85db95286b073f452ddcd9380cc26a1fe7b6b31c..9d1b0f8b6d2f51f63c7caac9285b5ce626f610d8 100644 (file)
@@ -1,6 +1,6 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
index 839a04c17c34f4fb0b22ef1e18465fd271e3d806..dc964e67e261d0166afb14b4dcb45872d6b114fd 100644 (file)
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2015 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.
index 3fac0ee099d1b1bc2918d843e77b2b5e352da1e3..95a4705b0e74cdbd9bcfd5633c499a529a40cf71 100644 (file)
@@ -2,7 +2,7 @@
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
index 9b07b07090054edd2a4340698be18b2bbc0b7a7e..ca3fd449a14ec3127a14070cbdb76b8db44225e7 100644 (file)
@@ -1,5 +1,5 @@
 # wint_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2015 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.
index 820dd4f77cfc4df7f19d6a9a9a9cbbbfccdd2e5b..ce7042ef1b3c924108275e9eddf809962666d20e 100644 (file)
@@ -1,5 +1,5 @@
 # write.m4 serial 5
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
index b6a2257befa85b9b9e593f13a4666d08c5d5a77f..6dfcab3c90888509397f64989d97c8132c202d4d 100644 (file)
@@ -1,5 +1,5 @@
 # xalloc.m4 serial 18
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
index 3af23ec75b85d278ad64a47daf318ecb74fc0413..98faf7de0b27391e10c9dd6a792f46457f84f6e3 100644 (file)
@@ -1,5 +1,5 @@
 # xsize.m4 serial 5
-dnl Copyright (C) 2003-2004, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2015 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.
index 8521f0ed5f93a5cdcc54385671fc576cbbed646f..296603be23126a6ddd8b07a84eea2a87d3bd5f5c 100644 (file)
@@ -1,5 +1,5 @@
 # xstrndup.m4 serial 2
-dnl Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2015 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.
index c2d3ec7fe68504fd6006aaa9e8634b8eac39b748..715609a272ef3fe397e218bcd933b95de48d6d01 100644 (file)
@@ -1,5 +1,5 @@
 # xvasprintf.m4 serial 2
-dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2015 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.
index 1f5bddd56a628219858edb1ea680295f2c7ba8ca..b6ec1b5e16d66255776a20546f798b908a237491 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -2,7 +2,7 @@
 # This Makefile fragment tries to be general-purpose enough to be
 # used by many projects via the gnulib maintainer-makefile module.
 
-## Copyright (C) 2001-2014 Free Software Foundation, Inc.
+## Copyright (C) 2001-2015 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
@@ -1648,14 +1648,14 @@ _gl_tight_scope: $(bin_PROGRAMS)
          perl -lne                                                     \
             '$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr;      \
        ) | sort -u > $$t;                                              \
-       nm -e $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|grep -Ev -f $$t \
+       nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|grep -Ev -f $$t \
          && { echo the above functions should have static scope >&2;   \
               exit 1; } || : ;                                         \
        ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars);       \
          perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"'           \
                $$hdr $(_gl_TS_other_headers)                           \
        ) | sort -u > $$t;                                              \
-       nm -e $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p'       \
+       nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p'       \
             | sort -u | grep -Ev -f $$t                                        \
          && { echo the above variables should have static scope >&2;   \
               exit 1; } || :
index 4c5fc5377f8ab2e003651ceb18d762b79f533a57..7690760ac8ada44a39abf70628520c98257e320e 100644 (file)
@@ -27,6 +27,8 @@ patch_SOURCES = \
        patch.c \
        pch.c \
        pch.h \
+       safe.c \
+       safe.h \
        util.c \
        util.h \
        version.c \
index 1b25bb97000cbe35ab1563e234e6e4542f0ca0ef..2104c86eebc3e910b74379e6186d049c2b41c457 100644 (file)
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
        $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
+       $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
        $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
        $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
        $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
@@ -113,52 +114,61 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
        $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
        $(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
-       $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+       $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+       $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+       $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
        $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+       $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
        $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
        $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/gnulib-comp.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
        $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
-       $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
        $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
        $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
        $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
        $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
        $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
        $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
        $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+       $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+       $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
        $(top_srcdir)/m4/msvc-inval.m4 \
        $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
        $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+       $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
        $(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
        $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
        $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
        $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
-       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
-       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+       $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+       $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
        $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
-       $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
-       $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
-       $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
-       $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
-       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
-       $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+       $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+       $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+       $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
        $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
        $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
-       $(top_srcdir)/m4/sys_socket_h.m4 \
+       $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
        $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
        $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
        $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
        $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
        $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
-       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+       $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+       $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
        $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
        $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
        $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
@@ -176,10 +186,12 @@ CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
 am__patch_SOURCES_DIST = bestmatch.h common.h inp.c inp.h patch.c \
-       pch.c pch.h util.c util.h version.c version.h merge.c
+       pch.c pch.h safe.c safe.h util.c util.h version.c version.h \
+       merge.c
 @ENABLE_MERGE_TRUE@am__objects_1 = merge.$(OBJEXT)
 am_patch_OBJECTS = inp.$(OBJEXT) patch.$(OBJEXT) pch.$(OBJEXT) \
-       util.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+       safe.$(OBJEXT) util.$(OBJEXT) version.$(OBJEXT) \
+       $(am__objects_1)
 patch_OBJECTS = $(am_patch_OBJECTS)
 am__DEPENDENCIES_1 =
 patch_DEPENDENCIES = $(top_builddir)/lib/libpatch.a \
@@ -616,6 +628,7 @@ HAVE_LINK = @HAVE_LINK@
 HAVE_LINKAT = @HAVE_LINKAT@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
 HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBRLEN = @HAVE_MBRLEN@
 HAVE_MBRTOWC = @HAVE_MBRTOWC@
 HAVE_MBSINIT = @HAVE_MBSINIT@
@@ -972,6 +985,7 @@ STRIP = @STRIP@
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
 UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 VERSION = @VERSION@
@@ -1043,7 +1057,8 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 patch_SOURCES = bestmatch.h common.h inp.c inp.h patch.c pch.c pch.h \
-       util.c util.h version.c version.h $(am__append_1)
+       safe.c safe.h util.c util.h version.c version.h \
+       $(am__append_1)
 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
        $(am__append_2)
 patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \
@@ -1140,6 +1155,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merge.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/patch.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@
 
index a7ad070399d9ea6fdf557ad51a3ce38c4110c777..49698373c4aded2bbc78ba488bf81a764271a00b 100644 (file)
--- a/src/inp.c
+++ b/src/inp.c
@@ -25,6 +25,7 @@
 #undef XTERN
 #define XTERN
 #include <inp.h>
+#include <safe.h>
 
 /* Input-file-with-indexable-lines abstract type */
 
@@ -237,7 +238,7 @@ plan_a (char const *filename)
     {
       if (S_ISREG (instat.st_mode))
         {
-         int ifd = open (filename, O_RDONLY|binary_transput);
+         int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
          size_t buffered = 0, n;
          if (ifd < 0)
            pfatal ("can't open file %s", quotearg (filename));
@@ -268,7 +269,7 @@ plan_a (char const *filename)
       else if (S_ISLNK (instat.st_mode))
        {
          ssize_t n;
-         n = readlink (filename, buffer, size);
+         n = safe_readlink (filename, buffer, size);
          if (n < 0)
            pfatal ("can't read %s %s", "symbolic link", quotearg (filename));
          size = n;
@@ -339,6 +340,7 @@ plan_a (char const *filename)
 static void
 plan_b (char const *filename)
 {
+  int ifd;
   FILE *ifp;
   int c;
   size_t len;
@@ -351,7 +353,8 @@ plan_b (char const *filename)
 
   if (instat.st_size == 0)
     filename = NULL_DEVICE;
-  if (! (ifp = fopen (filename, binary_transput ? "rb" : "r")))
+  if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
+      || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
     pfatal ("Can't open file %s", quotearg (filename));
   if (TMPINNAME_needs_removal)
     {
index cb4dbb20396234130f4d543740481cb421ba4ec6..2c51f446c18ec198bbef6a16bc2345669438b885 100644 (file)
@@ -34,6 +34,7 @@
 #include <gl_linked_list.h>
 #include <gl_xlist.h>
 #include <minmax.h>
+#include <safe.h>
 
 /* procedures */
 
@@ -291,7 +292,7 @@ main (int argc, char **argv)
 
       if (read_only_behavior != RO_IGNORE
          && ! inerrno && ! S_ISLNK (instat.st_mode)
-         && access (inname, W_OK) != 0)
+         && safe_access (inname, W_OK) != 0)
        {
          say ("File %s is read-only; ", quotearg (inname));
          if (read_only_behavior == RO_WARN)
@@ -339,6 +340,8 @@ main (int argc, char **argv)
            outstate.ofp = fdopen(outfd, binary_transput ? "wb" : "w");
            if (! outstate.ofp)
              pfatal ("%s", TMPOUTNAME);
+           /* outstate.ofp now owns the file descriptor */
+           outfd = -1;
          }
 
        /* find out where all the lines are */
@@ -540,7 +543,7 @@ main (int argc, char **argv)
                      enum file_attributes attr = 0;
                      struct timespec new_time = pch_timestamp (! reverse);
                      mode_t mode = file_type |
-                         ((new_mode ? new_mode : instat.st_mode) & S_IRWXUGO);
+                         ((set_mode ? new_mode : instat.st_mode) & S_IRWXUGO);
 
                      if ((set_time | set_utc) && new_time.tv_sec != -1)
                        {
@@ -1917,7 +1920,7 @@ output_files (struct stat const *st)
                       from_st, file_to_output->to,
                       file_to_output->mode, file_to_output->backup);
       if (file_to_output->to && from_needs_removal)
-       unlink (file_to_output->from);
+       safe_unlink (file_to_output->from);
 
       if (st && st->st_dev == from_st->st_dev && st->st_ino == from_st->st_ino)
        {
@@ -1947,7 +1950,7 @@ forget_output_files (void)
     {
       const struct file_to_output *file_to_output = elt;
 
-      unlink (file_to_output->from);
+      safe_unlink (file_to_output->from);
     }
   gl_list_iterator_free (&iter);
   gl_list_clear (files_to_output);
@@ -1971,7 +1974,7 @@ remove_if_needed (char const *name, bool *needs_removal)
 {
   if (*needs_removal)
     {
-      unlink (name);
+      safe_unlink (name);
       *needs_removal = false;
     }
 }
index 028d51fc1bfda29b56948c9b694bd9cf762fbc16..fd8885ea3493c5793fd5f8c66e36c65da12a5c24 100644 (file)
--- a/src/pch.c
+++ b/src/pch.c
@@ -32,6 +32,7 @@
 #if HAVE_SETMODE_DOS
 # include <io.h>
 #endif
+#include <safe.h>
 
 #define INITHUNKMAX 125                        /* initial dynamic allocation size */
 
@@ -389,7 +390,6 @@ skip_hex_digits (char const *str)
 static bool
 name_is_valid (char const *name)
 {
-  char const *n;
   int i;
   bool is_valid = true;
 
@@ -434,6 +434,7 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
     int version_controlled[3];
     enum diff retval;
     mode_t file_type;
+    size_t indent = -1;
 
     for (i = OLD;  i <= INDEX;  i++)
       if (p_name[i]) {
@@ -480,11 +481,12 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
        file_offset previous_line = this_line;
        bool last_line_was_command = this_is_a_command;
        bool stars_last_line = stars_this_line;
-       size_t indent = 0;
+       size_t indent_last_line = indent;
        char ed_command_letter;
        bool strip_trailing_cr;
        size_t chars_read;
 
+       indent = 0;
        this_line = file_tell (pfp);
        chars_read = pget_line (0, 0, false, false);
        if (chars_read == (size_t) -1)
@@ -763,7 +765,8 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
        if ((diff_type == NO_DIFF
             || diff_type == CONTEXT_DIFF
             || diff_type == NEW_CONTEXT_DIFF)
-           && stars_last_line && strnEQ (s, "*** ", 4)) {
+           && stars_last_line && indent_last_line == indent
+           && strnEQ (s, "*** ", 4)) {
            s += 4;
            if (s[0] == '0' && !ISDIGIT (s[1]))
              p_says_nonexistent[OLD] = 1 + ! p_timestamp[OLD].tv_sec;
@@ -1013,7 +1016,7 @@ prefix_components (char *filename, bool checkdirs)
          if (checkdirs)
            {
              *f = '\0';
-             stat_result = stat (filename, &stat_buf);
+             stat_result = safe_stat (filename, &stat_buf);
              *f = '/';
              if (! (stat_result == 0 && S_ISDIR (stat_buf.st_mode)))
                break;
diff --git a/src/safe.c b/src/safe.c
new file mode 100644 (file)
index 0000000..eec6ce5
--- /dev/null
@@ -0,0 +1,463 @@
+/* safe path traversal functions for 'patch' */
+
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+
+   Written by Tim Waugh <twaugh@redhat.com> and
+   Andreas Gruenbacher <agruenba@redhat.com>.
+
+   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/>.  */
+
+#include <config.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <alloca.h>
+#include <safe.h>
+#include "dirname.h"
+
+#include <hash.h>
+#include <xalloc.h>
+#include <minmax.h>
+
+#define XTERN extern
+#include "common.h"
+
+/* Path lookup results are cached in a hash table + LRU list. When the
+   cache is full, the oldest entries are removed.  */
+
+unsigned long dirfd_cache_misses;
+
+struct cached_dirfd {
+  /* lru list */
+  struct cached_dirfd *prev, *next;
+
+  /* key (openat arguments) */
+  int dirfd;
+  char *name;
+
+  /* value (openat result) */
+  int fd;
+};
+
+static Hash_table *cached_dirfds = NULL;
+static size_t max_cached_fds;
+static struct cached_dirfd lru_list = {
+  .prev = &lru_list,
+  .next = &lru_list,
+};
+
+static size_t hash_cached_dirfd (const void *entry, size_t table_size)
+{
+  const struct cached_dirfd *d = entry;
+  size_t strhash = hash_string (d->name, table_size);
+  return (strhash * 31 + d->dirfd) % table_size;
+}
+
+static bool compare_cached_dirfds (const void *_a,
+                                  const void *_b)
+{
+  const struct cached_dirfd *a = _a;
+  const struct cached_dirfd *b = _b;
+
+  return (a->dirfd == b->dirfd &&
+         !strcmp (a->name, b->name));
+}
+
+static void free_cached_dirfd (struct cached_dirfd *d)
+{
+  close (d->fd);
+  free (d->name);
+  free (d);
+}
+
+static void init_dirfd_cache (void)
+{
+  struct rlimit nofile;
+
+  max_cached_fds = 8;
+  if (getrlimit (RLIMIT_NOFILE, &nofile) == 0)
+    max_cached_fds = MAX (nofile.rlim_cur / 4, max_cached_fds);
+
+  cached_dirfds = hash_initialize (max_cached_fds,
+                                  NULL,
+                                  hash_cached_dirfd,
+                                  compare_cached_dirfds,
+                                  NULL);
+
+  if (!cached_dirfds)
+    xalloc_die ();
+}
+
+static void lru_list_add (struct cached_dirfd *entry, struct cached_dirfd *head)
+{
+  struct cached_dirfd *next = head->next;
+  entry->prev = head;
+  entry->next = next;
+  head->next = next->prev = entry;
+}
+
+static void lru_list_del (struct cached_dirfd *entry)
+{
+  struct cached_dirfd *prev = entry->prev;
+  struct cached_dirfd *next = entry->next;
+  prev->next = next;
+  next->prev = prev;
+}
+
+static struct cached_dirfd *lookup_cached_dirfd (int dirfd, const char *name)
+{
+  struct cached_dirfd *entry = NULL;
+
+  if (cached_dirfds)
+    {
+      struct cached_dirfd key;
+      key.dirfd = dirfd;
+      key.name = (char *) name;
+      entry = hash_lookup (cached_dirfds, &key);
+      if (entry)
+       {
+         /* Move this most recently used entry to the head of the lru list */
+         lru_list_del (entry);
+         lru_list_add (entry, &lru_list);
+       }
+    }
+
+  return entry;
+}
+
+static void remove_cached_dirfd (struct cached_dirfd *entry)
+{
+  lru_list_del (entry);
+  hash_delete (cached_dirfds, entry);
+  free_cached_dirfd (entry);
+}
+
+static void insert_cached_dirfd (struct cached_dirfd *entry, int keepfd)
+{
+  if (cached_dirfds == NULL)
+    init_dirfd_cache ();
+
+  /* Trim off the least recently used entries */
+  while (hash_get_n_entries (cached_dirfds) >= max_cached_fds)
+    {
+      struct cached_dirfd *last = lru_list.prev;
+      assert (last != &lru_list);
+      if (last->fd == keepfd)
+       {
+         last = last->prev;
+         assert (last != &lru_list);
+       }
+      remove_cached_dirfd (last);
+    }
+
+  assert (hash_insert (cached_dirfds, entry) == entry);
+  lru_list_add (entry, &lru_list);
+}
+
+static void invalidate_cached_dirfd (int dirfd, const char *name)
+{
+  struct cached_dirfd key, *entry;
+  if (!cached_dirfds)
+    return;
+
+  key.dirfd = dirfd;
+  key.name = (char *) name;
+  entry = hash_lookup (cached_dirfds, &key);
+  if (entry)
+    remove_cached_dirfd (entry);
+}
+
+static int openat_cached (int dirfd, const char *name, int keepfd)
+{
+  int fd;
+  struct cached_dirfd *entry = lookup_cached_dirfd (dirfd, name);
+
+  if (entry)
+    return entry->fd;
+  dirfd_cache_misses++;
+
+  /* Actually get the new directory file descriptor. Don't follow
+     symbolic links. */
+  fd = openat (dirfd, name, O_DIRECTORY | O_NOFOLLOW);
+
+  /* Don't cache errors. */
+  if (fd < 0)
+    return fd;
+
+  /* Store new cache entry */
+  entry = xmalloc (sizeof (struct cached_dirfd));
+  entry->dirfd = dirfd;
+  entry->name = xstrdup (name);
+  entry->fd = fd;
+  insert_cached_dirfd (entry, keepfd);
+
+  return fd;
+}
+
+/* Resolve the next path component in PATH inside DIRFD. */
+static int traverse_next (int dirfd, const char **path, int keepfd)
+{
+  const char *p = *path;
+  char *name;
+
+  while (*p && ! ISSLASH (*p))
+    p++;
+  if (**path == '.' && *path + 1 == p)
+    goto skip;
+  name = alloca (p - *path + 1);
+  memcpy(name, *path, p - *path);
+  name[p - *path] = 0;
+
+  dirfd = openat_cached (dirfd, name, keepfd);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    {
+      *path = p;
+      return -1;
+    }
+skip:
+  while (ISSLASH (*p))
+    p++;
+  *path = p;
+  return dirfd;
+}
+
+/* Traverse PATHNAME.  Updates PATHNAME to point to the last path component and
+   returns a file descriptor to its parent directory (which can be AT_FDCWD).
+   When KEEPFD is given, make sure that the cache entry for DIRFD is not
+   removed from the cache (and KEEPFD remains open) even if the cache grows
+   beyond MAX_CACHED_FDS entries. */
+static int traverse_another_path (const char **pathname, int keepfd)
+{
+  unsigned long misses = dirfd_cache_misses;
+  const char *path = *pathname, *last;
+  int dirfd = AT_FDCWD;
+
+  if (! *path || IS_ABSOLUTE_FILE_NAME (path))
+    return dirfd;
+
+  /* Find the last pathname component */
+  last = strrchr (path, 0) - 1;
+  if (ISSLASH (*last))
+    {
+      while (last != path)
+       if (! ISSLASH (*--last))
+         break;
+    }
+  while (last != path && ! ISSLASH (*(last - 1)))
+    last--;
+  if (last == path)
+    return dirfd;
+
+  if (debug & 32)
+    printf ("Resolving path \"%.*s\"", (int) (last - path), path);
+
+  while (path != last)
+    {
+      dirfd = traverse_next (dirfd, &path, keepfd);
+      if (dirfd < 0 && dirfd != AT_FDCWD)
+       {
+         if (debug & 32)
+           {
+             printf (" (failed)\n");
+             fflush (stdout);
+           }
+         if (errno == ELOOP)
+           {
+             fprintf (stderr, "Refusing to follow symbolic link %.*s\n",
+                      (int) (path - *pathname), *pathname);
+             fatal_exit (0);
+           }
+         return dirfd;
+       }
+    }
+  *pathname = last;
+  if (debug & 32)
+    {
+      misses = dirfd_cache_misses - misses;
+      if (! misses)
+       printf(" (cached)\n");
+      else
+       printf (" (%lu miss%s)\n", misses, misses == 1 ? "" : "es");
+      fflush (stdout);
+    }
+  return dirfd;
+}
+
+/* Just traverse PATHNAME; see traverse_another_path(). */
+static int traverse_path (const char **pathname)
+{
+  return traverse_another_path (pathname, -1);
+}
+
+static int safe_xstat (const char *pathname, struct stat *buf, int flags)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return fstatat (dirfd, pathname, buf, flags);
+}
+
+/* Replacement for stat() */
+int safe_stat (const char *pathname, struct stat *buf)
+{
+  return safe_xstat (pathname, buf, 0);
+}
+
+/* Replacement for lstat() */
+int safe_lstat (const char *pathname, struct stat *buf)
+{
+  return safe_xstat (pathname, buf, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for open() */
+int safe_open (const char *pathname, int flags, mode_t mode)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return openat (dirfd, pathname, flags, mode);
+}
+
+/* Replacement for rename() */
+int safe_rename (const char *oldpath, const char *newpath)
+{
+  int olddirfd, newdirfd;
+  int ret;
+
+  olddirfd = traverse_path (&oldpath);
+  if (olddirfd != AT_FDCWD && olddirfd < 0)
+    return olddirfd;
+
+  newdirfd = traverse_another_path (&newpath, olddirfd);
+  if (newdirfd != AT_FDCWD && newdirfd < 0)
+    return newdirfd;
+
+  ret = renameat (olddirfd, oldpath, newdirfd, newpath);
+  invalidate_cached_dirfd (olddirfd, oldpath);
+  invalidate_cached_dirfd (newdirfd, newpath);
+  return ret;
+}
+
+/* Replacement for mkdir() */
+int safe_mkdir (const char *pathname, mode_t mode)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return mkdirat (dirfd, pathname, mode);
+}
+
+/* Replacement for rmdir() */
+int safe_rmdir (const char *pathname)
+{
+  int dirfd;
+  int ret;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+
+  ret = unlinkat (dirfd, pathname, AT_REMOVEDIR);
+  invalidate_cached_dirfd (dirfd, pathname);
+  return ret;
+}
+
+/* Replacement for unlink() */
+int safe_unlink (const char *pathname)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return unlinkat (dirfd, pathname, 0);
+}
+
+/* Replacement for symlink() */
+int safe_symlink (const char *target, const char *linkpath)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&linkpath);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return symlinkat (target, dirfd, linkpath);
+}
+
+/* Replacement for chmod() */
+int safe_chmod (const char *pathname, mode_t mode)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return fchmodat (dirfd, pathname, mode, 0);
+}
+
+/* Replacement for lchown() */
+int safe_lchown (const char *pathname, uid_t owner, gid_t group)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return fchownat (dirfd, pathname, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for lutimens() */
+int safe_lutimens (const char *pathname, struct timespec const times[2])
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return utimensat (dirfd, pathname, times, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for readlink() */
+ssize_t safe_readlink(const char *pathname, char *buf, size_t bufsiz)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return readlinkat (dirfd, pathname, buf, bufsiz);
+}
+
+/* Replacement for access() */
+int safe_access(const char *pathname, int mode)
+{
+  int dirfd;
+
+  dirfd = traverse_path (&pathname);
+  if (dirfd < 0 && dirfd != AT_FDCWD)
+    return dirfd;
+  return faccessat (dirfd, pathname, mode, 0);
+}
diff --git a/src/safe.h b/src/safe.h
new file mode 100644 (file)
index 0000000..1a0ff70
--- /dev/null
@@ -0,0 +1,33 @@
+/* safe path traversal functions for 'patch' */
+
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+
+   Written by Tim Waugh <twaugh@redhat.com> and
+   Andreas Gruenbacher <agruenba@redhat.com>.
+
+   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/>.  */
+
+int safe_stat (const char *pathname, struct stat *buf);
+int safe_lstat (const char *pathname, struct stat *buf);
+int safe_open (const char *pathname, int flags, mode_t mode);
+int safe_rename (const char *oldpath, const char *newpath);
+int safe_mkdir (const char *pathname, mode_t mode);
+int safe_rmdir (const char *pathname);
+int safe_unlink (const char *pathname);
+int safe_symlink (const char *target, const char *linkpath);
+int safe_chmod (const char *pathname, mode_t mode);
+int safe_lchown (const char *pathname, uid_t owner, gid_t group);
+int safe_lutimens (const char *pathname, struct timespec const times[2]);
+ssize_t safe_readlink(const char *pathname, char *buf, size_t bufsiz);
+int safe_access(const char *pathname, int mode);
index ae05caa675912ae1bf595ef0af4c77af4ffcc15d..fae628a0e9ed286f90db064a2d4036636e63efb6 100644 (file)
@@ -52,6 +52,8 @@
 # include "verror.h"
 #endif
 
+#include <safe.h>
+
 static void makedirs (char const *);
 
 typedef struct
@@ -216,6 +218,9 @@ copy_attr (char const *src_path, char const *dst_path)
     .quote = copy_attr_quote,
     .quote_free = copy_attr_free
   };
+  /* FIXME: We are copying between files we know we can safely access by
+   * pathname. A safe_ version of attr_copy_file() might still be slightly
+   * more efficient for deep paths. */
   return attr_copy_file (src_path, dst_path, copy_attr_check, &ctx);
 }
 
@@ -244,7 +249,7 @@ set_file_attributes (char const *to, enum file_attributes attr,
          times[0] = get_stat_atime (st);
          times[1] = get_stat_mtime (st);
        }
-      if (lutimens (to, times) != 0)
+      if (safe_lutimens (to, times) != 0)
        pfatal ("Failed to set the timestamps of %s %s",
                S_ISLNK (mode) ? "symbolic link" : "file",
                quotearg (to));
@@ -267,10 +272,10 @@ set_file_attributes (char const *to, enum file_attributes attr,
       /* May fail if we are not privileged to set the file owner, or we are
          not in group instat.st_gid.  Ignore those errors.  */
       if ((uid != -1 || gid != -1)
-         && lchown (to, uid, gid) != 0
+         && safe_lchown (to, uid, gid) != 0
          && (errno != EPERM
              || (uid != -1
-                 && lchown (to, (uid = -1), gid) != 0
+                 && safe_lchown (to, (uid = -1), gid) != 0
                  && errno != EPERM)))
        pfatal ("Failed to set the %s of %s %s",
                (uid == -1) ? "owner" : "owning group",
@@ -289,7 +294,7 @@ set_file_attributes (char const *to, enum file_attributes attr,
         systems where we could.  */
       if (lchmod (to, mode))
 #else
-      if (! S_ISLNK (mode) && chmod (to, mode) != 0)
+      if (! S_ISLNK (mode) && safe_chmod (to, mode) != 0)
 #endif
        pfatal ("Failed to set the permissions of %s %s",
                S_ISLNK (mode) ? "symbolic link" : "file",
@@ -382,8 +387,8 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
            say ("Creating empty file %s\n", quotearg (bakname));
 
          try_makedirs_errno = ENOENT;
-         unlink (bakname);
-         while ((fd = creat (bakname, 0666)) < 0)
+         safe_unlink (bakname);
+         while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
            {
              if (errno != try_makedirs_errno)
                pfatal ("Can't create file %s", quotearg (bakname));
@@ -400,7 +405,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
          if (debug & 4)
            say ("Renaming file %s to %s\n",
                 quotearg_n (0, to), quotearg_n (1, bakname));
-         while (rename (to, bakname) != 0)
+         while (safe_rename (to, bakname) != 0)
            {
              if (errno == try_makedirs_errno)
                {
@@ -411,7 +416,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
                {
                  create_backup_copy (to, bakname, to_st,
                                      try_makedirs_errno == 0);
-                 unlink (to);
+                 safe_unlink (to);
                  break;
                }
              else
@@ -423,23 +428,6 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
     }
 }
 
-/* Only allow symlink targets which are relative and free of ".." components:
- * otherwise, the operating system may follow one of those symlinks in a
- * pathname component, leading to a path traversal vulnerability.
- *
- * An alternative to disallowing many kinds of symlinks would be to implement
- * path traversal in user space using openat() without following symlinks
- * altogether.
- */
-static bool
-symlink_target_is_valid (char const *target, char const *to)
-{
-  bool is_valid = filename_is_safe (target);
-
-  /* Allow any symlink target if we are in the filesystem root.  */
-  return is_valid || cwd_is_root (to);
-}
-
 /* Move a file FROM (where *FROM_NEEDS_REMOVAL is nonzero if FROM
    needs removal when cleaning up at the end of execution, and where
    *FROMST is FROM's status if known),
@@ -475,7 +463,7 @@ move_file (char const *from, bool *from_needs_removal,
          char *buffer = xmalloc (PATH_MAX);
          int fd, size = 0, i;
 
-         if ((fd = open (from, O_RDONLY | O_BINARY)) < 0)
+         if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
            pfatal ("Can't reopen file %s", quotearg (from));
          while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0)
            size += i;
@@ -483,31 +471,20 @@ move_file (char const *from, bool *from_needs_removal,
            read_fatal ();
          buffer[size] = 0;
 
-         /* If we are allowed to create a file with an absolute path name,
-            anywhere, we also don't need to worry about symlinks that can
-            leave the working directory.  */
-         if (! (IS_ABSOLUTE_FILE_NAME (to)
-                || symlink_target_is_valid (buffer, to)))
-           {
-             fprintf (stderr, "symbolic link target '%s' is invalid\n",
-                      buffer);
-             fatal_exit (0);
-           }
-
          if (! backup)
            {
-             if (unlink (to) == 0)
+             if (safe_unlink (to) == 0)
                to_dir_known_to_exist = true;
            }
-         if (symlink (buffer, to) != 0)
+         if (safe_symlink (buffer, to) != 0)
            {
              if (errno == ENOENT && ! to_dir_known_to_exist)
                makedirs (to);
-             if (symlink (buffer, to) != 0)
+             if (safe_symlink (buffer, to) != 0)
                pfatal ("Can't create %s %s", "symbolic link", to);
            }
          free (buffer);
-         if (lstat (to, &to_st) != 0)
+         if (safe_lstat (to, &to_st) != 0)
            pfatal ("Can't get file attributes of %s %s", "symbolic link", to);
          insert_file_id (&to_st, CREATED);
        }
@@ -517,7 +494,7 @@ move_file (char const *from, bool *from_needs_removal,
            say ("Renaming file %s to %s\n",
                 quotearg_n (0, from), quotearg_n (1, to));
 
-         if (rename (from, to) != 0)
+         if (safe_rename (from, to) != 0)
            {
              bool to_dir_known_to_exist = false;
 
@@ -526,7 +503,7 @@ move_file (char const *from, bool *from_needs_removal,
                {
                  makedirs (to);
                  to_dir_known_to_exist = true;
-                 if (rename (from, to) == 0)
+                 if (safe_rename (from, to) == 0)
                    goto rename_succeeded;
                }
 
@@ -535,7 +512,7 @@ move_file (char const *from, bool *from_needs_removal,
                  struct stat tost;
                  if (! backup)
                    {
-                     if (unlink (to) == 0)
+                     if (safe_unlink (to) == 0)
                        to_dir_known_to_exist = true;
                      else if (errno != ENOENT)
                        pfatal ("Can't remove file %s", quotearg (to));
@@ -564,7 +541,7 @@ move_file (char const *from, bool *from_needs_removal,
     {
       if (debug & 4)
        say ("Removing file %s\n", quotearg (to));
-      if (unlink (to) != 0 && errno != ENOENT)
+      if (safe_unlink (to) != 0 && errno != ENOENT)
        pfatal ("Can't remove file %s", quotearg (to));
     }
 }
@@ -583,8 +560,8 @@ create_file (char const *file, int open_flags, mode_t mode,
   do
     {
       if (! (O_CREAT && O_TRUNC))
-       close (creat (file, mode));
-      fd = open (file, O_CREAT | O_TRUNC | open_flags, mode);
+       close (safe_open (file, O_CREAT | O_WRONLY | O_TRUNC, mode));
+      fd = safe_open (file, O_CREAT | O_TRUNC | open_flags, mode);
       if (fd < 0)
        {
          char *f;
@@ -605,7 +582,7 @@ copy_to_fd (const char *from, int tofd)
   int fromfd;
   ssize_t i;
 
-  if ((fromfd = open (from, O_RDONLY | O_BINARY)) < 0)
+  if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
     pfatal ("Can't reopen file %s", quotearg (from));
   while ((i = read (fromfd, buf, bufsize)) != 0)
     {
@@ -635,11 +612,11 @@ copy_file (char const *from, char const *to, struct stat *tost,
     {
       char *buffer = xmalloc (PATH_MAX);
 
-      if (readlink (from, buffer, PATH_MAX) < 0)
+      if (safe_readlink (from, buffer, PATH_MAX) < 0)
        pfatal ("Can't read %s %s", "symbolic link", from);
-      if (symlink (buffer, to) != 0)
+      if (safe_symlink (buffer, to) != 0)
        pfatal ("Can't create %s %s", "symbolic link", to);
-      if (tost && lstat (to, tost) != 0)
+      if (tost && safe_lstat (to, tost) != 0)
        pfatal ("Can't get file attributes of %s %s", "symbolic link", to);
       free (buffer);
     }
@@ -663,7 +640,7 @@ append_to_file (char const *from, char const *to)
 {
   int tofd;
 
-  if ((tofd = open (to, O_WRONLY | O_BINARY | O_APPEND)) < 0)
+  if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
     pfatal ("Can't reopen file %s", quotearg (to));
   copy_to_fd (from, tofd);
   if (close (tofd) != 0)
@@ -730,8 +707,8 @@ version_controller (char const *filename, bool readonly,
 
   sprintf (trybuf, "%s/", dir);
 
-#define try1(f,a1)    (sprintf (trybuf + dirlen, f, a1),    stat (trybuf, &cstat) == 0)
-#define try2(f,a1,a2) (sprintf (trybuf + dirlen, f, a1,a2), stat (trybuf, &cstat) == 0)
+#define try1(f,a1)    (sprintf (trybuf + dirlen, f, a1),    safe_stat (trybuf, &cstat) == 0)
+#define try2(f,a1,a2) (sprintf (trybuf + dirlen, f, a1,a2), safe_stat (trybuf, &cstat) == 0)
 
   /* Check that RCS file is not working file.
      Some hosts don't report file name length errors.  */
@@ -862,7 +839,7 @@ version_get (char const *filename, char const *cs, bool exists, bool readonly,
             cs, readonly ? "" : " with lock");
       if (systemic (getbuf) != 0)
        fatal ("Can't get file %s from %s", quotearg (filename), cs);
-      if (stat (filename, filestat) != 0)
+      if (safe_stat (filename, filestat) != 0)
        pfatal ("%s", quotearg (filename));
     }
 
@@ -1301,6 +1278,9 @@ makedirs (char const *name)
   char *f;
   char *flim = replace_slashes (filename);
 
+  /* FIXME: Now with the pathname lookup cache, there is no reason for
+     deferring the creation of directories. Callers should be updated. */
+
   if (flim)
     {
       /* Create any missing directories, replacing NULs by '/'s.
@@ -1311,7 +1291,7 @@ makedirs (char const *name)
       for (f = filename;  f <= flim;  f++)
        if (!*f)
          {
-           mkdir (filename,
+           safe_mkdir (filename,
                   S_IRUSR|S_IWUSR|S_IXUSR
                   |S_IRGRP|S_IWGRP|S_IXGRP
                   |S_IROTH|S_IWOTH|S_IXOTH);
@@ -1341,7 +1321,7 @@ removedirs (char const *name)
                              || ISSLASH (filename[i - 3])))))))
       {
        filename[i] = '\0';
-       if (rmdir (filename) == 0 && verbosity == VERBOSE)
+       if (safe_rmdir (filename) == 0 && verbosity == VERBOSE)
          say ("Removed empty directory %s\n", quotearg (filename));
        filename[i] = '/';
       }
@@ -1656,10 +1636,15 @@ make_tempfile (char const **name, char letter, char const *real_name,
     {
       int fd;
 
+      /* gen_tempname(..., GT_NOCREATE) calls lstat() to check if a file
+        already exists.  In the worst case, this leads to a template that
+        follows a symbolic link and that we cannot use; safe_open() will
+        detect that. */
+
       if (gen_tempname (template, 0, flags, GT_NOCREATE))
         pfatal ("Can't create temporary file %s", template);
     retry:
-      fd = open (template, O_CREAT | O_EXCL | flags, mode);
+      fd = safe_open (template, O_CREAT | O_EXCL | flags, mode);
       if (fd == -1)
         {
          if (errno == try_makedirs_errno)
@@ -1682,7 +1667,7 @@ make_tempfile (char const **name, char letter, char const *real_name,
 int stat_file (char const *filename, struct stat *st)
 {
   int (*xstat)(char const *, struct stat *) =
-    follow_symlinks ? stat : lstat;
+    follow_symlinks ? safe_stat : safe_lstat;
 
   return xstat (filename, st) == 0 ? 0 : errno;
 }
index 6b3308a0ec2ad1f4bed41cdba66140a00e84d079..ab46540db0fbbc361f8892c46046a317dc869277 100644 (file)
@@ -18,7 +18,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <utimens.h>
 #include <timespec.h>
 #include <stat-time.h>
 #include <backupfile.h>
index cfc4f37abc96e293f3e22ca924e18db179d1268c..91c9dce8d201ee7553f1923effd06ccaf35651d8 100644 (file)
@@ -34,6 +34,7 @@ TESTS = \
        file-modes \
        filename-choice \
        git-binary-diff \
+       garbage \
        global-reject-files \
        inname \
        line-numbers \
@@ -42,6 +43,7 @@ TESTS = \
        mixed-patch-types \
        munged-context-format \
        need-filename \
+       no-mode-change-git-diff \
        no-newline-triggers-assert \
        preserve-c-function-names \
        preserve-mode-and-timestamp \
@@ -52,7 +54,8 @@ TESTS = \
        remember-reject-files \
        remove-directories \
        symlinks \
-       unmodified-files
+       unmodified-files \
+       deep-directories
 
 XFAIL_TESTS = \
        dash-o-append
index e21ab79383fdbc55e0bc09b7c4927423cce2753e..838b98e89d457e8561a0776ad20b51fdab1cc799 100644 (file)
@@ -100,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
        $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
+       $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
        $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
        $(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
        $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
@@ -109,52 +110,61 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
        $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
        $(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
-       $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+       $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+       $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+       $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+       $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
        $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+       $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
        $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
        $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/gnulib-comp.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
        $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
-       $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
        $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
        $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
        $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
        $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
        $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
        $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
        $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+       $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+       $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
        $(top_srcdir)/m4/msvc-inval.m4 \
        $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
        $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+       $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
        $(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
        $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
        $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
        $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
-       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
-       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+       $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+       $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
        $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
-       $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
-       $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
-       $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
-       $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
-       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
-       $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+       $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+       $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+       $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
        $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
        $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
-       $(top_srcdir)/m4/sys_socket_h.m4 \
+       $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
        $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
        $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
        $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
        $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
        $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
-       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+       $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+       $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+       $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
        $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
        $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
        $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
@@ -771,6 +781,7 @@ HAVE_LINK = @HAVE_LINK@
 HAVE_LINKAT = @HAVE_LINKAT@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
 HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBRLEN = @HAVE_MBRLEN@
 HAVE_MBRTOWC = @HAVE_MBRTOWC@
 HAVE_MBSINIT = @HAVE_MBSINIT@
@@ -1127,6 +1138,7 @@ STRIP = @STRIP@
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
 UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 VERSION = @VERSION@
@@ -1214,6 +1226,7 @@ TESTS = \
        file-modes \
        filename-choice \
        git-binary-diff \
+       garbage \
        global-reject-files \
        inname \
        line-numbers \
@@ -1222,6 +1235,7 @@ TESTS = \
        mixed-patch-types \
        munged-context-format \
        need-filename \
+       no-mode-change-git-diff \
        no-newline-triggers-assert \
        preserve-c-function-names \
        preserve-mode-and-timestamp \
@@ -1232,7 +1246,8 @@ TESTS = \
        remember-reject-files \
        remove-directories \
        symlinks \
-       unmodified-files
+       unmodified-files \
+       deep-directories
 
 XFAIL_TESTS = \
        dash-o-append
@@ -1549,6 +1564,13 @@ git-binary-diff.log: git-binary-diff
        --log-file $$b.log --trs-file $$b.trs \
        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
        "$$tst" $(AM_TESTS_FD_REDIRECT)
+garbage.log: garbage
+       @p='garbage'; \
+       b='garbage'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
 global-reject-files.log: global-reject-files
        @p='global-reject-files'; \
        b='global-reject-files'; \
@@ -1605,6 +1627,13 @@ need-filename.log: need-filename
        --log-file $$b.log --trs-file $$b.trs \
        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
        "$$tst" $(AM_TESTS_FD_REDIRECT)
+no-mode-change-git-diff.log: no-mode-change-git-diff
+       @p='no-mode-change-git-diff'; \
+       b='no-mode-change-git-diff'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
 no-newline-triggers-assert.log: no-newline-triggers-assert
        @p='no-newline-triggers-assert'; \
        b='no-newline-triggers-assert'; \
@@ -1682,6 +1711,13 @@ unmodified-files.log: unmodified-files
        --log-file $$b.log --trs-file $$b.trs \
        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
        "$$tst" $(AM_TESTS_FD_REDIRECT)
+deep-directories.log: deep-directories
+       @p='deep-directories'; \
+       b='deep-directories'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
 .test.log:
        @p='$<'; \
        $(am__set_b); \
index 6929c4a2dceee4eb8ddc9e83fc8a9be0496939ba..d6979d90744dbabca766a77d6f31f7a9298f0c13 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index a51142c8be4ae867fd93de6e0b6bfea75c81d524..e37d6028ffd780392b2d030b0dbbf203af8b7976 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 022eeda4808696b58696e105c77444bf326e4639..551553af87558d7164bb68a25f733cbbe13d3bf5 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index c78da531f91ecb707c12c30e8b0b134ed21ede8d..f8bf911bfdd6264910c163270ba85776cfd5363c 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 40f53d12842c6cb3cd465f1ed5a53a31754bd841..fd5fd6446be4a84e830aa7a3ce0be1df61d4588c 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 17215aa8e92dfb34372a2e752e14a05eab3c70f3..ad001f8ad941739f955bde67f44c7e56e31d400f 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 404d99e6814757cc8971dc6afc7003e6e56513ff..2ec80df4a6bc8c33f06c6821f25e76de71874ef5 100644 (file)
@@ -6,8 +6,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
index 7b5a706fd61b8311eb179bb735b00c2c7ef8a9a4..5e7b611fa8451f39c5b0027a118077160af53626 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index b704dc860a72abfe1e965a577d5bcad8f9b8f6e3..239149cf0eb1538efaa8397e0f72b158e8ee9dd8 100644 (file)
@@ -8,8 +8,8 @@
 
 . $srcdir/test-lib.sh
 
-require_gnu_diff
-require_sed
+require gnu_diff
+require sed
 use_local_patch
 use_tmpdir
 
index 163369980c9c9a268aa21f5b7d172a6b820d955c..c6c2d4a38367b30f222213ef3ae58d552b1aa194 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
diff --git a/tests/deep-directories b/tests/deep-directories
new file mode 100755 (executable)
index 0000000..d6a41a6
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+# Exercise the directory file descriptor cache
+
+# Artificially limit to 8 cache entries
+ulimit -n 32 >& /dev/null || exit 77
+
+cat > ab.diff <<EOF
+--- /dev/null
++++ b/1/2/3/4/5/6/7/8/9/foo
+@@ -0,0 +1 @@
++foo
+EOF
+
+check 'patch -p1 < ab.diff || echo Status: $?' <<EOF
+patching file 1/2/3/4/5/6/7/8/9/foo
+EOF
index 66319ec03a7ff894944fe3bacbafb965d06462e6..6c8708f7355923e83f917993fb68e5e2e5af965a 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 umask 022
index 9e075581734164a2a610db64947a05ddda1c1c2b..a669aba3ee57542b6dd406ad514fad556cb6eec1 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index e71c209f8a9ddc1ac65c02833cd47a1e49278793..b615099c9a93e8226e19eae2ece7f59a7897046d 100644 (file)
@@ -8,8 +8,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
index 88fc805de2aa0cd4b32fa5fe635d90b602dfbcc5..1d011bccd5cc3f8f1e7f346299d5c8b3a1bd2b1f 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
diff --git a/tests/garbage b/tests/garbage
new file mode 100644 (file)
index 0000000..3ac5d9c
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > bad.diff <<EOF
+ ***************
+*** 0 ****
+--- 1 ----
++ foo
+EOF
+
+check 'patch foo -i bad.diff || echo "Status: $?"' <<EOF
+$PATCH: **** Only garbage was found in the patch input.
+Status: 2
+EOF
index 2b3f3a201fbca4cb3150bd6a45f25db3eb934902..21c5df1eb83be08910e002c2c1276dda2270d857 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 65c57dde0f9233f2b5cda890ba1e63d686d4d1f5..6426d036daa7e59fadbd06f20f9af457a3eee0ce 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 080a0cccf5c9bde04b233e7ce4b0a3f004d70868..b5ec9f32eb9b83dc56ecddff45eddcaad0f7c879 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index fc8304227783c4c886a07b9bcf1c8a7fc982aff4..e9b0cfebf49573b2babcd1994ac291d3aa8f86fa 100644 (file)
@@ -6,8 +6,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
index 8826ae9c82f240903260d7fb46232732f6995867..d05c1716b76e0dfd9ec7925274a46ea719fc2cc9 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 8e01edcd5c2d1e27cc3d91920640e8e3193a2eb5..22d787b2ef7494a710e6d332b4df22c90f0e83c5 100644 (file)
@@ -8,9 +8,9 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_gnu_diff
-require_sed
+require cat
+require gnu_diff
+require sed
 use_local_patch
 use_tmpdir
 
index da17c757285ec04874c03352ae7d233fcca2a253..2465c0bd7f434806ea63be44fa623ddba4ff6904 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 umask 022
index 3cd166c26fa159b46eb351ab24985ce8812bb488..50c95c86cdce414152a05e96ea4d383a3c668377 100644 (file)
@@ -8,8 +8,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
index 37480645286bfbbb73ddb7863e8c280b54d67e3d..8b92848ac033ba68bdfc8a3199a9c614e9e11b5b 100644 (file)
@@ -8,8 +8,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
diff --git a/tests/no-mode-change-git-diff b/tests/no-mode-change-git-diff
new file mode 100644 (file)
index 0000000..2f9bc36
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright (C) 2010-2012 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+require chmod
+require stat
+use_local_patch
+use_tmpdir
+
+echo 'ksplice' > f
+chmod 755 f
+
+cat > simple.diff <<EOF
+diff --git a/f b/f
+index 422a422a..736b6c7063690a 100644
+--- a/f
++++ b/f
+@@ -1 +1 @@
+-ksplice
++ksplice rocks!
+EOF
+
+check 'patch -p1 < simple.diff || echo "Status:  $?"' <<EOF
+patching file f
+EOF
+
+check 'stat -c "%a" f'<<EOF
+755
+EOF
index 7c2e7eb3ad40e221e7c853d8147292fa511ec3ec..855ba706bc31cbd1d777bcef844d1df614f68918 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 813360ec86f56e747f2c7b69fdb3e17a7a978b83..789fa61161d3c584ef058b302bd38e0a41d58742 100644 (file)
@@ -8,8 +8,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_gnu_diff
+require cat
+require gnu_diff
 use_local_patch
 use_tmpdir
 
index 170aff5ef6a2ab0e5f45327f0d632a05bb028cba..18c3c9180d72293493b727f3a71f9cc16aca66bd 100644 (file)
@@ -6,8 +6,8 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
+require cat
+require sed
 use_local_patch
 use_tmpdir
 
index 5fb9f124b5e614c7f52679d29c6ac1367aed8f2f..08f312f15f2da8806cf1d8da166c6c2cea057d68 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 918b97acf361e09232791594b377b24aff9c3ec2..bcc11a49e719012cb08d244d94ef36318ebfebec 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 0b02af6af89677296a9c5fb8aa684e99b00911d8..3c533c606fbb6340f4acdbfab6fc7cfa3da61fa9 100644 (file)
@@ -8,9 +8,9 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
-require_sed
-require_gnu_diff
+require cat
+require sed
+require gnu_diff
 use_local_patch
 use_tmpdir
 
index b5443298715498b79306bfcf00075269fe90ae73..7ca0e86cf31257fe5f0d61e32c416132c4d06f46 100644 (file)
@@ -9,7 +9,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 93b64134164ccd783a031f219cd70165ef19b08f..78c6335d8bd9b91c1df92b46259d216dc7628a80 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 6acdc493b8fe93d1872a7cbc55df195c51d8897b..07112eb4fa4c94ab083eeb29c2714c4bdcd9f14f 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
index 04a9b7307292fb4b4c45a20b11f376af34b38be3..36fbb1efc1a2054a6d0e4d0896fbe4b7e7b8ce42 100644 (file)
@@ -8,7 +8,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir
 
@@ -152,20 +152,45 @@ ncheck 'test ! -L symlink'
 # guarantee that they won't end up higher up in the working tree than we think;
 # the path to the symlink may follow symlinks itself.
 #
-#cat > symlink-target.diff <<EOF
-#diff --git a/dir/foo b/dir/foo
-#new file mode 120000
-#index 0000000..cad2309
-#--- /dev/null
-#+++ b/dir/foo
-#@@ -0,0 +1 @@
-#+../foo
-#\ No newline at end of file
-#EOF
-#
-#check 'patch -p1 < symlink-target.diff || echo "Status: $?"' <<EOF
-#patching symbolic link dir/foo
-#EOF
+cat > symlink-target.diff <<EOF
+diff --git a/dir/foo b/dir/foo
+new file mode 120000
+index 0000000..cad2309
+--- /dev/null
++++ b/dir/foo
+@@ -0,0 +1 @@
++../foo
+\ No newline at end of file
+EOF
+
+check 'patch -p1 < symlink-target.diff || echo "Status: $?"' <<EOF
+patching symbolic link dir/foo
+EOF
+
+rm -f dir/foo
+cat > follow-symlink.diff <<EOF
+diff --git a/dir/foo b/dir/foo
+new file mode 120000
+index 0000000..cad2309
+--- /dev/null
++++ b/dir/foo
+@@ -0,0 +1 @@
++..
+\ No newline at end of file
+diff --git a/dir/foo/bar b/dir/foo/bar
+new file mode 100644
+index 0000000..2ab772d
+--- /dev/null
++++ b/dir/foo/bar
+@@ -0,0 +1 @@
++created in ..
+EOF
+
+check 'patch -f -p1 < follow-symlink.diff || echo "Status: $?"' <<EOF
+patching symbolic link dir/foo
+Refusing to follow symbolic link dir/foo
+Status: 2
+EOF
 
 cat > bad-symlink-target1.diff <<EOF
 diff --git a/bar b/bar
@@ -180,8 +205,6 @@ EOF
 
 check 'patch -p1 < bad-symlink-target1.diff || echo "Status: $?"' <<EOF
 patching symbolic link bar
-symbolic link target '/bar' is invalid
-Status: 2
 EOF
 
 cat > bad-symlink-target2.diff <<EOF
@@ -197,8 +220,6 @@ EOF
 
 check 'patch -p1 < bad-symlink-target2.diff || echo "Status: $?"' <<EOF
 patching symbolic link baz
-symbolic link target '../baz' is invalid
-Status: 2
 EOF
 
 # --------------------------------------------------------------
@@ -238,3 +259,20 @@ check 'echo b > symlink.orig && cat target2' <<EOF
 b
 EOF
 rm -f target2
+
+# --------------------------------------------------------------
+# Make sure we do follow symlinks to patch files.
+
+ncheck 'mkdir d'
+cat > d/ab.diff <<EOF
+--- /dev/null
++++ b/foo
+@@ -0,0 +1 @@
++foo
+EOF
+
+ncheck 'ln -sf d l'
+
+check 'patch -p1 -i l/ab.diff' <<EOF
+patching file foo
+EOF
index 051f1a03859148cb8da3df7b75b76acde25ae671..be0d7e3fcb749e132819ae38ea9cee3f89ff8f25 100644 (file)
@@ -7,13 +7,6 @@
 
 # FIXME: Requires a version of diff that understands "-u".
 
-require_cat() {
-    if ! type cat > /dev/null 2> /dev/null; then
-       echo "This test requires the cat utility" >&2
-       exit 77
-    fi
-}
-
 require_gnu_diff() {
     case "`diff --version 2> /dev/null`" in
     *GNU*)
@@ -24,9 +17,12 @@ require_gnu_diff() {
     esac
 }
 
-require_sed() {
-    if ! type sed > /dev/null 2> /dev/null; then
-       echo "This test requires the sed utility" >&2
+require() {
+    utility="$1"
+    if type require_${utility} > /dev/null 2> /dev/null; then
+       require_${utility}
+    elif ! type "${utility}" > /dev/null 2> /dev/null; then
+       echo "This test requires the ${utility} utility" >&2
        exit 77
     fi
 }
@@ -163,7 +159,7 @@ if ! type seq > /dev/null 2> /dev/null; then
     )}
 fi
 
-require_cat
+require cat
 clean_env
 
 checks_succeeded=0
index a9e00c6ded8e772417a218caefd07dec6fac46a4..fd5eee61eb0f13ce4c01bab30e015fcc9119ae79 100644 (file)
@@ -6,7 +6,7 @@
 
 . $srcdir/test-lib.sh
 
-require_cat
+require cat
 use_local_patch
 use_tmpdir