From 78669517dc3db4d6d51fb26d71073fc0c196ab5d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 22 Sep 2019 23:50:59 -0700 Subject: [PATCH] Update from Gnulib This incorporates: 2019-09-22 Update some URLs 2019-09-15 fcntl-h: fix compilation error of creat.c on MSVC 2019-09-15 creat: new module 2019-09-15 access: new module 2019-09-09 Add option to assume best, not worst, when cross-compiling. * build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex: * lib/careadlinkat.c, lib/careadlinkat.h, lib/count-leading-zeros.h: * lib/count-trailing-zeros.h, lib/diffseq.h, lib/fcntl.in.h: * lib/ftoastr.c, lib/get-permissions.c: * lib/ieee754.in.h, lib/inttypes.in.h, lib/mktime.c, lib/open.c: * lib/pathmax.h, lib/pipe2.c, lib/stddef.in.h, lib/stdint.in.h: * lib/stdlib.in.h, lib/str-two-way.h, lib/string.in.h, lib/time.in.h: * lib/timegm.c, lib/unistd.in.h, m4/canonicalize.m4: * m4/extern-inline.m4, m4/fcntl_h.m4, m4/fdopendir.m4: * m4/getgroups.m4, m4/getopt.m4, m4/gettimeofday.m4: * m4/gnulib-common.m4, m4/largefile.m4: * m4/lstat.m4, m4/memmem.m4, m4/mktime.m4, m4/nocrash.m4, m4/open.m4: * m4/pselect.m4, m4/putenv.m4, m4/readlink.m4, m4/regex.m4: * m4/symlink.m4, m4/unistd_h.m4, m4/utimens.m4, m4/utimes.m4: Copy from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * m4/open-slash.m4: New file, copied from Gnulib. --- build-aux/config.guess | 5 ++- build-aux/config.sub | 2 +- doc/misc/texinfo.tex | 18 +++++++---- lib/careadlinkat.c | 2 +- lib/careadlinkat.h | 2 +- lib/count-leading-zeros.h | 2 +- lib/count-trailing-zeros.h | 2 +- lib/diffseq.h | 4 +-- lib/fcntl.in.h | 38 +++++++++++++++++++---- lib/ftoastr.c | 2 +- lib/get-permissions.c | 2 +- lib/gnulib.mk.in | 10 +++++- lib/ieee754.in.h | 2 +- lib/inttypes.in.h | 2 +- lib/mktime.c | 2 +- lib/open.c | 21 ++----------- lib/pathmax.h | 2 +- lib/pipe2.c | 2 +- lib/stddef.in.h | 2 +- lib/stdint.in.h | 2 +- lib/stdlib.in.h | 4 +-- lib/str-two-way.h | 2 +- lib/string.in.h | 2 +- lib/time.in.h | 20 ++++++------ lib/timegm.c | 2 +- lib/unistd.in.h | 62 ++++++++++++++++++++++++-------------- m4/canonicalize.m4 | 6 ++-- m4/extern-inline.m4 | 2 +- m4/fcntl_h.m4 | 4 ++- m4/fdopendir.m4 | 6 ++-- m4/getgroups.m4 | 14 +++------ m4/getopt.m4 | 8 +++-- m4/gettimeofday.m4 | 6 ++-- m4/gnulib-common.m4 | 31 +++++++++++++++++-- m4/gnulib-comp.m4 | 1 + m4/largefile.m4 | 2 +- m4/lstat.m4 | 6 ++-- m4/memmem.m4 | 6 ++-- m4/mktime.m4 | 4 +-- m4/nocrash.m4 | 4 +-- m4/open-slash.m4 | 59 ++++++++++++++++++++++++++++++++++++ m4/open.m4 | 41 +------------------------ m4/pselect.m4 | 6 ++-- m4/putenv.m4 | 6 ++-- m4/readlink.m4 | 6 ++-- m4/regex.m4 | 6 ++-- m4/symlink.m4 | 6 ++-- m4/unistd_h.m4 | 10 +++--- m4/utimens.m4 | 6 ++-- m4/utimes.m4 | 4 +-- 50 files changed, 281 insertions(+), 185 deletions(-) create mode 100644 m4/open-slash.m4 diff --git a/build-aux/config.guess b/build-aux/config.guess index 97ad0733304..7f9ebbe3109 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2019 Free Software Foundation, Inc. -timestamp='2019-07-24' +timestamp='2019-09-10' # 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 @@ -274,6 +274,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; + *:Twizzler:*:*) + echo "$UNAME_MACHINE"-unknown-twizzler + exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; diff --git a/build-aux/config.sub b/build-aux/config.sub index a318a468685..0f2234c174d 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -1343,7 +1343,7 @@ case $os in | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index d2e895f3628..df43c1e26ed 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-08-18.20} +\def\texinfoversion{2019-09-20.22} % % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. % @@ -1052,7 +1052,7 @@ where each line of input produces a line of output.} tex.sprint( string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o', - (c / 256), (c % 256))) + math.floor(c / 256), math.floor(c % 256))) else c = c - 0x10000 local c_hi = c / 1024 + 0xd800 @@ -1062,8 +1062,8 @@ where each line of input produces a line of output.} string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o' .. string.char(0x5c) .. string.char(0x25) .. '03o', - (c_hi / 256), (c_hi % 256), - (c_lo / 256), (c_lo % 256))) + math.floor(c_hi / 256), math.floor(c_hi % 256), + math.floor(c_lo / 256), math.floor(c_lo % 256))) end end end @@ -1076,15 +1076,19 @@ where each line of input produces a line of output.} function PDFescstr(str) for c in string.bytes(str) do if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then - tex.sprint( + tex.sprint(-2, string.format(string.char(0x5c) .. string.char(0x25) .. '03o', c)) else - tex.sprint(string.char(c)) + tex.sprint(-2, string.char(c)) end end end } + % The -2 in the arguments here gives all the input to TeX catcode 12 + % (other) or 10 (space), preventing undefined control sequence errors. See + % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html + % \endgroup \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} \ifnum\luatexversion>84 @@ -4843,6 +4847,7 @@ end \definedummyletter\ % \definedummyletter\{% \definedummyletter\}% + \definedummyletter\&% % % Do the redefinitions. \definedummies @@ -4913,6 +4918,7 @@ end \definedummyword\TeX % % Assorted special characters. + \definedummyword\ampchar \definedummyword\atchar \definedummyword\arrow \definedummyword\backslashchar diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index e56d5030856..480326577c1 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -54,7 +54,7 @@ The PREADLINKAT function specifies how to read links. It operates like POSIX readlinkat() - + but can assume that its first argument is the same as FD. If successful, return the buffer address; otherwise return NULL and diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 68b69aa8893..3c08fd6d102 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -40,7 +40,7 @@ struct allocator; The PREADLINKAT function specifies how to read links. It operates like POSIX readlinkat() - + but can assume that its first argument is the same as FD. If successful, return the buffer address; otherwise return NULL and diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index e5ac2e12606..cf867acc530 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -71,7 +71,7 @@ COUNT_LEADING_ZEROS_INLINE int count_leading_zeros_32 (unsigned int x) { /* - */ + */ static const char de_Bruijn_lookup[32] = { 31, 22, 30, 21, 18, 10, 29, 2, 20, 17, 15, 13, 9, 6, 28, 1, 23, 19, 11, 3, 16, 14, 7, 24, 12, 4, 8, 25, 5, 26, 27, 0 diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index 3f78696e30f..7988e4bff44 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -69,7 +69,7 @@ COUNT_TRAILING_ZEROS_INLINE int count_trailing_zeros_32 (unsigned int x) { /* - */ + */ static const char de_Bruijn_lookup[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 diff --git a/lib/diffseq.h b/lib/diffseq.h index c6aac3d8120..c48da0c98d9 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -28,13 +28,13 @@ The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, Algorithmica Vol. 1, 1986, pp. 251-266, - . + . See especially section 4.2, which describes the variation used below. The basic algorithm was independently discovered as described in: "Algorithms for Approximate String Matching", Esko Ukkonen, Information and Control Vol. 64, 1985, pp. 100-118, - . + . Unless the 'find_minimal' flag is set, this code uses the TOO_EXPENSIVE heuristic, by Paul Eggert, to limit the cost to O(N**1.5 log N) diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index eb70dc61eca..abe7993e21c 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -39,6 +39,12 @@ #endif #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ +/* Native Windows platforms declare open(), creat() in . */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include +#endif + #else /* Normal invocation convention. */ @@ -59,6 +65,12 @@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ +/* Native Windows platforms declare open(), creat() in . */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include +#endif + #ifndef _@GUARD_PREFIX@_FCNTL_H #define _@GUARD_PREFIX@_FCNTL_H @@ -66,12 +78,6 @@ # include #endif -/* Native Windows platforms declare open(), creat() in . */ -#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ - && (defined _WIN32 && ! defined __CYGWIN__) -# include -#endif - /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -82,6 +88,26 @@ /* Declare overridden functions. */ +#if @GNULIB_CREAT@ +# if @REPLACE_CREAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat rpl_creat +# endif +_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (creat); +#elif defined GNULIB_POSIXCHECK +# undef creat +/* Assume creat is always declared. */ +_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " + "use gnulib module creat for portability"); +#endif + #if @GNULIB_FCNTL@ # if @REPLACE_FCNTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/ftoastr.c b/lib/ftoastr.c index 55f1e02e80f..ffd51d638c5 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c @@ -105,7 +105,7 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x) Andrysco M, Jhala R, Lerner S. Printing floating-point numbers: a faster, always correct method. ACM SIGPLAN notices - POPL '16. - 2016;51(1):555-67 ; draft at + 2016;51(1):555-67 ; draft at . */ PROMOTED_FLOAT promoted_x = x; diff --git a/lib/get-permissions.c b/lib/get-permissions.c index 99b4664aae7..aa78d7abf1e 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c @@ -108,7 +108,7 @@ get_permissions (const char *name, int desc, mode_t mode, When fetching the source ACL, we simply fetch both ACL types. When setting the destination ACL, we try either ACL types, assuming that the kernel will translate the ACL from one form to the other. - (See in + (See in the description of ENOTSUP.) */ for (;;) { diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 79580e931ab..9a2709c22a7 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -249,6 +249,7 @@ GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@ GMALLOC_OBJ = @GMALLOC_OBJ@ GMP_LIB = @GMP_LIB@ GMP_OBJ = @GMP_OBJ@ +GNULIB_ACCESS = @GNULIB_ACCESS@ GNULIB_ALPHASORT = @GNULIB_ALPHASORT@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ @@ -258,6 +259,7 @@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@ GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ +GNULIB_CREAT = @GNULIB_CREAT@ GNULIB_CTIME = @GNULIB_CTIME@ GNULIB_DIRFD = @GNULIB_DIRFD@ GNULIB_DPRINTF = @GNULIB_DPRINTF@ @@ -838,11 +840,13 @@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RALLOC_OBJ = @RALLOC_OBJ@ RANLIB = @RANLIB@ +REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_CALLOC = @REPLACE_CALLOC@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ +REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ @@ -1609,12 +1613,14 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \ -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ @@ -3176,6 +3182,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \ -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ @@ -3275,7 +3282,8 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ | \ - sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h index a079e59d791..586455384cf 100644 --- a/lib/ieee754.in.h +++ b/lib/ieee754.in.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef _IEEE754_H diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index d3c735c12ce..31e40c51a68 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -17,7 +17,7 @@ /* * ISO C 99 for platforms that lack it. - * + * */ #if __GNUC__ >= 3 diff --git a/lib/mktime.c b/lib/mktime.c index b00af96c8c4..d45eee85ec8 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -78,7 +78,7 @@ my_tzset (void) - Time zone names based on geography, without slashes, e.g. "Singapore". - Time zone names that contain explicit DST rules. Syntax: see - + The Microsoft CRT understands only the first kind. It produces incorrect results if the value of TZ is of the other kinds. But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value diff --git a/lib/open.c b/lib/open.c index 655260572d4..4572ebf6cd2 100644 --- a/lib/open.c +++ b/lib/open.c @@ -94,20 +94,13 @@ open (const char *filename, int flags, ...) #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 - 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." + Rationale: POSIX 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 - says that it - fails with errno = EISDIR in this case. + + 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, @@ -171,14 +164,6 @@ open (const char *filename, int flags, ...) #if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. - Rationale: POSIX - 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) diff --git a/lib/pathmax.h b/lib/pathmax.h index 9463a1fb2c6..4287d15870c 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -20,7 +20,7 @@ /* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, including the terminating NUL byte. - + PATH_MAX is not defined on systems which have no limit on filename length, such as GNU/Hurd. diff --git a/lib/pipe2.c b/lib/pipe2.c index 15a5dec9852..134d9f11fc0 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -107,7 +107,7 @@ pipe2 (int fd[2], int flags) if (pipe (fd) < 0) return -1; - /* POSIX + /* POSIX says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on both fd[0] and fd[1]. */ diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 5aad1210df0..945f19282d4 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -19,7 +19,7 @@ /* * POSIX 2008 for platforms that have issues. - * + * */ #if __GNUC__ >= 3 diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 21dd8d23e3c..d32de34da19 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -17,7 +17,7 @@ /* * ISO C 99 for platforms that lack it. - * + * */ #ifndef _@GUARD_PREFIX@_STDINT_H diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index f829525c104..e5583d967c1 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -238,8 +238,8 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " element (or NULL if it doesn't contain an "=" sign), - It returns the index of the "token" in the given array of tokens. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. - For more details see the POSIX:2001 specification. - http://www.opengroup.org/susv3xsh/getsubopt.html */ + For more details see the POSIX specification. + https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ # if !@HAVE_GETSUBOPT@ _GL_FUNCDECL_SYS (getsubopt, int, (char **optionp, char *const *tokens, char **valuep) diff --git a/lib/str-two-way.h b/lib/str-two-way.h index 7078c34bdc7..30806d26d64 100644 --- a/lib/str-two-way.h +++ b/lib/str-two-way.h @@ -49,7 +49,7 @@ character shift table similar to the Boyer-Moore algorithm to achieve improved (potentially sub-linear) performance. - See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, + See https://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260, https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm, https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf */ diff --git a/lib/string.in.h b/lib/string.in.h index 4a9292f74ad..c57f041c06d 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -693,7 +693,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " This is a variant of strtok() that is multithread-safe. For the POSIX documentation for this function, see: - http://www.opengroup.org/susv3xsh/strtok.html + https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. diff --git a/lib/time.in.h b/lib/time.in.h index dd3b21273c9..40e5b2063fc 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -84,8 +84,8 @@ struct timespec # endif # if !GNULIB_defined_struct_time_t_must_be_integral -/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires - time_t to be an integer type, even though C99 permits floating +/* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html + requires time_t to be an integer type, even though C99 permits floating point. We don't know of any implementation that uses floating point, and it is much easier to write code that doesn't have to worry about that corner case, so we force the issue. */ @@ -97,7 +97,7 @@ struct __time_t_must_be_integral { /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See - . */ + . */ # if @GNULIB_NANOSLEEP@ # if @REPLACE_NANOSLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -153,8 +153,8 @@ _GL_CXXALIASWARN (mktime); # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See - and - . */ + and + . */ # if @GNULIB_TIME_R@ # if @REPLACE_LOCALTIME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -203,8 +203,8 @@ _GL_CXXALIASWARN (gmtime_r); # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See - and - . */ + and + . */ # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ # if @REPLACE_LOCALTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -237,7 +237,7 @@ _GL_CXXALIASWARN (gmtime); /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See - . */ + . */ # if @GNULIB_STRPTIME@ # if ! @HAVE_STRPTIME@ _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, @@ -252,7 +252,7 @@ _GL_CXXALIASWARN (strptime); # endif /* Convert *TP to a date and time string. See - . */ + . */ # if @GNULIB_CTIME@ # if @REPLACE_CTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -268,7 +268,7 @@ _GL_CXXALIASWARN (ctime); # endif /* Convert *TP to a date and time string. See - . */ + . */ # if @GNULIB_STRFTIME@ # if @REPLACE_STRFTIME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/timegm.c b/lib/timegm.c index c440480cb2d..fc8c19fd3ea 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef _LIBC # include diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 59ee39ecea5..cc57ce680d5 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -253,10 +253,28 @@ _GL_INLINE_HEADER_BEGIN /* Declare overridden functions. */ -#if defined GNULIB_POSIXCHECK +#if @GNULIB_ACCESS@ +# if @REPLACE_ACCESS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef access +# define access rpl_access +# endif +_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); +# else +_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); +# endif +_GL_CXXALIASWARN (access); +#elif defined GNULIB_POSIXCHECK +# undef access +# if HAVE_RAW_DECL_ACCESS /* The access() function is a security risk. */ -_GL_WARN_ON_USE (access, "the access function is a security risk - " +_GL_WARN_ON_USE (access, "access does not always support X_OK - " + "use gnulib module access for portability; " + "also, this function is a security risk - " "use the gnulib module faccessat instead"); +# endif #endif @@ -277,7 +295,7 @@ _GL_WARN_ON_USE (chown, "chdir is not always in - " to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_DUP2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 @@ -526,7 +544,7 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if ! @HAVE_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); @@ -587,7 +605,7 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " /* Synchronize changes to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - . */ + . */ # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); # endif @@ -606,7 +624,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " /* Synchronize changes, including metadata, to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - . */ + . */ # if !@HAVE_FSYNC@ _GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif @@ -625,7 +643,7 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_FTRUNCATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftruncate @@ -655,7 +673,7 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " Return BUF if successful, or NULL if the directory couldn't be determined or SIZE was too small. See the POSIX:2008 specification - . + . Additionally, the gnulib module 'getcwd' guarantees the following GNU extension: 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 @@ -815,7 +833,7 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " /* Returns the user's login name, or NULL if it cannot be found. Upon error, returns NULL with errno set. - See . + See . Most programs don't need to use this function, because the information is available through environment variables: @@ -844,7 +862,7 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " the case that the login name cannot be found but no specific error is provided (this case is hopefully rare but is left open by the POSIX spec). - See . + See . Most programs don't need to use this function, because the information is available through environment variables: @@ -1079,7 +1097,7 @@ _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_LCHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lchown @@ -1109,7 +1127,7 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " /* Create a new hard link for an existing file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2008 specification - . */ + . */ # if @REPLACE_LINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link @@ -1175,7 +1193,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_LSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek @@ -1247,7 +1265,7 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " Return the number of bytes placed into BUF if successful, otherwise set errno and return -1. 0 indicates EOF. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_PREAD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pread @@ -1282,7 +1300,7 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " Return the number of bytes written if successful, otherwise set errno and return -1. 0 indicates nothing written. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_PWRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pwrite @@ -1315,7 +1333,7 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " #if @GNULIB_READ@ /* Read up to COUNT bytes from file descriptor FD into the buffer starting at BUF. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_READ@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef read @@ -1339,7 +1357,7 @@ _GL_CXXALIASWARN (read); bytes of it into BUF. Return the number of bytes placed into BUF if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_READLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlink rpl_readlink @@ -1449,7 +1467,7 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " /* Pause the execution of the current thread for N seconds. Returns the number of seconds left to sleep. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_SLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sleep @@ -1533,7 +1551,7 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " /* Change the size of the file designated by FILENAME to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_TRUNCATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef truncate @@ -1640,7 +1658,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. See the POSIX:2001 specification - . */ + . */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep @@ -1667,7 +1685,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " #if @GNULIB_WRITE@ /* Write up to COUNT bytes starting at BUF to file descriptor FD. See the POSIX:2008 specification - . */ + . */ # if @REPLACE_WRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index b61747bd1a5..cb0896fbd8b 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -1,4 +1,4 @@ -# canonicalize.m4 serial 30 +# canonicalize.m4 serial 31 dnl Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc. @@ -117,8 +117,8 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS], *-musl*) gl_cv_func_realpath_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_realpath_works="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_realpath_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_realpath_works="$gl_cross_guess_normal" ;; esac ]) rm -rf conftest.a conftest.d diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 index ec9f2218bf3..84421cef847 100644 --- a/m4/extern-inline.m4 +++ b/m4/extern-inline.m4 @@ -32,7 +32,7 @@ AC_DEFUN([gl_EXTERN_INLINE], https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see - http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index a86fdae5feb..60dc5e21037 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 15 +# serial 16 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -37,6 +37,7 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ + GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT]) GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) @@ -44,6 +45,7 @@ AC_DEFUN([gl_FCNTL_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4 index b2b3b037316..ad48e4ef2d5 100644 --- a/m4/fdopendir.m4 +++ b/m4/fdopendir.m4 @@ -1,4 +1,4 @@ -# serial 11 +# serial 12 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2019 Free Software Foundation, Inc. @@ -49,8 +49,8 @@ DIR *fdopendir (int); *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_fdopendir_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_fdopendir_works" in diff --git a/m4/getgroups.m4 b/m4/getgroups.m4 index c93447bb11c..556c177449b 100644 --- a/m4/getgroups.m4 +++ b/m4/getgroups.m4 @@ -1,4 +1,4 @@ -# serial 22 +# serial 23 dnl From Jim Meyering. dnl A wrapper around AC_FUNC_GETGROUPS. @@ -9,8 +9,6 @@ dnl A wrapper around AC_FUNC_GETGROUPS. # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -m4_version_prereq([2.70], [] ,[ - # This is taken from the following Autoconf patch: # https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 AC_DEFUN([AC_FUNC_GETGROUPS], @@ -44,8 +42,8 @@ AC_DEFUN([AC_FUNC_GETGROUPS], *-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) ac_cv_func_getgroups_works="guessing yes" ;; - # If we don't know, assume the worst. - *) ac_cv_func_getgroups_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_getgroups_works="$gl_cross_guess_normal" ;; esac ]) ]) @@ -61,8 +59,6 @@ AC_DEFUN([AC_FUNC_GETGROUPS], LIBS=$ac_save_LIBS ])# AC_FUNC_GETGROUPS -]) - AC_DEFUN([gl_FUNC_GETGROUPS], [ AC_REQUIRE([AC_TYPE_GETGROUPS]) @@ -99,8 +95,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS], *-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;; # Guess yes on musl systems. *-musl*) gl_cv_func_getgroups_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_getgroups_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_getgroups_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_getgroups_works" in diff --git a/m4/getopt.m4 b/m4/getopt.m4 index 5991bf83e89..8cc78278739 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 @@ -1,4 +1,4 @@ -# getopt.m4 serial 46 +# getopt.m4 serial 47 dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -302,8 +302,10 @@ dnl is ambiguous with environment values that contain newlines. ]])], [gl_cv_func_getopt_gnu=yes], [gl_cv_func_getopt_gnu=no], - [dnl Cross compiling. Assume the worst, even on glibc platforms. - gl_cv_func_getopt_gnu="guessing no" + [dnl Cross compiling. + dnl Assume the worst, even on glibc platforms. + dnl But obey --enable-cross-guesses. + gl_cv_func_getopt_gnu="$gl_cross_guess_normal" ]) case $gl_had_POSIXLY_CORRECT in exported) ;; diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index 5e2ef6f47e2..7eebabd9c70 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 @@ -1,4 +1,4 @@ -# serial 26 +# serial 27 # Copyright (C) 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -109,8 +109,8 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; # Guess no on native Windows. mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;; esac ])]) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 57b94ed5325..479c9de9eab 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 44 +# gnulib-common.m4 serial 45 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -94,7 +94,7 @@ AC_DEFUN([gl_COMMON_BODY], [ invoked from such signal handlers. Such functions have some restrictions: * All functions that it calls should be marked _GL_ASYNC_SAFE as well, or should be listed as async-signal-safe in POSIX - + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in particular, are NOT async-signal-safe. * All memory locations (variables and struct fields) that these functions @@ -115,6 +115,33 @@ AC_DEFUN([gl_COMMON_BODY], [ errno. */ #define _GL_ASYNC_SAFE ]) + dnl Hint which direction to take regarding cross-compilation guesses: + dnl When a user installs a program on a platform they are not intimately + dnl familiar with, --enable-cross-guesses=conservative is the appropriate + dnl choice. It implements the "If we don't know, assume the worst" principle. + dnl However, when an operating system developer (on a platform which is not + dnl yet known to gnulib) builds packages for their platform, they want to + dnl expose, not hide, possible platform bugs; in this case, + dnl --enable-cross-guesses=risky is the appropriate choice. + dnl Sets the variables + dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), + dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). + AC_ARG_ENABLE([cross-guesses], + [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], + [specify policy for cross-compilation guesses])], + [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) + enableval=conservative + fi + gl_cross_guesses="$enableval"], + [gl_cross_guesses=conservative]) + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl to /dev/tty, so they can be redirected to log files. Such diagnostics diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 77563edc84d..625c2211665 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -1104,6 +1104,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/nstrftime.m4 m4/off_t.m4 m4/open-cloexec.m4 + m4/open-slash.m4 m4/open.m4 m4/pathmax.m4 m4/pipe2.m4 diff --git a/m4/largefile.m4 b/m4/largefile.m4 index 1938188c17b..c6dd9a10032 100644 --- a/m4/largefile.m4 +++ b/m4/largefile.m4 @@ -56,7 +56,7 @@ rm -rf conftest*[]dnl # By default, many hosts won't let programs access large files; # one must use special compiler options to get large-file access to work. # For more details about this brain damage please see: -# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html +# http://www.unix.org/version2/whatsnew/lfs20mar.html AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) diff --git a/m4/lstat.m4 b/m4/lstat.m4 index ace163867e2..be6d3f24b43 100644 --- a/m4/lstat.m4 +++ b/m4/lstat.m4 @@ -1,4 +1,4 @@ -# serial 32 +# serial 33 # Copyright (C) 1997-2001, 2003-2019 Free Software Foundation, Inc. # @@ -63,8 +63,8 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], # Guess no on native Windows. gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; *) - # If we don't know, assume the worst. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.sym conftest.file diff --git a/m4/memmem.m4 b/m4/memmem.m4 index af2d5bbcf52..dcccefa7045 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 25 +# memmem.m4 serial 26 dnl Copyright (C) 2002-2004, 2007-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -68,7 +68,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], #endif ], [gl_cv_func_memmem_works_always="guessing yes"], - [gl_cv_func_memmem_works_always="guessing no"]) + [gl_cv_func_memmem_works_always="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_memmem_works_always" in @@ -138,7 +138,7 @@ static void quit (int sig) { _exit (sig + 128); } #endif ], [gl_cv_func_memmem_works_fast="guessing yes"], - [gl_cv_func_memmem_works_fast="guessing no"]) + [gl_cv_func_memmem_works_fast="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_memmem_works_fast" in diff --git a/m4/mktime.m4 b/m4/mktime.m4 index a86e1eebc68..405476145c2 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 30 +# serial 31 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -247,7 +247,7 @@ main () [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_working_mktime="guessing no" ;; - *) gl_cv_func_working_mktime="guessing no" ;; + *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/m4/nocrash.m4 b/m4/nocrash.m4 index 4d9f0226906..8577038d796 100644 --- a/m4/nocrash.m4 +++ b/m4/nocrash.m4 @@ -53,7 +53,7 @@ nocrash_init (void) /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { - /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { @@ -72,7 +72,7 @@ nocrash_init (void) for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. - See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } diff --git a/m4/open-slash.m4 b/m4/open-slash.m4 new file mode 100644 index 00000000000..a8756ae8fea --- /dev/null +++ b/m4/open-slash.m4 @@ -0,0 +1,59 @@ +# open-slash.m4 serial 1 +dnl Copyright (C) 2007-2019 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 Tests whether open() and creat() recognize a trailing slash. +dnl Sets gl_cv_func_open_slash. +AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + 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 +#if HAVE_UNISTD_H +# include +#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.]) + ;; + esac +]) diff --git a/m4/open.m4 b/m4/open.m4 index 5d73f4de1ac..6cf0bebb176 100644 --- a/m4/open.m4 +++ b/m4/open.m4 @@ -19,48 +19,9 @@ AC_DEFUN([gl_FUNC_OPEN], if test "$gl_cv_macro_O_CLOEXEC" != yes; then REPLACE_OPEN=1 fi - 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 -#if HAVE_UNISTD_H -# include -#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 - ]) + gl_OPEN_TRAILING_SLASH_BUG 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 diff --git a/m4/pselect.m4 b/m4/pselect.m4 index 5c72b69587a..250463d80a3 100644 --- a/m4/pselect.m4 +++ b/m4/pselect.m4 @@ -1,4 +1,4 @@ -# pselect.m4 serial 7 +# pselect.m4 serial 8 dnl Copyright (C) 2011-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -55,8 +55,8 @@ AC_DEFUN([gl_FUNC_PSELECT], linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_pselect_detects_ebadf="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_pselect_detects_ebadf="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/m4/putenv.m4 b/m4/putenv.m4 index 342ba2636ab..1267b901bec 100644 --- a/m4/putenv.m4 +++ b/m4/putenv.m4 @@ -1,4 +1,4 @@ -# putenv.m4 serial 23 +# putenv.m4 serial 24 dnl Copyright (C) 2002-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,8 +40,8 @@ AC_DEFUN([gl_FUNC_PUTENV], *-musl*) gl_cv_func_svid_putenv="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_svid_putenv="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_svid_putenv="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/m4/readlink.m4 b/m4/readlink.m4 index 2d7681576cc..7aa6ce03379 100644 --- a/m4/readlink.m4 +++ b/m4/readlink.m4 @@ -1,4 +1,4 @@ -# readlink.m4 serial 14 +# readlink.m4 serial 15 dnl Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,8 +38,8 @@ AC_DEFUN([gl_FUNC_READLINK], linux-* | linux) gl_cv_func_readlink_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_readlink_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_readlink_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_readlink_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.link conftest.lnk2]) diff --git a/m4/regex.m4 b/m4/regex.m4 index 35119c5c85f..ad36dc2b020 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 68 +# serial 69 # Copyright (C) 1996-2001, 2003-2019 Free Software Foundation, Inc. # @@ -243,8 +243,8 @@ AC_DEFUN([gl_REGEX], [case "$host_os" in # Guess no on native Windows. mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; - # Otherwise, assume it is not working. - *) gl_cv_func_re_compile_pattern_working="guessing no" ;; + # Otherwise obey --enable-cross-guesses. + *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/m4/symlink.m4 b/m4/symlink.m4 index 508e94dd410..2bec317e9b8 100644 --- a/m4/symlink.m4 +++ b/m4/symlink.m4 @@ -1,4 +1,4 @@ -# serial 8 +# serial 9 # See if we need to provide symlink replacement. dnl Copyright (C) 2009-2019 Free Software Foundation, Inc. @@ -40,8 +40,8 @@ AC_DEFUN([gl_FUNC_SYMLINK], linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_symlink_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_symlink_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.f conftest.link conftest.lnk2]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index a3b3905f84e..18b7140e598 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 75 +# unistd_h.m4 serial 76 dnl Copyright (C) 2006-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -41,9 +41,9 @@ AC_DEFUN([gl_UNISTD_H], # include # endif #endif - ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat - fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups - gethostname getlogin getlogin_r getpagesize getpass + ]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir + fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize + getgroups gethostname getlogin getlogin_r getpagesize getpass getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat @@ -61,6 +61,7 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ + GNULIB_ACCESS=0; AC_SUBST([GNULIB_ACCESS]) GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) @@ -159,6 +160,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) + REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) diff --git a/m4/utimens.m4 b/m4/utimens.m4 index dda86b09d77..6ed65934064 100644 --- a/m4/utimens.m4 +++ b/m4/utimens.m4 @@ -3,7 +3,7 @@ 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 serial 9 +dnl serial 10 AC_DEFUN([gl_UTIMENS], [ @@ -35,8 +35,8 @@ AC_DEFUN([gl_UTIMENS], linux-* | linux) gl_cv_func_futimesat_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu*) gl_cv_func_futimesat_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_futimesat_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_futimesat_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.file]) diff --git a/m4/utimes.m4 b/m4/utimes.m4 index 5806d8fbbb6..703f823ad53 100644 --- a/m4/utimes.m4 +++ b/m4/utimes.m4 @@ -1,5 +1,5 @@ # Detect some bugs in glibc's implementation of utimes. -# serial 6 +# serial 7 dnl Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -147,7 +147,7 @@ main () *-musl*) gl_cv_func_working_utimes="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_working_utimes="guessing no" ;; - *) gl_cv_func_working_utimes="guessing no" ;; + *) gl_cv_func_working_utimes="$gl_cross_guess_normal" ;; esac ]) ]) -- 2.39.2