Bruno Haible [Sat, 18 Sep 2021 23:37:51 +0000 (01:37 +0200)]
sha1-buffer tests: New module.
* tests/test-sha1-buffer.c: New file, based on tests/test-sha1.c.
* tests/test-sha1-stream.c: Renamed from tests/test-sha1.c.
(main): Remove sha1-buffer tests.
* modules/crypto/sha1-buffer-tests: New file, based on
modules/crypto/sha1-tests.
* modules/crypto/sha1-tests: Remove tests that are now in
modules/crypto/sha1-buffer-tests. Test tests/test-sha1-stream.c instead
of tests/test-sha1.c.
Bruno Haible [Sat, 18 Sep 2021 23:35:24 +0000 (01:35 +0200)]
md5-buffer tests: New module.
* tests/test-md5-buffer.c: New file, based on tests/test-md5.c.
* tests/test-md5-stream.c: Renamed from tests/test-md5.c.
(main): Remove md5-buffer tests.
* modules/crypto/md5-buffer-tests: New file, based on
modules/crypto/md5-tests.
* modules/crypto/md5-tests: Remove tests that are now in
modules/crypto/md5-buffer-tests. Test tests/test-md5-stream.c instead
of tests/test-md5.c.
Bruno Haible [Sat, 18 Sep 2021 23:33:31 +0000 (01:33 +0200)]
md4-buffer tests: New module.
* tests/test-md4-buffer.c: Renamed from tests/test-md4.c.
* modules/crypto/md4-buffer-tests: Renamed from
modules/crypto/md4-tests. Test tests/test-md4-buffer.c instead of
tests/test-md4.c.
Bruno Haible [Sat, 18 Sep 2021 23:32:01 +0000 (01:32 +0200)]
md4-buffer: New module.
* lib/md4-stream.c: New file, extracted from lib/md4.c.
* lib/md4.c: Don't include stdlib.h, unlocked-io.h.
(BLOCKSIZE, md4_stream): Moved to md4-stream.c.
* lib/md4.h: Reorder declarations.
* modules/crypto/md4-buffer: New file, based on modules/crypto/md4.
* modules/crypto/md4: Rewritten.
Bruno Haible [Sat, 18 Sep 2021 23:30:12 +0000 (01:30 +0200)]
md2-buffer tests: New module.
* tests/test-md2-buffer.c: Renamed from tests/test-md2.c.
* modules/crypto/md2-buffer-tests: Renamed from
modules/crypto/md2-tests. Test tests/test-md2-buffer.c instead of
tests/test-md2.c.
Bruno Haible [Sat, 18 Sep 2021 23:29:33 +0000 (01:29 +0200)]
md2-buffer: New module.
* lib/md2-stream.c: New file, extracted from lib/md2.c.
* lib/md2.c: Don't include stdlib.h, unlocked-io.h.
(BLOCKSIZE, md2_stream): Moved to md2-stream.c.
* lib/md2.h: Reorder declarations.
* modules/crypto/md2-buffer: New file, based on modules/crypto/md2.
* modules/crypto/md2: Rewritten.
Paul Eggert [Mon, 13 Sep 2021 18:12:54 +0000 (11:12 -0700)]
asyncsafe-spin: port to Oracle Studio 12.6 sparc
Problem reported by Dennis Clarke via Eric Blake in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00056.html
* lib/asyncsafe-spin.c (asm) [0x590 <= __SUNPRO_C && __STDC__]:
#define to __asm.
* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER):
Special case for __OpenBSD__ && __powerpc64__, needed due to:
https://github.com/openbsd/src/commit/5e649a8714ba05cf482011b7b7d1e5437b7c17db
which is part of the oldest currently-supported OpenBSD (6.8),
so we needn’t worry about older versions.
Paul Eggert [Thu, 9 Sep 2021 02:18:37 +0000 (19:18 -0700)]
strerror_r-posix: port even better to Android
* lib/strerror_r.c: Use STRERROR_R_CHAR_P to decide whether the
system strerror_r returns char *, and HAVE_DECL_STRERROR_R to
decide whether it either does that or returns an integer. In the
former case, use the system strerror_r even on platforms like
Android API level 23 that don’t have __xpg_strerror_r; also
check for strerror_r failure just in case.
* m4/error.m4 (gl_PREREQ_ERROR):
* m4/strerror_r.m4 (gl_PREREQ_STRERROR_R):
Use system extensions on Android, to avoid mishandling strerror_r
on API level 23 and later.
* modules/error, modules/strerror_r-posix (configure.ac):
Surround gl_PREREQ_ERROR with AS_IF instead of plain if, so that
AC_REQUIREs are propagated out.
Paul Eggert [Wed, 8 Sep 2021 16:45:46 +0000 (09:45 -0700)]
strerror_r-posix: port better to Android
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Move requirement of
gl_USE_SYSTEM_EXTENSIONS from here ...
(gl_FUNC_STRERROR_R_WORKS): ... to here, which is the macro that
actually needs it. This avoids a bug where 'configure' tests
whether strerror_r has the POSIX API before enabling GNU
extensions. On Android, enabling GNU extensions switches from the
POSIX to the GNU API. Problem reported by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
Paul Eggert [Wed, 8 Sep 2021 16:42:41 +0000 (09:42 -0700)]
string, wchar: port rpl_free decl to Android
* lib/string.in.h, lib/wchar.in.h:
(free): When replacing it, declare the unreplaced version too.
Problem reported by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
Paul Eggert [Wed, 8 Sep 2021 00:51:39 +0000 (17:51 -0700)]
string, wchar: avoid some namespace pollution
* lib/string.in.h, lib/wchar.in.h:
(free): Declare by hand instead of including stdlib.h.
This avoids some namespace pollution. It should also avoid some
nested-include problems described by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00018.html
* modules/string, modules/wchar:
(Depends-on): Add stdlib, so that REPLACE_FREE has the right value.
(Makefile.am): Replace @REPLACE_FREE@ when creating the include file.
Paul Eggert [Tue, 7 Sep 2021 01:43:36 +0000 (18:43 -0700)]
crypto: add missing file af_alg.h
* modules/crypto/md5-buffer, modules/crypto/sha1-buffer:
* modules/crypto/sha256-buffer, modules/crypto/sha512-buffer:
(Files): Add lib/af_alg.h, since the .c files include it.
Simon Josefsson [Sat, 4 Sep 2021 08:26:26 +0000 (10:26 +0200)]
doc: Improve help related to bootstrap script.
* doc/gnulib-tool.texi (VCS Issues): Make title more positive,
s/Issues/Integration/. Some more bootstrap-related hints,
including changing suggested submodule path from .gnulib to gnulib
as this seems to be more wide-spread.
* top/maint.mk (indent): Use AM_V_GEN and indent_args.
(sc_indent): New rule.
(indent_args): New variable.
(C_SOURCES): New variable, initialized to reasonable C files.
(exclude_file_name_regexp--indent): New variable.
Paul Eggert [Mon, 30 Aug 2021 18:15:20 +0000 (11:15 -0700)]
idx: add commentary
* lib/idx.h: Add comments about ssize_t and strlen, in
response to comments from Simon Josefsson in:
https://lists.gnu.org/r/bug-gnulib/2021-08/msg00196.html
Bruno Haible [Mon, 30 Aug 2021 00:36:31 +0000 (02:36 +0200)]
supersede: Fix test failure under QEMU user-mode for Linux/mips.
* tests/test-supersede-open.h (test_open_supersede): Copy statbuf.st_dev
into a local variable of type dev_t.
* tests/test-supersede-fopen.h (test_fopen_supersede): Likewise.
Bruno Haible [Sun, 29 Aug 2021 23:56:46 +0000 (01:56 +0200)]
posix_spawn_file_actions_addfchdir: Avoid test failure under QEMU.
* tests/test-posix_spawn-fchdir.c: Include qemu.h.
(is_qemu): New variable.
(test): Under QEMU user-mode, don't expect that "pwd" produces the
result "/".
(main): Initialize is_qemu. Under QEMU user-mode, skip the relative file
name test.
* modules/posix_spawn_file_actions_addfchdir-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
Bruno Haible [Sun, 29 Aug 2021 23:44:03 +0000 (01:44 +0200)]
getcwd tests: Avoid test failure when running under QEMU user-mode.
* modules/getcwd-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
* tests/test-getcwd.c: Include qemu.h.
(test_long_name): Skip this test when running under QEMU user-mode.
(main): Consider return code 77 from test_long_name.
Bruno Haible [Sun, 29 Aug 2021 16:54:54 +0000 (18:54 +0200)]
explicit_bzero test: Fix test failure due to GCC optimizations.
* tests/test-explicit_bzero.c (do_secret_stuff): Use static variable
'last_stackbuf'.
(main): Use an 'if' to combine the two do_secret_stuff invocations.
Paul Eggert [Sun, 29 Aug 2021 07:45:43 +0000 (00:45 -0700)]
base32, base64: fix broken tests
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2021-08/msg00170.html
* lib/base32.c, lib/base64.c: Do not include verify.h,
and omit all uses of ‘assume’.
* modules/base32, modules/base64 (Depends-on): Remove verify.
* tests/test-base32.c, tests/test-base64.c:
Don’t pass out-of-range values to allocator,
as converting them to idx_t relies on implementation-defined
behavior that could trap.
Bruno Haible [Sat, 28 Aug 2021 23:03:29 +0000 (01:03 +0200)]
Skip some tests when running under QEMU user-mode.
* tests/qemu.h: New file.
* tests/test-get-rusage-as.c: Include qemu.h.
(main): Skip the test when running under QEMU.
* tests/test-get-rusage-data.c: Include qemu.h.
(main): Skip the test when running under QEMU.
* tests/test-printf-posix2.c: Include qemu.h.
(main): Return with code 77 when running under QEMU.
* tests/test-fprintf-posix2.c: Include qemu.h.
(main): Return with code 77 when running under QEMU.
* tests/test-fprintf-posix3.c: Include qemu.h.
(main): Return with code 79 when running under QEMU.
* tests/test-fprintf-posix3.sh: Skip the test when the return code was
79.
* tests/test-dprintf-posix2.c: Include qemu.h.
(main): Return with code 79 when running under QEMU. Use return code 80
instead of 78.
* tests/test-dprintf-posix2.sh: Skip the test when the return code was
79. Update for changed return code.
* modules/get-rusage-as-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
* modules/get-rusage-data-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
* modules/fprintf-posix-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
* modules/dprintf-posix-tests (Files): Add qemu.h.
(Depends-on): Add stdbool.
Bruno Haible [Sat, 28 Aug 2021 17:39:05 +0000 (19:39 +0200)]
sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha.
* lib/sigabbrev_np.c (sigabbrev_np): When SIGINFO and SIGPWR have the
same value, give precendence to SIGPWR.
* lib/sigdescr_np.c (sigdescr_np): Likewise.
* tests/test-sigabbrev_np.c (main): Likewise.
* tests/test-sigdescr_np.c (main): Likewise.
Paul Eggert [Thu, 26 Aug 2021 17:08:00 +0000 (10:08 -0700)]
regex: use C99-style array arg syntax
This should help with some static checking.
Derived from a suggestion by Martin Sebor in:
https://sourceware.org/pipermail/libc-alpha/2021-August/130336.html
This also ports recent and relevant Glibc changes to Gnulib
and prepares to copy back.
* lib/cdefs.h (__ARG_NELTS): New macro.
* lib/regex.c: Ignore -Wvla for the whole file.
* lib/regex.h (_ARG_NELTS_, _Attr_access_): New macros.
Ignore -Wvla when declaring regexec.
* lib/regex.h (re_compile_pattern, re_search, re_search_2)
(re_match, re_match_2, regcomp, regerror):
Use _Attr_access_ where that could help static checking.
* lib/regexec.c (regexec, __compat_regexec, re_copy_regs)
(re_search_internal, proceed_next_node, push_fail_stack)
(pop_fail_stack, set_regs, update_regs):
Use __ARG_NELTS for each array parameter whose size is another arg,
but which might be null.
Bruno Haible [Wed, 25 Aug 2021 10:43:56 +0000 (12:43 +0200)]
execute tests: Fix test failure when libtool is in use.
* modules/execute-tests (Makefile.am): Link test-execute-child without
using libtool.
* modules/spawn-pipe-tests (Makefile.am): Link test-spawn-pipe-child
without using libtool.
* modules/system-quote-tests (Makefile.am): Link test-system-quote-child
without using libtool.
Paul Eggert [Wed, 25 Aug 2021 03:12:19 +0000 (20:12 -0700)]
dfa: prefer idx_t to ptrdiff_t for nonnegative
* lib/dfa.c (struct dfa, dfaexec_main, dfaexec_mb, dfaexec_sb)
(dfaexec_noop, dfaexec):
* lib/dfa.h (dfaparse, dfacomp, dfaexec):
Prefer idx_t to ptrdiff_t for counts, which should be nonnegative.
* lib/dfa.h: Include idx.h.
Bruno Haible [Sat, 21 Aug 2021 23:25:59 +0000 (01:25 +0200)]
c-stack: Test for libsigsegv once, not twice.
* m4/sigsegv.m4: New file, based on modules/sigsegv.
* modules/sigsegv (Files): Add it.
(configure.ac): Require gl_SIGSEGV. Test gl_sigsegv_uses_libsigsegv
instead of with_libsigsegv and gl_cv_lib_sigsegv.
* m4/c-stack.m4 (gl_C_STACK): Likewise.
Paul Eggert [Sat, 21 Aug 2021 02:25:06 +0000 (19:25 -0700)]
rawmemchr: modernize and simplify
* lib/rawmemchr.c (HAVE_RAWMEMCHR): Assume it’s not defined;
otherwise this file would not be compiled. Include limits.h,
stdalign.h, stdint.h, verify.h.
(rawmemchr): Prefer uintptr_t to unsigned long and to size_t when
it’s the better type. Verify that longword lacks padding. Use
alignof rather than sizeof when checking alignment. Simplify by
assuming C99 decl-after-statement, and by using multiplication
rather than repeated shifting and OR (modern compilers can
optimize the multiplication if needed). Avoid unnecessary casts.
Don’t assume CHAR_WIDTH is 8. Convert back and forth between void *
to suppress bogus GCC warnings about alignment. Omit a
duplicate assignment to char_ptr.
* modules/rawmemchr (Depends-on): Add stdalign, stdint, verify.
Paul Eggert [Wed, 11 Aug 2021 20:00:57 +0000 (13:00 -0700)]
dynarray: merge from glibc
This also helps document glibc’s direction in using GCC’s
memory-allocation checking.
* lib/cdefs.h: Omit comments that glibc rejected.
(__returns_nonnull, __attr_access_none, __attr_dealloc)
(__attr_dealloc_free): New macros.
* lib/libc-config.h: Undef the new macros that are defined
unconditionally.
* lib/malloc/dynarray_at_failure.c [_LIBC]: Do not include stdlib.h.
(__libc_dynarray_at_failure) [_LIBC]: Call __libc_fatal,
fixing a bad merge previously.
* lib/stdio.in.h (fdopen, fopen, tmpfile): For GCC >= 11: Declare nearly
always.
(popen): For GCC >= 11: Declare also when the platform already declares
the function or when the module 'popen' is not in use.
* lib/dirent.in.h (opendir): For GCC >= 11: Declare also when the
platform already declares the function or when the module 'opendir' is
not in use.
(fdopendir): For GCC >= 11: Declare also when the platform already
declares the function or when the module 'fdopendir' is not in use.
* lib/stdlib.in.h (aligned_alloc): For GCC >= 11: Declare also when the
platform already declares the function or when the module
'aligned_alloc' is not in use.
(calloc): For GCC >= 11: Declare nearly always.
(canonicalize_file_name): For GCC >= 11: Declare also when the platform
already declares the function or when the module 'canonicalize-lgpl' is
not in use.
(malloc, realloc): For GCC >= 11: Declare nearly always.
* lib/malloc.in.h: Remove redundant include.
(memalign): For GCC >= 11: Declare also when the platform already
declares the function or when the module 'memalign' is not in use.
* lib/string.in.h: Include <stdlib.h> always.
(strdup): For GCC >= 11: Declare also when the platform already declares
the function or when the module 'strdup' or 'strdup-posix' is not in
use.
* lib/wchar.in.h: Include <stdlib.h> always.
(wcsdup): For GCC >= 11: Declare also when the platform already declares
the function or when the module 'wcsdup' is not in use.
* modules/free-posix (Depends-on): Add string, wchar.
Bruno Haible [Sun, 8 Aug 2021 01:52:01 +0000 (03:52 +0200)]
gnulib-tool: Add support for Automake 1.16.4.
Reported by <shoober420@gmail.com> in
<https://lists.gnu.org/archive/html/bug-libunistring/2021-08/msg00000.html>.
* build-aux/test-driver-1.16.3.diff: Renamed from build-aux/test-driver.diff.
* build-aux/test-driver.diff: Update to match Automake 1.16.4.
* gnulib-tool (func_create_testdir, func_create_megatestdir): Try both
.diff files.
* lib/uninorm.in.h (uninorm_filter_free): Move declaration up.
(uninorm_filter_create): Declare that deallocation must happen through
'uninorm_filter_free'.
* lib/unistr.in.h: Include <stdlib.h>.
(u8_strdup, u16_strdup, u32_strdup): Declare that deallocation must
happen through 'free'.