Merge from Gnulib

This incorporates:
2017-11-11 faccessat: port to macOS (Bug#29231)
2017-11-05 fstatat: pacify GCC on unusual platform
* build-aux/config.guess, build-aux/config.sub:
* doc/misc/texinfo.tex, lib/faccessat.c, lib/fstatat.c:
* lib/unistd.in.h, m4/faccessat.m4, m4/unistd_h.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
Paul Eggert 2017-11-11 23:11:03 -08:00
parent e470d16448
commit 7775c47298
10 changed files with 92 additions and 25 deletions

View file

@ -2,7 +2,7 @@
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2017 Free Software Foundation, Inc. # Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-11-01' timestamp='2017-11-07'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on. Output the configuration name of the system \`$me' is run on.
Operation modes: Options:
-h, --help print this help, then exit -h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit -t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit -v, --version print version number, then exit
@ -244,6 +244,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;; exit ;;
*:MidnightBSD:*:*)
echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;; exit ;;
@ -479,7 +482,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif #endif
#if defined (host_mips) && defined (MIPSEB) #if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV) #if defined (SYSTYPE_SYSV)
printf ("mips-mips-risco0s%ssysv\\n", argv[1]); exit (0); printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif #endif
#if defined (SYSTYPE_SVR4) #if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);

View file

@ -2,7 +2,7 @@
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2017 Free Software Foundation, Inc. # Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-11-01' timestamp='2017-11-04'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name. Canonicalize a configuration name.
Operation modes: Options:
-h, --help print this help, then exit -h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit -t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit -v, --version print version number, then exit
@ -313,7 +313,6 @@ case $basic_machine in
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \ | visium \
| wasm32 \ | wasm32 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown

View file

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex. % Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
% %
\def\texinfoversion{2017-09-16.10} \def\texinfoversion{2017-09-11.18}
% %
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -11425,9 +11425,11 @@
% %
\dimen0 = #1\relax \dimen0 = #1\relax
\advance\dimen0 by \voffset \advance\dimen0 by \voffset
\advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
% %
\dimen2 = \hsize \dimen2 = \hsize
\advance\dimen2 by \normaloffset \advance\dimen2 by \normaloffset
\advance\dimen2 by 1in % reference point is 1 inch from left edge of page
% %
\internalpagesizes{#1}{\hsize}% \internalpagesizes{#1}{\hsize}%
{\voffset}{\normaloffset}% {\voffset}{\normaloffset}%

View file

@ -16,10 +16,31 @@
/* written by Eric Blake */ /* written by Eric Blake */
/* If the user's config.h happens to include <unistd.h>, let it include only
the system's <unistd.h> here, so that orig_faccessat doesn't recurse to
rpl_faccessat. */
#define _GL_INCLUDING_UNISTD_H
#include <config.h> #include <config.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#undef _GL_INCLUDING_UNISTD_H
#if HAVE_FACCESSAT
static int
orig_faccessat (int fd, char const *name, int mode, int flag)
{
return faccessat (fd, name, mode, flag);
}
#endif
/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <unistd.h>
above. */
#include "unistd.h"
#ifndef HAVE_ACCESS #ifndef HAVE_ACCESS
/* Mingw lacks access, but it also lacks real vs. effective ids, so /* Mingw lacks access, but it also lacks real vs. effective ids, so
@ -28,6 +49,29 @@
# define access euidaccess # define access euidaccess
#endif #endif
#if HAVE_FACCESSAT
int
rpl_faccessat (int fd, char const *file, int mode, int flag)
{
int result = orig_faccessat (fd, file, mode, flag);
if (result == 0 && file[strlen (file) - 1] == '/')
{
struct stat st;
result = fstatat (fd, file, &st, 0);
if (result == 0 && !S_ISDIR (st.st_mode))
{
errno = ENOTDIR;
return -1;
}
}
return result;
}
#else /* !HAVE_FACCESSAT */
/* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory /* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory
open on descriptor FD. If possible, do it without changing the open on descriptor FD. If possible, do it without changing the
working directory. Otherwise, resort to using save_cwd/fchdir, then working directory. Otherwise, resort to using save_cwd/fchdir, then
@ -43,3 +87,5 @@
# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag # define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
# define AT_FUNC_POST_FILE_ARGS , mode # define AT_FUNC_POST_FILE_ARGS , mode
# include "at-func.c" # include "at-func.c"
#endif

View file

@ -28,7 +28,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#undef __need_system_sys_stat_h #undef __need_system_sys_stat_h
#if HAVE_FSTATAT #if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
static int static int
orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
{ {

View file

@ -689,6 +689,7 @@ REPLACE_DIRFD = @REPLACE_DIRFD@
REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DPRINTF = @REPLACE_DPRINTF@
REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP = @REPLACE_DUP@
REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_DUP2 = @REPLACE_DUP2@
REPLACE_FACCESSAT = @REPLACE_FACCESSAT@
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCLOSE = @REPLACE_FCLOSE@
REPLACE_FCNTL = @REPLACE_FCNTL@ REPLACE_FCNTL = @REPLACE_FCNTL@
@ -2986,6 +2987,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \

View file

@ -461,6 +461,17 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
#if @GNULIB_FACCESSAT@ #if @GNULIB_FACCESSAT@
# if @REPLACE_FACCESSAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef faccessat
# define faccessat rpl_faccessat
# endif
_GL_FUNCDECL_RPL (faccessat, int,
(int fd, char const *name, int mode, int flag)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (faccessat, int,
(int fd, char const *name, int mode, int flag));
# else
# if !@HAVE_FACCESSAT@ # if !@HAVE_FACCESSAT@
_GL_FUNCDECL_SYS (faccessat, int, _GL_FUNCDECL_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag) (int fd, char const *file, int mode, int flag)
@ -468,6 +479,7 @@ _GL_FUNCDECL_SYS (faccessat, int,
# endif # endif
_GL_CXXALIAS_SYS (faccessat, int, _GL_CXXALIAS_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag)); (int fd, char const *file, int mode, int flag));
# endif
_GL_CXXALIASWARN (faccessat); _GL_CXXALIASWARN (faccessat);
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef faccessat # undef faccessat

View file

@ -1,4 +1,4 @@
# serial 6 # serial 7
# See if we need to provide faccessat replacement. # See if we need to provide faccessat replacement.
dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl Copyright (C) 2009-2017 Free Software Foundation, Inc.
@ -18,10 +18,12 @@ AC_DEFUN([gl_FUNC_FACCESSAT],
AC_CHECK_FUNCS_ONCE([faccessat]) AC_CHECK_FUNCS_ONCE([faccessat])
if test $ac_cv_func_faccessat = no; then if test $ac_cv_func_faccessat = no; then
HAVE_FACCESSAT=0 HAVE_FACCESSAT=0
elif test "$gl_cv_func_lstat_dereferences_slashed_symlink" != yes; then
REPLACE_FACCESSAT=1
fi fi
]) ])
# Prerequisites of lib/faccessat.m4. # Prerequisites of lib/faccessat.c.
AC_DEFUN([gl_PREREQ_FACCESSAT], AC_DEFUN([gl_PREREQ_FACCESSAT],
[ [
AC_CHECK_FUNCS([access]) AC_CHECK_FUNCS([access])

View file

@ -222,7 +222,7 @@ AC_DEFUN([gl_INIT],
gl_STRING_MODULE_INDICATOR([explicit_bzero]) gl_STRING_MODULE_INDICATOR([explicit_bzero])
AC_REQUIRE([gl_EXTERN_INLINE]) AC_REQUIRE([gl_EXTERN_INLINE])
gl_FUNC_FACCESSAT gl_FUNC_FACCESSAT
if test $HAVE_FACCESSAT = 0; then if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
AC_LIBOBJ([faccessat]) AC_LIBOBJ([faccessat])
gl_PREREQ_FACCESSAT gl_PREREQ_FACCESSAT
fi fi
@ -593,16 +593,16 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true
fi fi
} }
if test $HAVE_FACCESSAT = 0; then if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
fi fi
if test $HAVE_FACCESSAT = 0; then if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_dosname func_gl_gnulib_m4code_dosname
fi fi
if test $HAVE_FACCESSAT = 0; then if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_euidaccess func_gl_gnulib_m4code_euidaccess
fi fi
if test $HAVE_FACCESSAT = 0; then if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
fi fi
if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 70 # unistd_h.m4 serial 71
dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl Copyright (C) 2006-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -159,6 +159,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])