Bruno Haible [Sun, 3 Jan 2021 12:38:03 +0000 (13:38 +0100)]
stddef: Override wrong max_align_t on AIX 7 with xlc in 64-bit mode.
* m4/stddef_h.m4 (gl_STDDEF_H): Make check for good max_align_t
stricter: Add tests for offsetof-based alignof.
* lib/stddef.in.h (max_align_t): Override on AIX in 64-bit mode.
* doc/posix-headers/stddef.texi: Document the AIX max_align_t bug.
Bruno Haible [Sun, 3 Jan 2021 01:14:16 +0000 (02:14 +0100)]
valgrind-tests: Disable valgrind if it would cause all tests to fail.
Suggested by Simon Josefsson <simon@josefsson.org> in
<https://lists.gnu.org/archive/html/help-gsasl/2021-01/msg00004.html>.
* m4/valgrind-tests.m4 (gl_VALGRIND_TESTS): Test $VALGRIND on an
executable produced by the current compiler. Set VALGRIND to empty if it
does not work. Don't set VALGRIND to empty if it merely does not accept
the --error-exitcode=1 --leak-check=full options.
Bruno Haible [Sat, 2 Jan 2021 18:31:45 +0000 (19:31 +0100)]
utimensat: Fix test failures on macOS 10.13.
* lib/utimensat.c: Include <string.h>, <sys/stat.h>.
(rpl_utimensat): Check against invalid tv_nsec values. Before calling
utimensat, recognize a filename ending in a slash that does not point
to a directory.
Bruno Haible [Sat, 2 Jan 2021 17:57:10 +0000 (18:57 +0100)]
utimens: Avoid test failures on macOS 10.13.
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00003.html>.
* tests/test-utimens-common.h (check_ctime): Define to -1 on macOS.
* tests/test-utimens.h (test_utimens): Don't expect a ctime change when
only the atime is requested to change.
* tests/test-futimens.h (test_futimens): Likewise.
* tests/test-lutimens.h (test_lutimens): Likewise.
Bruno Haible [Sat, 2 Jan 2021 15:54:21 +0000 (16:54 +0100)]
renameatu: Fix test failures on macOS.
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00003.html>.
* lib/renameatu.c (renameatu): Don't call renameatx_np right away.
Instead, treat it as a variant of renameat, with all possible bugs that
renameat might have.
Bruno Haible [Fri, 1 Jan 2021 23:14:05 +0000 (00:14 +0100)]
time: Define TIME_UTC.
* lib/time.in.h (TIME_UTC, GNULIB_defined_TIME_UTC): New macros.
* m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Set TIME_H_DEFINES_TIME_UTC.
* modules/time (Makefile.am): Substitute TIME_H_DEFINES_TIME_UTC.
* tests/test-time.c: Check that TIME_UTC is defined and a positive
integer.
* doc/posix-headers/time.texi: Mention TIME_UTC.
* lib/canonicalize-lgpl.c, lib/canonicalize.c (NARROW_ADDRESSES):
Remove, and remove all uses, as the optimization is arguably not
worth the extra complexity. Suggested by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121203.html
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.
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.
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.
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.
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 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 [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 [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: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: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: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: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: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: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.
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.
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.
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.
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.
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.