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.
Bruno Haible [Sun, 20 Dec 2020 13:41:29 +0000 (14:41 +0100)]
float: Fix compilation error when gnulib's float.h exists twice.
Reported by Santiago Vila <sanvila@unex.es>.
* lib/float.in.h (GNULIB_defined_long_double_union): New macro.
Bruno Haible [Sat, 19 Dec 2020 19:19:45 +0000 (20:19 +0100)]
free-posix: Assume future POSIX compliance only on OpenBSD and Solaris.
* m4/free.m4 (gl_FUNC_FREE): Guess yes only on OpenBSD and Solaris.
Don't trust _POSIX_VERSION for this test.
Paul Eggert [Sat, 19 Dec 2020 16:14:38 +0000 (08:14 -0800)]
free-posix: port to GNU/Linux
* m4/free.m4 (gl_FUNC_FREE): Don’t assume GNU hosts are free of
the bug, as it occurs on Ubuntu 20.10 x86-64 and, I assume, on
other GNU/Linux hosts.
Bruno Haible [Sat, 19 Dec 2020 12:26:24 +0000 (13:26 +0100)]
free-posix: Add tests.
* tests/test-free.c: New file.
* tests/macros.h (ASSERT_NO_STDIO,
WRITE_MACROEXPANDED_INTEGER_TO_STDERR, WRITE_INTEGER_TO_STDERR,
WRITE_TO_STDERR): New macros.
* modules/free-posix-tests: New file.
Bruno Haible [Fri, 18 Dec 2020 23:28:02 +0000 (00:28 +0100)]
free-posix: Add C++ declaration test.
* tests/test-stdlib-c++.cc (free): New declaration.
Bruno Haible [Fri, 18 Dec 2020 23:18:50 +0000 (00:18 +0100)]
free-posix: New module, renamed from 'free'.
* modules/free-posix: Renamed from modules/free.
(configure.ac): Update gl_STDLIB_MODULE_INDICATOR invocation.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_FREE_POSIX,
not GNULIB_FREE.
* modules/stdlib (Makefile.am): Substitute GNULIB_FREE_POSIX, not
GNULIB_FREE.
* lib/stdlib.in.h (free): Test GNULIB_FREE_POSIX, not GNULIB_FREE.
* doc/posix-functions/free.texi: Mention the module 'free-posix' and
what it does.
* NEWS: Mention that module 'free' no longer exists.
* modules/canonicalize (Depends-on): Add free-posix. Remove free.
* modules/canonicalize-lgpl (Depends-on): Likewise.
Bruno Haible [Fri, 18 Dec 2020 22:58:37 +0000 (23:58 +0100)]
free: Remove support for obsolete platforms.
* m4/free.m4 (gl_FUNC_FREE): Assume free(NULL) works. Don't define
CANNOT_FREE_NULL.
* lib/free.c (rpl_free): Don't test CANNOT_FREE_NULL.
* modules/free (Description): Update.
* doc/posix-functions/free.texi: Don't mention SunOS 4 any more.
Paul Eggert [Fri, 18 Dec 2020 18:18:40 +0000 (10:18 -0800)]
intprops: port to ICC 2021.1 Beta
20201112
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P):
Port to ICC 2021.1, which has a non-working __builtin_mul_overflow_p.
Add a clause for other compilers that claim to support
__builtin_mul_overflow_p, since we might as well find out about
slackers other than Clang and ICC.
(INT_MULTIPLY_WRAPV): ICC 2021 has GCC bug 91450, so treat it
like older GCCs even when it claims to be a newer one.
Bruno Haible [Fri, 18 Dec 2020 12:10:27 +0000 (13:10 +0100)]
intprops: Avoid potentially buggy __builtin_add_overflow in GCC 5, 6.
Reported by Stefan Liebler <stli@linux.ibm.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00152.html>.
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW): Don't define for
GCC 5.x and 6.x.
* lib/glob.c (size_add_wrapv): Don't use __builtin_add_overflow for
GCC 5.x and 6.x.
Bruno Haible [Thu, 17 Dec 2020 23:41:07 +0000 (00:41 +0100)]
free: Fix warning.
Reported by Pádraig Brady <P@draigBrady.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00148.html>.
* lib/stdlib.in.h (free): New declaration.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether 'free' is declared.
(gl_STDLIB_H_DEFAULTS): Initialize GNULIB_FREE, REPLACE_FREE.
* modules/stdlib (Makefile.am): Substitute GNULIB_FREE, REPLACE_FREE.
* m4/free.m4 (gl_FUNC_FREE): Set REPLACE_FREE, instead of defining
'free' as a macro here.
* modules/free (Depends-on): Add stdlib.
(configure.ac): Test REPLACE_FREE. Invoke gl_STDLIB_MODULE_INDICATOR.
Paul Eggert [Thu, 17 Dec 2020 09:22:55 +0000 (01:22 -0800)]
canonicalize-lgpl: fix AIX test failures
This merges the recent canonicalize.c fix into canonicalize-lgpl.c.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00138.html
* lib/canonicalize-lgpl.c: Include sys/stat.h.
(__realpath): When testing a file name ending in '/', use stat
rather than readlink, so that it does the right thing on AIX.
* modules/canonicalize-lgpl (Depends-on): Add stat, sys_stat.
Paul Eggert [Thu, 17 Dec 2020 09:13:40 +0000 (01:13 -0800)]
canonicalize: omit second readlink when not needed
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Omit second readlink when (can_exist != CAN_MISSING
&& startlen != 0 && !logical). Simplify.
Paul Eggert [Thu, 17 Dec 2020 07:50:34 +0000 (23:50 -0800)]
canonicalize: remove arbitrary 8192-byte limit
Remove canonicalize.c’s arbitrary 8192-byte limit on platforms
like GNU Hurd that do not define the PATH_MAX macro, and similarly
for canonicalize-lgpl.c’s arbitrary 1024-byte limit. Do this by
using scratch buffers. Lessen the number of differences between
the two source files, to simplify this and future maintenance.
* lib/canonicalize-lgpl.c (__realpath):
* lib/canonicalize.c (canonicalize_filename_mode_stk):
Use scratch buffers instead of malloc and malloca. This avoids
the need for alloca, and avoids the need for malloc in most cases.
* lib/canonicalize-lgpl.c, lib/canonicalize.c: Make these files
easier to compare, e.g., by sorting include files and by switching
to the GNU convention of calling file names "file names", not
"path names". Include stdbool.h, scratch_buffer.h.
* lib/canonicalize-lgpl.c (IDX_MAX) [_LIBC]: New macro.
(malloca) [_LIBC]: Remove.
[!_LIBC]: Do not include malloca.h.
(get_path_max): New function, so that pathconf is called only in
the rare and dubious case when when RESOLVED is not null and
PATH_MAX is not defined. Invoke pathconf on "/" not the input
file name, as we care about the longest file name starting from
"/" (not from the input file name), and POSIX does not specify
what pathconf does on a non-directory file anyway. If PATH_MAX is
not defined, do not worry about overriding a path_max of 0, and do
not let path_max exceed IDX_MAX.
(__realpath): Remove an assumption that file name components
cannot exceed 1024 bytes when PATH_MAX is not defined (wrong for
the Hurd, presumably).
When allocating the result, allocate it to just the right size;
this costs nothing when the result is smaller than 1023 bytes,
and for larger results it's probably worth the CPU to call realloc,
as canonicalize.c already does.
* lib/canonicalize.c: Include attribute.h.
Do not include pathmax.h or xgetcwd.h.
(PATH_MAX): Do not define, so file names longer than 8192 bytes
work on platforms with no fixed limit.
(canonicalize_filename_mode_stk): New function, with
the content of the old canonicalize_filename_mode.
Use getcwd instead of xgetcwd, and readlink instead of areadlink,
since the scratch buffers now do memory management for us.
Use rawmemchr instead of adding strlen.
Use mempcpy instead of mempcpy + size.
Assume free preserves errno.
(canonicalize_filename_mode): Use it.
* modules/canonicalize (Depends-on): Remove areadlink, pathmax,
xgetcwd. Add attribute, free, getcwd, mempcpy, rawmemchr,
scratch_buffer, stdbool, xalloc-die.
* modules/canonicalize-lgpl (Depends-on): Remove alloca-opt,
malloca, realloc-posix. Add scratch_buffer, stdbool.
Paul Eggert [Mon, 14 Dec 2020 19:59:20 +0000 (11:59 -0800)]
canonicalize-lgpl: simplify merge to glibc
This patch lessens the differences between git glibc
stdlib/canonicalize.c and lib/canonicalize-lgpl.c.
The (perhaps wishful) goal is to make them identical.
* lib/canonicalize-lgpl.c [!_LIBC]:
Include <libc-config.h>, not config.h.
Omit an unnecessary (!HAVE_CANONICALIZE_FILE_NAME ||
!FUNC_REALPATH_WORKS || defined _LIBC) #if.
Do not include alloca.h, since we use malloca now.
[_LIBC]: Include <eloop-threshold.h>, and define dummy macros
FILE_SYSTEM_PREFIX_LEN, IS_ABSOLUTE_FILE_NAME, ISSLASH, malloca,
freea so that the mainline code can be kept #ifdef free.
[!_LIBC]: Remove dummy macros for SHLIB_COMPAT, versioned_symbol,
compat_symbol, weak_alias, __set_errno since libc-config.h does that.
Add redirecting macros __mempcpy, __pathconf, __rawmemchr,
__eloop_threshold. All uses of their definiens changed.
(SIZE_MAX): Remove; no longer needed.
(alloc_failed): Remove, and remove all instances.
No need for alloc_failed now that free preserves errno.
(__realpath): Default path_max to 1024 instead of 8192, as that’s
the glibc tradition and is safer when the 2nd argument is null.
Use __rawmemchr instead of strchr.
Use __mempcpy where appropriate.
Simplify test for overflow so that it does not need SIZE_MAX.
Do not preserve errno around free or freea calls; no longer needed.
Mark __realpath with libc_hidden_def.
* modules/canonicalize-lgpl (Depends-on): Add free, libc-config,
malloc-posix, mempcpy, realloc-posix, rawmemchr.
* modules/free: Now LGPLv2+, for canonicalize-lgpl.
Paul Eggert [Mon, 14 Dec 2020 19:38:18 +0000 (11:38 -0800)]
free: preserve errno
* lib/free.c (rpl_free): Preserve errno. Check for null only if
CANNOT_FREE_NULL is defined, as an optimization for POSIX 2008
platforms that do not preserve errno.
* m4/free.m4 (gl_FUNC_FREE): Check whether free preserves errno.
Also, define CANNOT_FREE_NULL if free cannot free NULL.
* modules/free (configure.ac): Also replace 'free' if
it does not preserve errno.
Paul Eggert [Thu, 17 Dec 2020 07:52:24 +0000 (23:52 -0800)]
idx: simplify IDX_MAX, remove IDX_WIDTH
* lib/idx.h (IDX_MAX): Simplify by removing obsolete reference
to UNSIGNED_IDX_T.
(IDX_WIDTH): Remove, since it’s not used and its value
arguably should be PTRDIFF_WIDTH anyway.
Bruno Haible [Thu, 17 Dec 2020 02:00:25 +0000 (03:00 +0100)]
posix_spawn_file_actions_addfchdir-tests: Rename test.
* tests/test-posix_spawn-fchdir.c: Renamed from
tests/test-posix_spawn5.c.
* modules/posix_spawn_file_actions_addfchdir-tests (Files, Makefile.am):
Update.
Bruno Haible [Thu, 17 Dec 2020 01:56:21 +0000 (02:56 +0100)]
posix_spawn_file_actions_addchdir-tests: Rename test.
* tests/test-posix_spawn-chdir.c: Renamed from
tests/test-posix_spawn4.c.
* modules/posix_spawn_file_actions_addchdir-tests (Files, Makefile.am):
Update.
Bruno Haible [Thu, 17 Dec 2020 01:47:40 +0000 (02:47 +0100)]
posix_spawn-tests: Rename test.
* tests/test-posix_spawn-open1.c: Renamed from
tests/test-posix_spawn3.c.
* modules/posix_spawn-tests (Files, Makefile.am): Update.
Bruno Haible [Thu, 17 Dec 2020 01:44:31 +0000 (02:44 +0100)]
posix_spawnp-tests: Rename test.
* tests/test-posix_spawn-dup2-stdin.c: Renamed from
tests/test-posix_spawn2.c.
* tests/test-posix_spawn-dup2-stdin.in.sh: Renamed from
tests/test-posix_spawn2.in.sh.
* modules/posix_spawnp-tests (Files, Makefile.am): Update.
Bruno Haible [Thu, 17 Dec 2020 01:38:08 +0000 (02:38 +0100)]
posix_spawnp-tests: Rename test.
* tests/test-posix_spawn-dup2-stdout.c: Renamed from
tests/test-posix_spawn1.c.
* tests/test-posix_spawn-dup2-stdout.in.sh: Renamed from
tests/test-posix_spawn1.in.sh.
* modules/posix_spawnp-tests (Files, Makefile.am): Update.
Bruno Haible [Mon, 14 Dec 2020 19:56:04 +0000 (20:56 +0100)]
findprog-in: Allow overriding the current directory.
* lib/findprog.h (find_in_given_path): Add directory argument.
* lib/findprog-in.c (find_in_given_path): Likewise.
* lib/execute.c (execute): Update caller.
* lib/spawn-pipe.c (create_pipe): Likewise.
* lib/windows-spawn.c (spawnpvech): Likewise.
* NEWS: Mention the change.
Bruno Haible [Mon, 14 Dec 2020 18:22:14 +0000 (19:22 +0100)]
posix_spawn-internal: Make better use of 'const'.
* lib/spawn_int.h (__spawni): Does not need write access to the elements
of argv and envp.
* lib/spawni.c (__spawni, script_execute): Likewise.
* lib/spawn.c (posix_spawn): Update caller.
* lib/spawnp.c (posix_spawnp): Likewise.
Bruno Haible [Mon, 14 Dec 2020 17:07:28 +0000 (18:07 +0100)]
spawn: Make it compile on native Windows.
* modules/spawn (Depends-on): Add signal-h.
Bruno Haible [Mon, 14 Dec 2020 17:05:38 +0000 (18:05 +0100)]
windows-spawn: Avoid shadowing a variable.
* lib/windows-spawn.c (spawnpvech): Rename local variable 'flags'.
Paul Eggert [Mon, 14 Dec 2020 01:32:34 +0000 (17:32 -0800)]
string: port memchr macro to AIX 7.2 XLC
Its <string.h> defines a memchr macro to help inlining.
* lib/string.in.h (memchr): #undef before #defining.
Paul Eggert [Mon, 14 Dec 2020 01:16:01 +0000 (17:16 -0800)]
canonicalize: fix AIX test failures
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00109.html
* lib/canonicalize.c (canonicalize_filename_mode):
When testing a file name ending in '/', use stat rather than
readlink, so that it does the right thing on AIX.
* modules/canonicalize (Depends-on): Add readlink, to pull in the
recent changes in the Gnulib readlink module.
Paul Eggert [Mon, 14 Dec 2020 00:56:10 +0000 (16:56 -0800)]
Assume readlink/readlinkat ERANGE fix
* lib/areadlink-with-size.c (areadlink_with_size):
* lib/areadlinkat-with-size.c (areadlinkat_with_size):
* lib/careadlinkat.c (readlink_stk):
Do not worry about readlink or readlinkat failing with errno == ERANGE,
since the Gnulib readlink and readlinkat modules now fix that.
Paul Eggert [Mon, 14 Dec 2020 00:51:58 +0000 (16:51 -0800)]
getcwd: port to AIX
* lib/getcwd.c [!_LIBC]: Undef stat64 before #defining it,
in case our sys/stat.h #defined a function macro with the same name.
Paul Eggert [Mon, 14 Dec 2020 00:48:26 +0000 (16:48 -0800)]
readlink, readlinkat: add ERANGE portability
Fix some portability issues with Gnulib's readlink and readlinkat,
notably mostly working around the ERANGE problem in AIX and HP-UX.
* doc/posix-functions/readlink.texi:
* doc/posix-functions/readlinkat.texi:
ERANGE problem is mostly fixed now. Mention AIX problem with
trailing / and EINVAL. Lessen differences between these two files.
* lib/readlink.c (rpl_readlink):
* lib/readlinkat.c (rpl_readlinkat):
If stat ("FILE/", ...) reports EOVERFLOW, treat FILE/ as an
existing directory. Mostly work around READLINK_TRUNCATE BUG.
Lessen spurious differences between the readlink and readlinkat code.
* lib/readlinkat.c (rpl_readlinkat):
Fix bug where stat was used where fstatat was intended.
* m4/readlink.m4 (gl_FUNC_READLINK):
Rename gl_cv_func_readlink_works to gl_cv_func_readlink_trailing_slash
to identify readlink problems more precisely. All uses changed.
Guess no on AIX or HP-UX for this variable.
Add check for whether readlink truncates results,
and define new macro READLINK_TRUCATE_BUG accordingly.
* m4/readlinkat.m4 (gl_FUNC_READLINKAT):
Also check gl_cv_func_readlink_trailing_slash when deciding
whether to replace readlinkat.
* modules/readlinkat (Depends-on): Most dependencies are also
needed if replacing readlinkat. fstatat is different, as it
is needed only if replacing an existing readlinkat.
Bruno Haible [Sun, 13 Dec 2020 20:45:55 +0000 (21:45 +0100)]
spawn-pipe: Fix hanging processes on Windows (regression 2020-11-30).
* lib/spawn-pipe.c (create_pipe): After spawning the subprocess, close
the stdin_handle and/or stdout_handle.
Bruno Haible [Sat, 12 Dec 2020 23:28:20 +0000 (00:28 +0100)]
Fix gnulib-tool error when some modules occur in tests/.
* doc/gnulib.texi (Specification): Update statistics.
(Autoconf macros): Don't suggest to use AC_LIBOBJ in a .m4 file.
(Using AC_LIBOBJ): New section.
* check-AC_LIBOBJ: New file.
* modules/fnmatch-gnu (Files): Add lib/fnmatch.c.
* modules/fopen-gnu (Files): Add lib/fopen.c.
* modules/memmem (Files): Add lib/memmem.c.
* modules/renameat (Files): Add lib/at-func2.c.
* modules/strcasestr (Files): Add lib/strcasestr.c.
* modules/strstr (Files): Add lib/strstr.c.
Bruno Haible [Sat, 12 Dec 2020 03:18:54 +0000 (04:18 +0100)]
sh-quote, execute, spawn-pipe, etc.: Make better use of 'const'.
* lib/sh-quote.h (shell_quote_argv): Does not need write access to the
elements of argv.
* lib/sh-quote.c (shell_quote_argv): Likewise.
* lib/windows-spawn.h (prepare_spawn): Add 'const' the argument type and
the return type.
* lib/windows-spawn.c (prepare_spawn): Likewise.
* lib/os2-spawn.h (prepare_spawn): Likewise.
* lib/os2-spawn.c (prepare_spawn): Likewise.
* lib/execute.h (execute): Does not need write access to the elements of
prog_argv.
* lib/execute.c (execute): Likewise.
* lib/spawn-pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi):
Likewise.
* lib/spawn-pipe.c (create_pipe, create_pipe_bidi, create_pipe_in,
create_pipe_out): Likewise.
* lib/pipe-filter.h (pipe_filter_ii_execute, pipe_filter_gi_create):
Likewise.
* lib/pipe-filter-ii.c (pipe_filter_ii_execute): Likewise.
* lib/pipe-filter-gi.c (pipe_filter_gi_create): Likewise.
* lib/javaexec.h (execute_fn): Does not need write access to the
elements of prog_argv.
* lib/javaexec.c (execute_java_class): Update variable types and remove
casts to 'char *'.
* lib/csharpexec.h (execute_fn): Does not need write access to the
elements of prog_argv.
* lib/csharpexec.c (execute_csharp_using_mono,
execute_csharp_using_sscli): Update variable types and remove casts to
'char *'.
* lib/javacomp.c (compile_using_envjavac, compile_using_gcj,
compile_using_javac, compile_using_jikes, is_envjavac_gcj,
is_envjavac_gcj43, is_gcj_present, is_gcj_43, is_javac_present,
is_jikes_present): Update variable types and remove casts to 'char *'.
* lib/javaversion.c (execute_and_read_line): Does not need write access
to the elements of prog_argv.
* lib/csharpcomp.c (compile_csharp_using_mono,
compile_csharp_using_sscli): Update variable types and remove casts to
'char *'.
* tests/test-sh-quote.c (main): Update variable types and remove casts
to 'char *'.
* tests/test-execute-main.c (main): Update variable types and remove
casts to 'char *'.
* tests/test-spawn-pipe-main.c (test_pipe): Update variable types and
remove casts to 'char *'.
* NEWS: Mention the changes.
Bruno Haible [Sat, 12 Dec 2020 02:55:48 +0000 (03:55 +0100)]
execute-tests: Fix compilation error with MSVC.
* tests/test-execute-child.c (is_device): With _fstat, use
'struct _stat', not 'struct stat'.
Paul Eggert [Sat, 12 Dec 2020 01:35:59 +0000 (17:35 -0800)]
vararrays: just use 2.70
* m4/vararrays.m4 (AC_C_VARARRAYS): Do not override Autoconf 2.70
and later, since Autoconf 2.70 matches Gnulib now.
Paul Eggert [Sat, 12 Dec 2020 01:34:53 +0000 (17:34 -0800)]
sys_types: just use 2.70
* m4/sys_types_h.m4 (AC_HEADER_MAJOR):
Reindent to match Autoconf sources.
Use Autoconf 2.70 as a prerequisite, not 2.69c.
Paul Eggert [Sat, 12 Dec 2020 01:33:36 +0000 (17:33 -0800)]
stdint: port to Autoconf 2.70
* m4/stdint.m4 (gl_STDINT_H): Check for inttypes.h and sys/types.h
instead of assuming that AC_INCLUDES_DEFAULT does it.
The old code relied on AC_INCLUDES_DEFAULT being called
and setting ac_cv_header_inttypes_h and ac_cv_header_sys_types_h,
but this does not occur in Autoconf 2.70.
Paul Eggert [Fri, 11 Dec 2020 23:52:22 +0000 (15:52 -0800)]
pid_t.m4: just use 2.70
* m4/pid_t.m4 (AC_TYPE_PID_T):
Use Autoconf 2.70 as a prerequisite, not 2.69c.
Paul Eggert [Fri, 11 Dec 2020 23:51:27 +0000 (15:51 -0800)]
largefile: just use 2.70
* m4/largefile.m4 (_AC_SYS_LARGEFILE_TEST_INCLUDES):
Use Autoconf 2.70 as a prerequisite, not 2.69c.
Paul Eggert [Fri, 11 Dec 2020 23:50:34 +0000 (15:50 -0800)]
AC_C_RESTRICT: update from Autoconf
* m4/gnulib-common.m4 (gl_PROG_CC_C99): Use Autoconf 2.70
as a prerequisite, not 2.69c, since 2.70 is now out.
(AC_C_RESTRICT): Define only for 2.70 or earlier.
Try __restrict__ before __restrict.
Paul Eggert [Fri, 11 Dec 2020 23:47:24 +0000 (15:47 -0800)]
extensions: update from Autoconf
* m4/extensions.m4 (AC_CHECK_INCLUDES_DEFAULT):
Provide a default implementation for Autoconf 2.69 or earlier.
(AC_USE_SYSTEM_EXTENSIONS): Copy from Autoconf git. Define only
if Autoconf 2.70 or earlier, since 2.70.1 or later should be OK.
Paul Eggert [Fri, 11 Dec 2020 23:46:17 +0000 (15:46 -0800)]
alloca: update from Autoconf
* m4/alloca.m4 (gl_PREREQ_ALLOCA):
Trivial update to match Autoconf 2.70.
Bruno Haible [Fri, 11 Dec 2020 11:14:03 +0000 (12:14 +0100)]
memchr: Work around memory overrun bug on AIX 7.2.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Test against AIX 7.2 bug.
* doc/posix-functions/memchr.texi: Mention the AIX bug.
Bruno Haible [Fri, 11 Dec 2020 10:47:30 +0000 (11:47 +0100)]
execute-tests: Fix compilation error on AIX in 32-bit mode.
* tests/test-execute-child.c: In order to get the original definition of
fstat, don't use '#undef fstat' and '#undef stat'. Instead, arrange to
include the system's <sys/stat.h> and use it before including other
header files.
Bruno Haible [Thu, 10 Dec 2020 22:49:28 +0000 (23:49 +0100)]
windows-spawn: Relicense under LGPLv2+.
* modules/windows-spawn (License): Change to LGPLv2+.
Bruno Haible [Thu, 10 Dec 2020 22:43:20 +0000 (23:43 +0100)]
execute, spawn-pipe: Fix memory leak on native Windows.
* lib/windows-spawn.h (prepare_spawn): Add a second parameter.
* lib/windows-spawn.c: Don't include xalloc.h.
(quoted_arg_length, quoted_arg_string): New functions, extracted from
prepare_spawn.
(prepare_spawn): Use malloc instead of XNMALLOC. Allocate memory for all
elements of *new_argv together.
* modules/windows-spawn (Depends-on): Remove xalloc. Add malloc-posix.
* lib/os2-spawn.h (prepare_spawn): Add a second parameter.
* lib/os2-spawn.c: Don't include xalloc.h.
(prepare_spawn): Use malloc instead of XNMALLOC. Allocate memory for all
elements of *new_argv together.
* lib/execute.c: Include xalloc.h.
(execute): Check return value of prepare_spawn. Free the memory
allocated by prepare_spawn.
* modules/execute (Depends-on): Add xalloc-die.
* lib/spawn-pipe.c: Include xalloc.h.
(create_pipe): Check return value of prepare_spawn. Free the memory
allocated by prepare_spawn.
* modules/spawn-pipe (Depends-on): Add xalloc-die.
Bruno Haible [Thu, 10 Dec 2020 20:47:39 +0000 (21:47 +0100)]
findprog-in: Relicense under LGPLv2+.
Paul Smith's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00072.html>.
* modules/findprog-in (License): Change to LGPLv2+.
Bruno Haible [Thu, 10 Dec 2020 20:32:54 +0000 (21:32 +0100)]
findprog-in: Don't exit upon out-of-memory.
* lib/findprog.h (find_in_given_path): Document ENOMEM as possible error
code.
* lib/findprog-in.c: Don't include xalloc.h.
(find_in_given_path): Call concatenated_filename, not
xconcatenated_filename. Call strdup, not xstrdup. Upon out-of-memory,
return NULL with errno set.
* modules/findprog-in (Depends-on): Remove xconcat-filename, xalloc. Add
concat-filename, strdup-posix, malloc-posix.
Bruno Haible [Wed, 9 Dec 2020 23:15:42 +0000 (00:15 +0100)]
fmaf: Work around a bug on FreeBSD 12.2/arm.
* m4/fmaf.m4 (gl_FUNC_FMAF_WORKS): Add one more test.
* doc/posix-functions/fmaf.texi: Mention the FreeBSD bug.
Bruno Haible [Wed, 9 Dec 2020 17:51:40 +0000 (18:51 +0100)]
threadlib: Fix test-fstrcmp failure on FreeBSD 11.
* m4/threadlib.m4 (gl_THREADLIB_BODY): When weak symbols are not present
on FreeBSD, define PTHREAD_IN_USE_DETECTION_HARD.
* lib/glthread/threadlib.c: Include <errno.h>.
(glthread_in_use): For FreeBSD, provide an alternative implementation
that uses pthread_key_create.
Bruno Haible [Wed, 9 Dec 2020 17:08:18 +0000 (18:08 +0100)]
math C++ tests: Fix compilation error in with clang >= 7 on FreeBSD.
* lib/math.in.h (isnan): For clang >= 7 on FreeBSD, declare 'rpl_isnan',
not 'isnan'.
Bruno Haible [Wed, 9 Dec 2020 03:06:40 +0000 (04:06 +0100)]
std-gnu11: Make compatible with Autoconf 2.70.
* m4/std-gnu11.m4: Disable the entire file if Autoconf >= 2.70 is in
use.
Bruno Haible [Tue, 8 Dec 2020 20:28:18 +0000 (21:28 +0100)]
argp: Avoid undefined behaviour when invoking qsort().
This fixes a test-argp-2.sh test failure on macOS and FreeBSD.
Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00085.html>.
* lib/argp-help.c (group_cmp): Remove third argument.
(hol_sibling_cluster_cmp, hol_cousin_cluster_cmp): New functions, based
upon hol_cluster_cmp.
(hol_cluster_cmp): Use hol_cousin_cluster_cmp.
(hol_entry_cmp): Rewritten to implement a total order.
Bruno Haible [Tue, 8 Dec 2020 18:54:27 +0000 (19:54 +0100)]
argp: Improve comments.
* lib/argp-help.c: Add sectioning comments. Write NULL to designate a
null pointer.
(struct hol_entry): Fix comment regarding sort order of group.
(hol_entry_short_iterate, hol_entry_long_iterate): Add comment.
(until_short, canon_doc_option, hol_entry_qcmp): Improve comment.
(hol_cluster_is_child, argp_hol): Move functions.
(HOL_ENTRY_PTRCMP): Remove unused macro.