Bruno Haible [Fri, 1 Jan 2021 17:39:28 +0000 (18:39 +0100)]
c32isgraph/c32isprint/c32ispunct tests: Avoid test failures on OmniOS.
* tests/test-c32isgraph.c (main): On Solaris, disable tests that fail on
Solaris 11 OmniOS.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
Paul Eggert [Fri, 1 Jan 2021 17:27:54 +0000 (09:27 -0800)]
libc-config: port to Sun C 5.9
* lib/libc-config.h (libc_hidden_proto): Omit ", ..." in macro
definition. It’s not needed for Gnulib and elicits a diagnostic
from Sun C 5.9 Patch 124867-12 2009/11/22.
Bruno Haible [Fri, 1 Jan 2021 14:00:48 +0000 (15:00 +0100)]
quotearg tests: Avoid test failures on Solaris 11.
* modules/quotearg-tests (Makefile.am): Set host_os in
TESTS_ENVIRONMENT.
* tests/test-quotearg.sh: On Solaris 11 systems, make a copy of the fr/
directory that contains the .mo file.
Bruno Haible [Fri, 1 Jan 2021 11:50:28 +0000 (12:50 +0100)]
maint: Update copyright notices in --version output.
List the most recent year in which changes were made, per
<https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html>.
* build-aux/declared.sh (func_version): Say 2019.
* build-aux/libtool-next-version (func_version): Likewise.
* build-aux/run-test (func_version): Likewise.
* check-module (COPYRIGHT_NOTICE): Say 2012.
* lib/git-merge-changelog.c (main): Say 2020.
Paul Eggert [Fri, 1 Jan 2021 07:28:52 +0000 (07:28 +0000)]
maint: run 'make update-copyright'
Paul Eggert [Fri, 1 Jan 2021 07:24:28 +0000 (23:24 -0800)]
autoupdate
Paul Eggert [Fri, 1 Jan 2021 03:29:08 +0000 (19:29 -0800)]
filename: change filename.h comment to LGPLv2.1+
* lib/filename.h: Change license notice to match what should be in
glibc, and what modules/filename specifies. This is to simplify
syncing with glibc.
Paul Eggert [Fri, 1 Jan 2021 03:14:49 +0000 (19:14 -0800)]
doc: mention year-0 bugs in Solaris etc.
* doc/posix-functions/gmtime.texi, doc/posix-functions/gmtime_r.texi:
* doc/posix-functions/localtime.texi:
* doc/posix-functions/localtime_r.texi:
* doc/posix-functions/mktime.texi:
Mention year-0 bugs in localtime etc.
Bruno Haible [Fri, 1 Jan 2021 00:12:08 +0000 (01:12 +0100)]
ptsname_r: Fix test failure on Solaris.
* lib/ptsname_r.c (__ptsname_r) [__sun]: Don't test the major number of
the device.
Bruno Haible [Thu, 31 Dec 2020 23:42:34 +0000 (00:42 +0100)]
posixtm tests: Disable part of the test on plaforms where it fails.
* tests/test-posixtm.c (T): Disable two tests on Solaris.
Bruno Haible [Thu, 31 Dec 2020 22:49:25 +0000 (23:49 +0100)]
poll tests: Avoid test failure on AIX.
* tests/test-poll.c (test_pipe): Disable the "expecting POLLHUP after
shutdown" test on AIX.
* doc/posix-functions/poll.texi: Mention the AIX bug.
Bruno Haible [Thu, 31 Dec 2020 22:38:16 +0000 (23:38 +0100)]
poll tests: Avoid test failure on BSD and Solaris systems.
* tests/test-poll.c (test_accept_first, test_socket_pair): Disable the
"expecting POLLHUP after shutdown" test on all platforms except Linux.
Paul Eggert [Thu, 31 Dec 2020 21:35:53 +0000 (13:35 -0800)]
fnmatch: merge from glibc + proposal
This merges the change proposed by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121212.html
which fixes a Gnulib bug that led to a failed assert.
* lib/fnmatch_loop.c (EXT): Use signed level, not unsigned, and
check that it stays nonnegative. Use __flexarr instead of
FLEXIBLE_ARRAY_MEMBER, to port better to glibc.
* tests/test-fnmatch.c (main): New test cases, taken from glibc.
Paul Eggert [Thu, 31 Dec 2020 17:05:13 +0000 (09:05 -0800)]
glob: merge proposed glibc changes
This merges the change proposed by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121211.html
* lib/glob.c (__lstat64, __stat64) [_LIBC]: Remove.
Bruno Haible [Thu, 31 Dec 2020 21:18:05 +0000 (22:18 +0100)]
memalign: Work around Solaris bug.
* lib/memalign.c: New file.
* m4/memalign.m4: New file.
* modules/memalign (Files): Add them.
(Depends-on): Add malloc-h.
(configure.ac): Invoke gl_FUNC_MEMALIGN. Conditionally compile
memalign.c. Set module indicator.
(Include): Include <malloc.h> unconditionally.
* doc/glibc-functions/memalign.texi: Mention the Solaris issues.
Bruno Haible [Thu, 31 Dec 2020 21:17:31 +0000 (22:17 +0100)]
malloc-h: Add tests.
* tests/test-malloc-h.c: New file.
* modules/malloc-h-tests: New file.
* tests/test-malloc-h-c++.cc: New file.
* modules/malloc-h-c++-tests: New file.
Bruno Haible [Thu, 31 Dec 2020 21:16:52 +0000 (22:16 +0100)]
malloc-h: New module.
* lib/malloc.in.h: New file.
* m4/malloc_h.m4: New file.
* modules/malloc-h: New file.
* doc/glibc-headers/malloc.texi: New file.
* doc/gnulib.texi (Glibc Header File Substitutes): Include it.
Bruno Haible [Thu, 31 Dec 2020 18:41:32 +0000 (19:41 +0100)]
unistd: Fix portability warnings.
* lib/unistd.in.h (fchownat, unlinkat): Fix module name in warning.
Karl Berry [Thu, 31 Dec 2020 16:41:43 +0000 (08:41 -0800)]
autoupdate
Karl Berry [Thu, 31 Dec 2020 16:40:57 +0000 (08:40 -0800)]
autoupdate
Bruno Haible [Thu, 31 Dec 2020 16:16:57 +0000 (17:16 +0100)]
utime: Fix compilation error on macOS and Solaris 9 (regr. 2020-12-24).
Reported by Tom G. Christensen <tgc@jupiterrise.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00295.html>.
* lib/utime.c: Include <errno.h>.
Karl Berry [Wed, 30 Dec 2020 15:27:14 +0000 (07:27 -0800)]
srclistvars.sh doc unusual repo urls
Bruno Haible [Wed, 30 Dec 2020 13:58:41 +0000 (14:58 +0100)]
getlogin tests, getlogin_r tests: Avoid failure on Solaris OpenIndiana.
* tests/test-getlogin.c (main): Don't fail if getlogin() returns NULL
with no errno.
* tests/test-getlogin_r.c (main): Don't fail if getlogin_r() returns
EINVAL.
Paul Eggert [Wed, 30 Dec 2020 06:17:46 +0000 (22:17 -0800)]
* lib/canonicalize-lgpl.c (realpath_stk): Set errno properly.
Jim Meyering [Wed, 30 Dec 2020 04:00:36 +0000 (20:00 -0800)]
regex-tests: tweak to avoid a clang-10 warning
* tests/test-regex.c: Compare with explicit zero, rather than
as boolean to avoid this from clang-10:
test-regex.c:315:9: error: converting the result of '<<' to a \
boolean always evaluates to true \
[-Werror,-Wtautological-constant-compare]
if (! REG_STARTEND)
Jim Meyering [Wed, 30 Dec 2020 03:34:55 +0000 (19:34 -0800)]
hash: add casts-to-float to avoid clang-10 warnings
* lib/hash.c (compute_bucket_size): Cast SIZE_MAX to float
to avoid this warning from clang-10 (for use in grep):
hash.c:501:11: error: implicit conversion from 'unsigned long' \
to 'float' changes value from
18446744073709551615 to \
18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
if (SIZE_MAX <= new_candidate)
(hash_insert_if_absent): Likewise.
Paul Eggert [Wed, 30 Dec 2020 03:34:59 +0000 (19:34 -0800)]
canonicalize: fix size overflow treatment
This also has some minor cleanups.
* lib/canonicalize-lgpl.c, lib/canonicalize.c: No need to include
stddef.h, since the code no longer refers directly to ptrdiff_t.
* lib/canonicalize-lgpl.c (realpath_stk):
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Treat size overflow like other out-of-memory.
* lib/canonicalize.c: No need to include stdlib.h, since
the code no longer refers to stdlib.h functions (other
than those that canonicalize.h must declare).
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Do not bother terminating the string result on error.
Bruno Haible [Wed, 30 Dec 2020 01:12:33 +0000 (02:12 +0100)]
list-c++, [o]map-c++, [o]set-c++: Fix conflict with 'free-posix' module.
* lib/gl_list.hh: Include <stdlib.h>.
* lib/gl_map.hh: Likewise.
* lib/gl_omap.hh: Likewise.
* lib/gl_set.hh: Likewise.
* lib/gl_oset.hh: Likewise.
Paul Eggert [Wed, 30 Dec 2020 01:08:11 +0000 (17:08 -0800)]
canonicalize: fix ptrdiff_t overflow bug
Problem reported by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121182.html
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
Include intprops.h.
(NARROW_ADDRESSES): New constant.
* lib/canonicalize-lgpl.c (realpath_stk):m
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Work even if strlen (END) does not fit in idx_t, or if adding
N to it overflows.
* modules/canonicalize, modules/canonicalize-lgpl (Depends-on):
Add intprops.
Bruno Haible [Tue, 29 Dec 2020 03:00:53 +0000 (04:00 +0100)]
havelib: Fix for Solaris 11 OpenIndiana and Solaris 11 OmniOS.
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): In
acl_is_expected_elfclass, use 'expr', not 'test'.
Bruno Haible [Tue, 29 Dec 2020 02:05:25 +0000 (03:05 +0100)]
ptsname_r: Fix a compiler warning on Solaris.
* lib/ptsname_r.c (__ptsname_r): Reduce the scope of variable 'err'.
Bruno Haible [Tue, 29 Dec 2020 01:48:31 +0000 (02:48 +0100)]
gnulib-tool: Fix logic whether to add a dummy.c.
* gnulib-tool (func_remove_if_blocks): New function.
(func_modules_add_dummy): Use it to eliminate all conditional statements
from the automake snippet.
Paul Eggert [Mon, 28 Dec 2020 20:38:52 +0000 (12:38 -0800)]
faccessat: revert recent EOVERFLOW change
I misunderstood the glibc source code. Deduced from
Adhemerval Zanella’s proposed glibc patch in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121131.html
* doc/posix-functions/faccessat.texi: It is not a problem.
* lib/canonicalize-lgpl.c, lib/canonicalize.c, lib/faccessat.c:
(FACCESSAT_NEVER_OVERFLOWS): Remove. All uses removed.
* lib/faccessat.c: Revert to simpler version now that
LSTAT_FOLLOWS_SLASHED_SYMLINK must be false.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT_EOVERFLOW):
Remove. All uses removed.
* modules/canonicalize, modules/canonicalize-lgpl (Files):
Remove m4/faccessat.m4.
Paul Eggert [Mon, 28 Dec 2020 19:58:38 +0000 (11:58 -0800)]
canonicalize-lgpl: accommodate picky cpp
* lib/canonicalize-lgpl.c: Use "defined FUNC_REALPATH_WORKS" in
case preprocessor is picky. Reported by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121130.html
Paul Eggert [Mon, 28 Dec 2020 19:38:58 +0000 (11:38 -0800)]
canonicalize: simplify via scratch_buffer_dupfree
* config/srclist.txt: Adjust accordingly.
* lib/canonicalize-lgpl.c (realpath_stk):
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Simplify by using scratch_buffer_dupfree.
* lib/malloc/scratch_buffer.h (scratch_buffer_dupfree): New function.
* lib/malloc/scratch_buffer_dupfree.c: New file.
* modules/scratch_buffer (Files, Depends-on):
Add malloc/scratch_buffer_dupfree.c.
Paul Eggert [Sun, 27 Dec 2020 19:22:11 +0000 (11:22 -0800)]
regex: remove glibc21.m4
It doesn’t seem to be needed any more; at least, I couldn’t
reproduce the circa-2013 problem. Perhaps the recent
--conditional-dependencies fixes have removed the need for it.
* m4/glibc21.m4: Remove. All uses removed.
Bruno Haible [Sun, 27 Dec 2020 00:21:22 +0000 (01:21 +0100)]
gnulib-tool: Make --conditional-dependencies work with --with-tests.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00236.html>.
* gnulib-tool (func_emit_tests_Makefile_am): Handle conditional
dependencies like func_emit_lib_Makefile_am.
Bruno Haible [Sat, 26 Dec 2020 16:02:03 +0000 (17:02 +0100)]
execvpe: Make dependency to stdbool explicit.
* lib/execvpe.c: Include <stdbool.h>.
* modules/execvpe (Depends-on): Add stdbool.
Bruno Haible [Sat, 26 Dec 2020 13:43:58 +0000 (14:43 +0100)]
execlp: Add tests.
* tests/test-execlp-main.c: New file.
* tests/test-execlp.sh: New file.
* modules/execlp-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:42:38 +0000 (14:42 +0100)]
execlp: New module.
* lib/execlp.c: New file.
* m4/execlp.m4: New file.
* modules/execlp: New file.
* doc/posix-functions/execlp.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:40:49 +0000 (14:40 +0100)]
execle: Add tests.
* tests/test-execle-main.c: New file.
* tests/test-execle.sh: New file.
* modules/execle-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:39:39 +0000 (14:39 +0100)]
execle: New module.
* lib/execle.c: New file.
* m4/execle.m4: New file.
* modules/execle: New file.
* doc/posix-functions/execle.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:37:54 +0000 (14:37 +0100)]
execl: Add tests.
* tests/test-execl-main.c: New file.
* tests/test-execl.sh: New file.
* modules/execl-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:36:35 +0000 (14:36 +0100)]
execl: New module.
* lib/execl.c: New file.
* m4/execl.m4: New file.
* modules/execl: New file.
* doc/posix-functions/execl.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:33:33 +0000 (14:33 +0100)]
execv: Add tests.
* tests/test-execv-main.c: New file.
* tests/test-execv.sh: New file.
* modules/execv-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:31:50 +0000 (14:31 +0100)]
execv: New module.
* lib/execv.c: New file.
* m4/execv.m4: New file.
* modules/execv: New file.
* doc/posix-functions/execv.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:29:56 +0000 (14:29 +0100)]
execvp: Add tests.
* tests/test-execvp-main.c: New file.
* tests/test-execvp.sh: New file.
* modules/execvp-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:28:16 +0000 (14:28 +0100)]
execvp: New module.
* lib/execvp.c: New file.
* m4/execvp.m4: New file.
* modules/execvp: New file.
* doc/posix-functions/execvp.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:25:06 +0000 (14:25 +0100)]
execvpe: Add tests.
* tests/test-execvpe-main.c: New file.
* tests/test-execvpe.sh: New file.
* modules/execvpe-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:23:10 +0000 (14:23 +0100)]
execvpe: New module.
* lib/execvpe.c: New file.
* m4/execvpe.m4: New file.
* modules/execvpe: New file.
* doc/glibc-functions/execvpe.texi: Mention the Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:19:29 +0000 (14:19 +0100)]
execve: Add tests.
* tests/test-exec-child.c: New file.
* tests/test-execve-main.c: New file.
* tests/test-execve.sh: New file.
* modules/execve-tests: New file.
Bruno Haible [Sat, 26 Dec 2020 13:13:03 +0000 (14:13 +0100)]
execve: New module.
* lib/execve.c: New file.
* m4/execve.m4: New file.
* modules/execve: New file.
* doc/posix-functions/execve.texi: Mention more Windows problems and the
new module.
Bruno Haible [Sat, 26 Dec 2020 13:09:29 +0000 (14:09 +0100)]
execve, execvpe, execvp, execv, execl, execle, execlp: Prepare modules.
* lib/unistd.in.h (execl, execle, execlp, execv, execve, execvp,
execvpe): Add declarations for the new modules.
* m4/unistd_h.m4 (gl_UNISTD_H): Test whether execl, execle, execlp,
execv, execve, execvp, execvpe are declared.
(gl_UNISTD_H_DEFAULTS): Initialize GNULIB_EXEC*, HAVE_EXECVPE,
REPLACE_EXEC*.
* modules/unistd (Makefile.am): Substitute GNULIB_EXEC*, HAVE_EXECVPE,
REPLACE_EXEC*.
* tests/test-unistd-c++.cc: Check the signature of execl, execle,
execlp, execv, execve, execvp, execvpe.
Bruno Haible [Sat, 26 Dec 2020 12:54:09 +0000 (13:54 +0100)]
stack: Fix typo in comments.
* lib/stack.h: Fix typo in comments.
Bruno Haible [Sat, 26 Dec 2020 12:48:37 +0000 (13:48 +0100)]
bitset: Fix conflict with 'free-posix' module.
* lib/bitset/base.h: Include <stdlib.h>.
Paul Eggert [Sat, 26 Dec 2020 01:26:51 +0000 (17:26 -0800)]
idx: change idx.h comment to LGPLv2.1+
* lib/idx.h: Change license notice to match what should be in glibc.
gnulib-tool will change it as appropriate anyway, so this is just
to simplify syncing with glibc.
Thien-Thi Nguyen [Fri, 25 Dec 2020 23:27:37 +0000 (18:27 -0500)]
MODULES.html.sh: Update after 2020-12-19 change.
* MODULES.html.sh (func_all_modules): Do s/free/free-posix/.
Bruno Haible [Fri, 25 Dec 2020 17:39:47 +0000 (18:39 +0100)]
Make it possible to turn off the mkdir override on Windows.
* lib/sys_stat.in.h (mkdir): Conditionalize through GNULIB_MKDIR and
GNULIB_MDA_MKDIR. Also support GNULIB_POSIXCHECK.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_MKDIR,
GNULIB_MDA_MKDIR.
* modules/sys_stat (Makefile.am): Substitute GNULIB_MKDIR,
GNULIB_MDA_MKDIR.
* modules/mkdir (configure.ac): Invoke gl_SYS_STAT_MODULE_INDICATOR.
* doc/posix-functions/mkdir.texi: Mention also the 'sys_stat' module.
Bruno Haible [Fri, 25 Dec 2020 12:48:17 +0000 (13:48 +0100)]
Make it possible to turn off each of the Windows oldnames workarounds.
* lib/fcntl.in.h (creat, open): Conditionalize each of the Windows
oldnames workarounds through a GNULIB_MDA_<func> symbol.
* lib/math.in.h (j0, j1, jn, y0, y1, yn): Likewise.
* lib/search.in.h (lfind, lsearch): Likewise.
* lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
Likewise.
* lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
* lib/string.in.h (memccpy, strdup): Likewise.
* lib/sys_stat.in.h (chmod, umask): Likewise.
* lib/time.in.h (tzset): Likewise.
* lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
read, rmdir, swab, unlink, write): Likewise.
* lib/utime.in.h (utime): Likewise.
* lib/wchar.in.h (wcsdup): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Initialize these
GNULIB_MDA_<func> symbols.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Likewise.
* m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Likewise.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Likewise.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Likewise.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Likewise.
* m4/utime_h.m4 (gl_UTIME_H_DEFAULTS): Likewise.
* m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Likewise.
* modules/fcntl-h (Makefile.am): Substitute these GNULIB_MDA_<func>
symbols.
* modules/math (Makefile.am): Likewise.
* modules/search (Makefile.am): Likewise.
* modules/stdio (Makefile.am): Likewise.
* modules/stdlib (Makefile.am): Likewise.
* modules/string (Makefile.am): Likewise.
* modules/sys_stat (Makefile.am): Likewise.
* modules/time (Makefile.am): Likewise.
* modules/unistd (Makefile.am): Likewise.
* modules/utime-h (Makefile.am): Likewise.
* modules/wchar (Makefile.am): Likewise.
Paul Eggert [Fri, 25 Dec 2020 05:33:18 +0000 (21:33 -0800)]
canonicalize, canonicalize-lgpl: remove lint
Pacify GCC. Some of these problems were reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00217.html
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
Sort shared include directives, for consistency.
(IF_LINT): New macro.
(suffix_requires_dir_check): Mark with _GL_ATTRIBUTE_PURE.
* lib/canonicalize-lgpl.c (GCC_LINT, _GL_ATTRIBUTE_PURE) [_LIBC]:
New macros.
(realpath_stk): Suppress bogus -Wmaybe-uninitialized warning.
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Omit unused local. Suppress bogus -Wmaybe-uninitialized warning.
Bruno Haible [Fri, 25 Dec 2020 01:16:22 +0000 (02:16 +0100)]
spawn-pipe: Use posix_spawn by default on native Windows.
* lib/spawn-pipe.c (SPAWN_PIPE_IMPL_AVOID_POSIX_SPAWN): New macro.
(create_pipe): Use it to decide among the two possible implementations.
* modules/spawn-pipe (Depends-on): Add posix_spawnattr_setpgroup.
Bruno Haible [Fri, 25 Dec 2020 01:16:18 +0000 (02:16 +0100)]
unistd-safer: Implement pipe_safer on native Windows.
* lib/pipe-safer.c (pipe_safer): Don't test HAVE_PIPE.
* modules/unistd-safer (Depends-on): Add pipe-posix.
Bruno Haible [Fri, 25 Dec 2020 01:15:38 +0000 (02:15 +0100)]
execute: Use posix_spawn by default on native Windows.
* lib/execute.c (EXECUTE_IMPL_AVOID_POSIX_SPAWN): New macro.
(execute): Use it to decide among the two possible implementations.
Paul Eggert [Thu, 24 Dec 2020 22:47:31 +0000 (14:47 -0800)]
canonicalize-lgpl: merge proposed libc changes
This merges the changes proposed for glibc in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121085.html
https://sourceware.org/pipermail/libc-alpha/2020-December/121086.html
* lib/canonicalize-lgpl.c: Include idx.h and filename.h
unconditionally.
(idx_t, IDX_MAX, FILE_SYSTEM_PREFIX_LEN, IS_ABSOLUTE_FILE_NAME)
(ISSLASH) [_LIBC]: Remove.
Paul Eggert [Thu, 24 Dec 2020 22:47:31 +0000 (14:47 -0800)]
autoupdate
Bruno Haible [Thu, 24 Dec 2020 21:18:36 +0000 (22:18 +0100)]
posix_spawn-internal: Implement for native Windows.
* lib/spawni.c (grow_inheritable_handles, shrink_inheritable_handles,
close_inheritable_handles, memiszero, sigisempty, open_handle, do_open,
do_dup2, do_close): New functions.
(__spawni): Implement on native Windows.
* modules/posix_spawn-internal (Depends-on): Add filename,
concat-filename, findprog-in, malloca, windows-spawn.
* doc/posix-functions/posix_spawn.texi: Update.
* doc/posix-functions/posix_spawnp.texi: Likewise.
Bruno Haible [Thu, 24 Dec 2020 21:18:27 +0000 (22:18 +0100)]
windows-spawn: Export another auxiliary function.
* lib/windows-spawn.h (convert_CreateProcess_error): New declaration.
* lib/windows-spawn.c (convert_CreateProcess_error): New function,
extracted from spawnpvech.
(spawnpvech): Use it.
Bruno Haible [Thu, 24 Dec 2020 21:18:21 +0000 (22:18 +0100)]
windows-spawn: Export some more auxiliary functions.
* lib/windows-spawn.h: Include <stdbool.h>.
(struct inheritable_handles): New type.
(init_inheritable_handles, compose_handles_block,
free_inheritable_handles): New declarations.
* lib/windows-spawn.c (init_inheritable_handles, compose_handles_block):
New functions, based on spawnvech.
(free_inheritable_handles): New function.
(spawnpvech): Use them.
Bruno Haible [Thu, 24 Dec 2020 21:18:18 +0000 (22:18 +0100)]
windows-spawn: Export another auxiliary function.
* lib/windows-spawn.h (compose_envblock): New declaration.
* lib/windows-spawn.c (compose_envblock): New function, extracted from
spawnpvech.
(spawnpvech): Use it.
Bruno Haible [Thu, 24 Dec 2020 21:18:10 +0000 (22:18 +0100)]
windows-spawn: Export an auxiliary function.
* lib/windows-spawn.h (compose_command): New declaration.
* lib/windows-spawn.c (compose_command): New function, extracted from
spawnpvech.
(spawnpvech): Use it.
Bruno Haible [Thu, 24 Dec 2020 21:14:38 +0000 (22:14 +0100)]
posix_spawn* tests: Add support for native Windows.
* tests/test-posix_spawn-open1.c (DATA_FILENAME): Treat native Windows
like Cygwin.
* tests/test-posix_spawn-dup2-stdin.c (main): Don't assume the signals
SIGHUP and SIGPIPE. On native Windows, don't call
posix_spawnattr_setsigmask.
* tests/test-posix_spawn-dup2-stdout.c (main): Likewise.
* tests/test-posix_spawn-fchdir.c (main): Likewise.
* tests/test-posix_spawn-chdir.c (test): Likewise. Accept the child
output from Cygwin's 'pwd' program.
* tests/test-posix_spawn-script.c (main): On native Windows, skip the
executable-shell-script part of the test.
* tests/test-posix_spawnp-script.c (main): Likewise.
* modules/posix_spawn-tests (Depends-on): Add freopen, waitpid.
(configure.ac): Don't define the POSIX_SPAWN_PORTED conditional.
(Makefile.am): Don't test the POSIX_SPAWN_PORTED conditional.
* modules/posix_spawnp-tests (Depends-on): Add waitpid.
(configure.ac): Don't define the POSIX_SPAWN_PORTED conditional.
(Makefile.am): Don't test the POSIX_SPAWN_PORTED conditional.
* modules/posix_spawn_file_actions_addchdir-tests (Makefile.am): Don't
test the POSIX_SPAWN_PORTED conditional.
* modules/posix_spawn_file_actions_addfchdir-tests (configure.ac):
Define the POSIX_SPAWN_PORTED conditional here.
Bruno Haible [Thu, 24 Dec 2020 21:13:49 +0000 (22:13 +0100)]
sh-filename: Add support for native Windows.
* m4/sh-filename.m4 (gl_SH_FILENAME): Treat native Windows like Cygwin.
Paul Eggert [Thu, 24 Dec 2020 20:06:26 +0000 (12:06 -0800)]
careadlinkat: improve warning line number
This propagates an idea first used in canonicalize-lgpl.
* lib/careadlinkat.c (GCC_BOGUS_WRETURN_LOCAL_ADDR):
New macro.
(careadlinkat): Use it.
Paul Eggert [Thu, 24 Dec 2020 19:38:49 +0000 (11:38 -0800)]
* canonicalize-lgpl.c: Space after paren.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
linkat: use eloop-threshold
* lib/linkat.c: Include eloop-threshold.h.
Do not include sys/param.h.
(MAXSYMLINKS): Remove.
(link_follow, linkat_follow): Use __eloop_threshold instead
of MAXSYMLINKS.
* m4/linkat.m4 (gl_FUNC_LINKAT): Omit sys/param.h check.
* modules/linkat (Depends-on): Add eloop-threshold. Sort.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
canonicalize-lgpl: use eloop-threshold
* lib/canonicalize-lgpl.c [!_LIBC]: Include eloop-threshold.h.
(MAXSYMLINKS, __eloop_threshold): Remove.
* modules/canonicalize-lgpl (Depends-on): Add eloop-threshold.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
eloop-threshold: new module
* config/srclist.txt: Add a comment about it.
* lib/eloop-threshold.h, modules/eloop-threshold: New files.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
canonicalize: prefer faccessat to stat
A proper faccessat doesn't have the EOVERFLOW problem, and can be
more efficient as it needn't gather data from the filesystem to
fill in struct stat. So use stat only if faccessat is absent,
or when checking for symlink loops in canonicalize.c.
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
Include fcntl.h, for AT_EACCESS.
(FACCESSAT_NEVER_EOVERFLOWS): Default to false.
(file_accessible): New function, based on faccessat but with
a fallback to stat and with an EOVERFLOW workaround.
(dir_check): Use it.
(dir_suffix): New static constant.
* lib/canonicalize-lgpl.c (FACCESSAT_NEVER_EOVERFLOWS) [_LIBC]:
Use __ASSUME_FACCESSAT2 to set FACCESSAT_NEVER_EOVERFLOWS
(__faccessat) [!_LIBC]: Define.
(realpath_stk): Use dir_suffix now.
* lib/canonicalize.c (canonicalize_filename_mode_stk):
If logical, don't check each component's existence; just check
at the end, as that's enough.
* m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE)
(gl_CANONICALIZE_LGPL_SEPARATE):
Require gl_FUNC_FACCESSAT_EOVERFLOW,
gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, and check for faccessat.
(gl_CANONICALIZE_LGPL_SEPARATE): Do not check for readlink,
as the code does not use HAVE_READLINK.
* modules/canonicalize, modules/canonicalize-lgpl (Files):
Add m4/faccessat.m4, m4/lstat.m4.
(Depends-on): Add fcntl-lh.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
faccessat: work around F_OK EOVERFLOW bug
Also, tune when LSTAT_FOLLOWS_SLASHED_SYMLINK.
* doc/posix-functions/faccessat.texi: Mention the problem.
* lib/faccessat.c (FACCESSAT_NEVER_EOVERFLOWS)
(LSTAT_FOLLOWS_SLASHED_SYMLINK): Default to 0.
(rpl_faccessat): If !FACCESSAT_NEVER_EOVERFLOWS, check
for F_OK and EOVERFLOW, which means we can return 0.
If LSTAT_FOLLOWS_SLASHED_SYMLINK, don't worry about
file names ending in slashes, as faccessat should already
do the right thing for them.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT_EOVERFLOW): New macro.
(gl_FUNC_FACCESSAT): Use it.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
stat failing with EOVERFLOW implies existence
* lib/euidaccess.c (euidaccess):
* lib/file-has-acl.c (file_has_acl):
* lib/link.c (link, rpl_link):
* lib/mkdir.c (rpl_mkdir):
* lib/mkfifo.c (rpl_mkfifo):
* lib/mknod.c (rpl_mknod):
* lib/ptsname_r.c (__ptsname_r):
* lib/symlink.c (rpl_symlink):
* lib/symlinkat.c (rpl_symlinkat):
* lib/unlink.c (rpl_unlink):
* lib/unlinkat.c (rpl_unlinkat):
* lib/utime.c (utime):
If stat fails with EOVERFLOW the file exists, so treat it that way
in file-existence tests that do not need struct stat values.
Paul Eggert [Thu, 24 Dec 2020 19:38:48 +0000 (11:38 -0800)]
canonicalize-lgpl: remove freea macro
* lib/canonicalize-lgpl.c (freea) [_LIBC]: Remove; not needed.
Paul Eggert [Thu, 24 Dec 2020 19:38:47 +0000 (11:38 -0800)]
canonicalize, canonicalize-lgpl: fix symlink bug
Problem reported by Adhemerval Zanella in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00155.html
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
(suffix_requires_dir_check, dir_check): New functions.
(GCC_BOGUS_WRETURN_LOCAL_ADDR): New macro, to put the diagnostic
closer to the related GCC diagnostics.
* lib/canonicalize-lgpl.c (realpath_stk):
* lib/canonicalize.c (canonicalize_file_mode_stk):
Use them to fix a bug with .../symlink-to-regular-file/ etc.
* lib/canonicalize-lgpl.c (__stat) [!_LIBC]: New macro.
(realpath_stk): New function,
with the contents of the old __realpath and a new scratch buffer arg.
This is needed to pacify GCC 10.1, as canonicalize.c is already doing.
(__realpath): Use it.
* tests/test-canonicalize-lgpl.c, tests/test-canonicalize.c:
Add test cases for the bugs.
Bruno Haible [Thu, 24 Dec 2020 18:04:57 +0000 (19:04 +0100)]
execute: Treat signalled processes like wait-process does.
* lib/execute.c: Include <sys/types.h>, <sys/wait.h>.
(execute): Recognize the case where the exit code indicates a signalled
child process.
* tests/test-execute-main.c (main): Update expected test result.
* modules/execute (Depends-on): Add sys_wait.
Bruno Haible [Thu, 24 Dec 2020 17:19:08 +0000 (18:19 +0100)]
windows-spawn: Improve errno upon failure on native Windows.
* lib/windows-spawn.c (spawnpvech): Map the CreateProcess errors
ERROR_BAD_FORMAT and ERROR_BAD_EXE_FORMAT to ENOEXEC.
* tests/executable-script.sh: New file.
* tests/test-posix_spawn-script.c (main): Also try executing
executable-script.sh.
* tests/test-posix_spawnp-script.c (main): Likewise.
* tests/test-execute-script.c (main): Likewise.
* tests/test-spawn-pipe-script.c (main): Likewise.
* modules/posix_spawn-tests (Files): Add tests/executable-script.sh.
* modules/posix_spawnp-tests (Files): Likewise.
* modules/execute-tests (Files): Likewise.
* modules/spawn-pipe-tests (Files): Likewise.
Bruno Haible [Thu, 24 Dec 2020 12:32:39 +0000 (13:32 +0100)]
findprog-in: Improve errno upon failure on native Windows.
* lib/findprog-in.c (find_in_given_path): If the file basename has no
dot and the search with a suffix returned no result, do also a search
without a suffix, and set errno = ENOEXEC if we find a file in this way.
* tests/test-spawn-pipe-script.c (main): Update expected errno.
Bruno Haible [Thu, 24 Dec 2020 02:49:20 +0000 (03:49 +0100)]
posix_spawn, posix_spawnp: Fix execution of scripts.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_SECURE): New macro.
(gl_POSIX_SPAWN_BODY): Invoke it. Set REPLACE_POSIX_SPAWN if posix_spawn
or posix_spawnp allows unsecure execution of scripts.
* doc/posix-functions/posix_spawn.texi: Document the script execution
problem.
* doc/posix-functions/posix_spawnp.texi: Likewise.
Bruno Haible [Thu, 24 Dec 2020 00:14:49 +0000 (01:14 +0100)]
Add unit tests regarding execution of scripts.
* tests/executable-script: New file.
* tests/executable-shell-script: New file.
* tests/test-posix_spawn-script.c: New file.
* tests/test-posix_spawnp-script.c: New file.
* tests/test-execute-script.c: New file.
* tests/test-spawn-pipe-script.c: New file.
* modules/posix_spawn-tests (Files): Add
tests/test-posix_spawn-script.c, tests/executable-script,
tests/executable-shell-script.
(Makefile.am): Compile and run test-posix_spawn-script.
* modules/posix_spawnp-tests (Files): Add
tests/test-posix_spawnp-script.c, tests/executable-script,
tests/executable-shell-script.
(Makefile.am): Compile and run test-posix_spawnp-script.
* modules/execute-tests (Files): Add tests/test-execute-script.c,
tests/executable-script, tests/executable-shell-script.
(Makefile.am): Compile and run test-execute-script.
* modules/spawn-pipe-tests (Files): Add tests/test-spawn-pipe-script.c,
tests/executable-script, tests/executable-shell-script.
(Makefile.am): Compile and run test-spawn-pipe-script.
Bruno Haible [Wed, 23 Dec 2020 22:58:17 +0000 (23:58 +0100)]
Don't execute scripts without '#!' marker through /bin/sh.
This reflects the change done in glibc through
<https://sourceware.org/bugzilla/show_bug.cgi?id=13134> and
<https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=
d96de9634a334af16c0ac711074c15ac1762b23c>.
* lib/spawni.c (internal_function): Remove macro.
(script_execute): Remove function.
(__spawni): Don't invoke script_execute.
* lib/execute.c (execute): Disable the ENOEXEC handling.
* lib/spawn-pipe.c (create_pipe): Likewise.
* NEWS: Mention the change.
Bruno Haible [Thu, 24 Dec 2020 03:11:02 +0000 (04:11 +0100)]
posix_spawn[p]: Fix compilation error on Windows (regr. 2020-12-14).
Reported by Adrian Ebeling <devl@adrian-ebeling.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00189.html>.
* lib/spawni.c (__spawni): Update function parameters.
Bruno Haible [Wed, 23 Dec 2020 22:26:42 +0000 (23:26 +0100)]
posix_spawn tests: Add two more tests.
* tests/test-posix_spawn-inherit0.c: New file, based on
tests/test-posix_spawn-open2.c.
* tests/test-posix_spawn-inherit1.c: New file, based on
tests/test-posix_spawn-open2.c.
* modules/posix_spawn-tests (Files): Add them.
(Depends-on): Add fflush.
(Makefile.am): Compile and run test-posix_spawn-inherit0 and
test-posix_spawn-inherit1.
Bruno Haible [Wed, 23 Dec 2020 22:22:03 +0000 (23:22 +0100)]
posix_spawn tests: Add another test.
* tests/test-posix_spawn-open2.c: New file, based on
tests/test-posix_spawn-open1.c.
* modules/posix_spawn-tests (Files): Add it.
(Makefile.am): Compile and run test-posix_spawn-open1.
Karl Berry [Wed, 23 Dec 2020 17:10:41 +0000 (09:10 -0800)]
build-aux/config.guess
Bruno Haible [Mon, 21 Dec 2020 01:49:20 +0000 (02:49 +0100)]
Remove support for broken <wchar.h> in AIX 3.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Simplify test programs.
Bruno Haible [Mon, 21 Dec 2020 01:43:45 +0000 (02:43 +0100)]
Remove support for broken <wchar.h> in BSD/OS and OSF/1.
* lib/wchar.in.h: Don't include <stdio.h>, <time.h>.
* lib/mbchar.h: Likewise.
* lib/mbiter.h: Likewise.
* lib/mbuiter.h: Likewise.
* m4/stdint.m4 (gl_STDINT_INCLUDES): Likewise.
* lib/mbfile.h: Don't include <time.h>.
* lib/mbswidth.h: Update comment.
* lib/stdint.in.h: Don't include <stddef.h>, <stdio.h>, <time.h> before
<wchar.h>.
* lib/wctype.in.h: Likewise.
* m4/btowc.m4 (gl_FUNC_BTOWC): Simplify test programs.
* m4/iswblank.m4 (gl_FUNC_ISWBLANK): Likewise.
* m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Likewise.
* m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Likewise.
* m4/mbrlen.m4 (gl_FUNC_MBRLEN, gl_MBRLEN_INCOMPLETE_STATE,
gl_MBRLEN_RETVAL, gl_MBRLEN_NUL_RETVAL): Likewise.
* m4/mbrtoc32.m4 (gl_MBRTOC32_SANITYCHECK): Likewise.
* m4/mbrtowc.m4 (gl_FUNC_MBRTOWC, gl_MBRTOWC_INCOMPLETE_STATE,
gl_MBRTOWC_SANITYCHECK, gl_MBRTOWC_NULL_ARG1, gl_MBRTOWC_NULL_ARG2,
gl_MBRTOWC_RETVAL, gl_MBRTOWC_NUL_RETVAL, gl_MBRTOWC_STORES_INCOMPLETE,
AC_FUNC_MBRTOWC): Likewise.
* m4/mbsinit.m4 (gl_FUNC_MBSINIT): Likewise.
* m4/mbsnrtowcs.m4 (gl_MBSNRTOWCS_WORKS_IN_TRADITIONAL_LOCALE):
Likewise.
* m4/mbsrtowcs.m4 (gl_FUNC_MBSRTOWCS, gl_MBSRTOWCS_WORKS): Likewise.
* m4/mbstate_t.m4 (AC_TYPE_MBSTATE_T): Likewise.
* m4/mbswidth.m4 (gl_MBSWIDTH): Likewise.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): Likewise.
* m4/wchar_h.m4 (gl_WCHAR_H, gl_WCHAR_H_INLINE_OK): Likewise.
* m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise.
* m4/wcsdup.m4 (gl_FUNC_WCSDUP): Likewise.
* m4/wcsnrtombs.m4 (gl_WCSNRTOMBS_WORKS_IN_TRADITIONAL_LOCALE):
Likewise.
* m4/wcsrtombs.m4 (gl_FUNC_WCSRTOMBS, gl_WCSRTOMBS_TERMINATION,
gl_WCSRTOMBS_NULL): Likewise.
* m4/wcstok.m4 (gl_FUNC_WCSTOK): Likewise.
* m4/wctob.m4 (gl_FUNC_WCTOB): Likewise.
* m4/wctype_h.m4 (gl_WCTYPE_H): Likewise.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
* m4/wint_t.m4 (gt_TYPE_WINT_T): Likewise.
* m4/wmemchr.m4 (gl_FUNC_WMEMCHR): Likewise.
* m4/wmemcmp.m4 (gl_FUNC_WMEMCMP): Likewise.
* m4/wmemcpy.m4 (gl_FUNC_WMEMCPY): Likewise.
* m4/wmemmove.m4 (gl_FUNC_WMEMMOVE): Likewise.
* m4/wmemset.m4 (gl_FUNC_WMEMSET): Likewise.
Bruno Haible [Mon, 21 Dec 2020 00:17:12 +0000 (01:17 +0100)]
isnanf: Fix autoconf test.
* m4/isnanf.m4 (gl_ISNANF_WORKS): Fix one of the NaN tests.
Bruno Haible [Sun, 20 Dec 2020 22:24:54 +0000 (23:24 +0100)]
Remove some of the support for obsolete IRIX 4 and 5.
* m4/mountlist.m4 (AC_FUNC_GETMNTENT): Don't test for getmntent in
libsun.
* tests/init.sh (setup_): Don't talk about IRIX 5.
Bruno Haible [Sun, 20 Dec 2020 21:19:26 +0000 (22:19 +0100)]
filemode: Remove Cray support.
* lib/filemode.c (IS_MIGRATED_FILE): Remove macro.
(filemodestring): Don't produce an 'M' type.
* m4/filemode.m4 (gl_FILEMODE): Don't invoke AC_STRUCT_ST_DM_MODE.
* m4/st_dm_mode.m4: Remove file.
* modules/filemode (Files): Remove it.
Paul Eggert [Sun, 20 Dec 2020 21:29:04 +0000 (13:29 -0800)]
free-posix: assume glibc 2.33 fixes this.
* m4/free.m4 (gl_FUNC_FREE): Assume glibc 2.33+ is fixed.
Use compile-time test rather than guessing for cross-builds.
Bruno Haible [Sun, 20 Dec 2020 14:10:05 +0000 (15:10 +0100)]
backupfile: Fix compilation error on native Windows (regr. 2018-10-23).
Reported by Adrian Ebeling <adrianebeling@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00156.html>.
* lib/backupfile.c (fpathconf): Define fallback, like for pathconf.
Bruno Haible [Sun, 20 Dec 2020 13:50:18 +0000 (14:50 +0100)]
float: Fix compilation error when gnulib's float.h exists twice, part 2.
Reported by Santiago Vila <sanvila@unex.es>.
* lib/float.in.h (GNULIB_defined_long_double_union): New macro.