Bruno Haible [Tue, 15 Jun 2021 16:37:18 +0000 (18:37 +0200)]
pipe-filter-ii tests: Fix long-standing failure on native Windows.
* tests/test-pipe-filter-ii2-main.c: Include binary-io.h.
(main): Avoid NL to CRLF conversion on standard output.
* tests/test-pipe-filter-ii2-child.c: Include <unistd.h>, binary-io.h.
(main): Avoid NL to CRLF conversion on standard output.
Paul Eggert [Sun, 13 Jun 2021 17:31:33 +0000 (10:31 -0700)]
getopt-gnu: port back to Solaris 10
* gnulib-tool (func_emit_lib_Makefile_am)
(func_emit_tests_Makefile_am): Don’t substitute things like
$(GNULIB_${gl_include_guard_prefix}_UNISTD_H_GETOPT),
as this mishandles unistd and getopt-gnu, which breaks
‘make check’ on Solaris 10 with getopt-gnu.
* pygnulib/GLEmiter.py (lib_Makefile_am, tests_Makefile_am):
Likewise, albeit hackier since I did not test this and
so went with a trivial hack instead.
Paul Eggert [Sat, 12 Jun 2021 00:18:57 +0000 (17:18 -0700)]
exclude: prefer idx_t for most indexes
* lib/exclude.c (struct exclude_pattern, free_exclude_segment)
(file_pattern_matches, add_exclude, add_exclude_fp):
Prefer idx_t to size_t for indexes, and use idx_t-related allocators.
Paul Eggert [Sat, 12 Jun 2021 00:18:57 +0000 (17:18 -0700)]
dfa: prefer idx_t for indexes
* lib/dfa.c (mbs_to_wchar, state_index, dfaoptimize, dfaanalyze)
(icatalloc, enlist, allocmust, dfamust):
Prefer idx_t to size_t for indexes, and use idx_t-related allocators.
Paul Eggert [Sat, 12 Jun 2021 00:18:57 +0000 (17:18 -0700)]
dirname: prefer idx_t for some indexes
* lib/basename.c (base_name):
Prefer idx_t to size_t for indexes, and use idx_t-related allocators.
* lib/basename.c: Do not include xstrndup.h.
(basename): Simplify by always using memcpy.
* modules/dirname (Depends-on): Removbe xstrndup.
Paul Eggert [Sat, 12 Jun 2021 00:18:57 +0000 (17:18 -0700)]
xalloc: new idx_t-based allocators
This is for code that prefers to use idx_t for sizes.
* lib/xalloc.h (ximalloc, xizalloc, xicalloc, xirealloc)
(xireallocarray, ximemdup, ximemdup0) [GNULIB_XALLOC]:
New decls.
(x2nrealloc): Now just a decl, as the body is moved into xmalloc.c.
* lib/xmalloc.c: Include ialloc.h.
Rename some local parameters to be consistent with the .h files.
(nonnull): New static function.
(xmalloc, xcalloc): Simplify by using nonnull.
(ximalloc, xirealloc, xireallocarray, xizalloc, xicalloc)
(ximemdup, ximemdup0): New functions.
(x2nrealloc): Moved here from xalloc.h.
* modules/xalloc (Depends-on): Add ialloc.
Paul Eggert [Sat, 12 Jun 2021 00:18:57 +0000 (17:18 -0700)]
exclude: improve wide-character hashing
* lib/exclude.c (string_hasher_ci): Take the modulo at the end
rather than each time a wide character is retrieved; this should
be more efficient and should hash better.
Bruno Haible [Thu, 10 Jun 2021 19:26:53 +0000 (21:26 +0200)]
Clarify that compiler warnings in the Gnulib tests can be ignored.
* gnulib-tool (func_emit_tests_Makefile_am): Emit overrides for CFLAGS
and CXXFLAGS. Emit a dependency of 'all' on 'all-notice' that prints a
notice.
(func_emit_initmacro_start): Add a second argument. If it is true, emit
code to require gl_CC_ALLOW_WARNINGS and gl_CXX_ALLOW_WARNINGS.
(func_import, func_create_testdir): All callers updated.
* m4/gnulib-common.m4 (gl_CC_ALLOW_WARNINGS, gl_CXX_ALLOW_WARNINGS): New
macros.
As the full review might take some time, would it be possible to apply
at least the part related to fuse.portal file systems? They started to
cause problems recently:
Bruno Haible [Sun, 6 Jun 2021 22:56:50 +0000 (00:56 +0200)]
scratch_buffer: Avoid conflict with prepr. macros owned by the system.
* lib/scratch_buffer.h: Don't include <libc-config.h>. Define
_GL_LIKELY, _GL_UNLIKELY. Include malloc/scratch_buffer.gl.h instead of
malloc/scratch_buffer.h.
* modules/scratch_buffer (Depends-on): Add builtin-expect.
(Makefile.am): Arrange to create malloc/scratch_buffer.gl.h from
malloc/scratch_buffer.h.
Bruno Haible [Sun, 6 Jun 2021 22:54:25 +0000 (00:54 +0200)]
dynarray: Avoid conflict with preprocessor macros owned by the system.
* lib/dynarray.h: Don't include <libc-config.h>. Define _GL_LIKELY,
_GL_UNLIKELY. Include malloc/dynarray.gl.h instead of malloc/dynarray.h.
Include malloc/dynarray-skeleton.gl.h instead of
malloc/dynarray-skeleton.c.
* modules/dynarray (Depends-on): Add builtin-expect.
(Makefile.am): Arrange to create malloc/dynarray.gl.h from
malloc/dynarray.h and malloc/dynarray-skeleton.gl.h from
malloc/dynarray-skeleton.c.
Dmitry V. Levin [Sun, 6 Jun 2021 08:00:00 +0000 (08:00 +0000)]
regex-tests: remove incorrect comment
* tests/test-regex.c (tests): Remove the comment saying that some tests
are not used. That comment was copied along with tests from glibc
where some of these tests are commented out.
Fixes: 70b673eb7 ("regex: fix longstanding backref match bug")
Bruno Haible [Sat, 5 Jun 2021 13:44:26 +0000 (15:44 +0200)]
vasnprintf: Don't leak memory when memory allocation fails.
Found by Coverity. Reported by Mike Fabian <mfabian@redhat.com> in
<https://lists.gnu.org/archive/html/bug-libunistring/2021-06/msg00000.html>.
* lib/vasnprintf.c (VASNPRINTF): In places where a local variable points
to heap-allocated storage, free that storage before doing
'goto out_of_memory;'.
* gnulib-tool: Don't document --more-symlinks and --more-hardlinks any
more.
(do_copyrights): Remove variable.
(func_import): Don't perform license updates on imported files any more.
* pygnulib/GLInfo.py: Don't document --more-symlinks any more.
* doc/gnulib-intro.texi (Copyright): Document the new situation.
* doc/gnulib.texi (Module description): Likewise.
* NEWS: Mention the change.
Bruno Haible [Fri, 4 Jun 2021 18:49:16 +0000 (20:49 +0200)]
Revamp check-copyright script.
* check-copyright: Search only the first 50 lines of each file.
Recognize 'LGPLv3+ or GPLv2+', 'unlimited', and 'public domain' license
notices. For files that are part of several modules, consider the
weakest among the licenses. Allocate more room for the first output
column.
Paul Eggert [Sun, 30 May 2021 17:04:06 +0000 (10:04 -0700)]
reallocarray-tests: port to weird platforms
* tests/test-reallocarray.c (main): Don’t assume that
PTRDIFF_MAX / 2 + 1 <= SIZE_MAX. POSIX allows platforms
where this isn’t true, though I don’t know of any examples.
Paul Eggert [Sun, 30 May 2021 17:02:20 +0000 (10:02 -0700)]
dfa, etc.: prefer xreallocarray to older name
* lib/dfa.c (addtok_mb, realloc_trans_if_necessary, enlist):
* lib/readtokens.c (readtokens):
* tests/uninorm/test-u32-normalize-big.c:
(read_normalization_test_file):
Prefer xreallocarray to the equivalent xnrealloc.
The newer name follows the glibc lead of ‘reallocarray’.
Paul Eggert [Sat, 29 May 2021 17:14:01 +0000 (10:14 -0700)]
sigsegv: Port to Solaris 11
Problem reported by Kiyoshi KANAZAWA in:
https://lists.gnu.org/r/bug-m4/2021-05/msg00020.html
* lib/stackvma.c (_FILE_OFFSET_BITS): #undef on Solaris and Android.
Paul Eggert [Fri, 21 May 2021 21:41:42 +0000 (14:41 -0700)]
sigsegv: don’t assume SIGSTKSZ is a constant
* m4/sigaltstack.m4 (SV_SIGALTSTACK): Don’t attempt to override
SIGSTKSZ. Instead, use an array that is plenty large, while
checking that it’s large enough. Also, be consistent about
putting that array in static storage rather than on the stack.
* tests/altstack-util.h (SIGSTKSZ): Don’t define.
(MYSTACK_SIZE): New macro, used consistently instead of SIGSTKSZ.
(mystack_storage, mystack): Now static.
(prepare_alternate_stack) [defined SIGSTKSZ]:
Check that MYSTACK_SIZE is large enough.
Pádraig Brady [Sat, 15 May 2021 16:50:33 +0000 (17:50 +0100)]
realloc-gnu: avoid glibc MALLOC_CHECK_ issue
* tests/test-realloc-gnu.c (main): if MALLOC_CHECK_ env var
is set then don't check ENOMEM is returned from realloc().
See https://sourceware.org/bugzilla/show_bug.cgi?id=27870
Note it doesn't suffice to unsetenv() this var within the program,
as the hooks have already been set up at that stage.
Paul Eggert [Sat, 15 May 2021 05:48:20 +0000 (22:48 -0700)]
c-stack: work around Solaris 11 bugs
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2021-05/msg00062.html
* lib/c-stack.c: Always include sigsegv.h if HAVE_LIBSIGSEGV.
(USE_LIBSIGSEGV): Do not use libsigsegv if the kernel
has the si_addr bug and libsigsegv is too old to work
around it.
(segv_handler) [!USE_LIBSIGSEGV]: Do not trust si_addr
if BOGUS_SI_ADDR_UPON_STACK_OVERFLOW.
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC):
Define BOGUS_SI_ADDR_UPON_STACK_OVERFLOW on Solaris 2.11 SPARC.
And do not define HAVE_XSI_STACK_OVERFLOW_HEURISTIC.
Bruno Haible [Fri, 14 May 2021 21:32:08 +0000 (23:32 +0200)]
linked-list-unportable-test: New module.
* modules/linked-list-unportable-tests: New file, based on
modules/linked-list-tests.
* modules/linked-list-tests: Remove the unportable tests from here.
Depend on linked-list-unportable-tests.
Simon Josefsson [Fri, 14 May 2021 17:23:23 +0000 (19:23 +0200)]
valgrind-tests: Doc fix and introduce AM_VALGRINDFLAGS.
* doc/valgrind-tests.texi (Using valgrind automatically): Clarify
when the parallel vs serial test harness is used, suggested by
Bruno Haible <bruno@clisp.org>.
* m4/valgrind-tests.m4: Add VALGRIND_PROGRAM and AM_VALGRINDFLAGS.
Simon Josefsson [Fri, 14 May 2021 12:17:20 +0000 (14:17 +0200)]
valgrind-tests: Better option handling.
* m4/valgrind-tests.m4: Support new variables VALGRINDFLAGS and
DEFAULT_VALGRINDFLAGS.
* doc/valgrind-tests.texi (Running self-tests under valgrind): Improve.