]> Savannah Git Hosting - gnulib.git/log
gnulib.git
4 years agosupersede: Fix crash when malloc() fails.
Bruno Haible [Fri, 30 Apr 2021 23:03:41 +0000 (01:03 +0200)]
supersede: Fix crash when malloc() fails.

Found by GCC 11 '-fanalyzer'.

* lib/supersede.c (create_temp_file): Don't crash when malloc() fails.

4 years agolibc-config: fix include problem on older Debian
Paul Eggert [Tue, 27 Apr 2021 18:23:28 +0000 (11:23 -0700)]
libc-config: fix include problem on older Debian

https://lists.gnu.org/r/bug-gnulib/2021-04/msg00198.html
* lib/cdefs.h: Use __GNULIB_CDEFS, not __GLIBC__,
to determine whether to include the bits/* files.
* lib/libc-config.h (__WORDSIZE): Remove.
(__GNULIB_CDEFS): New macro.

4 years agognulib-tool: port better to current Autoconf
Paul Eggert [Tue, 27 Apr 2021 06:31:29 +0000 (23:31 -0700)]
gnulib-tool: port better to current Autoconf

* doc/gnulib-tool.texi (Initial import): Don’t mention
AC_PROG_CC_STDC as it’s deprecated in current Autoconf.
* gnulib-tool (func_done_dir): Suggest replacing
AC_PROG_CC_STDC and AC_PROG_CC_C99, as per current Autoconf.

4 years agoreallocarray: a bit more tuning
Paul Eggert [Mon, 26 Apr 2021 06:11:15 +0000 (23:11 -0700)]
reallocarray: a bit more tuning

* lib/reallocarray.c: Include intprops.h.
(reallocarray): Use INT_MULTIPLY_WRAPV instead of
xalloc_oversized, as it now suffices and is likely a bit more
efficient (five fewer machine insns on Ubuntu 20.10 x86-64).
* modules/reallocarray (Depends-on): Depend on intprops, not
xalloc-oversized.  Use conditional dependencies to avoid building
realloc-gnu when not needed.

4 years agoreallocarray: don’t crash if item size is 0
Paul Eggert [Mon, 26 Apr 2021 01:24:42 +0000 (18:24 -0700)]
reallocarray: don’t crash if item size is 0

This problem affects only platforms where xalloc_oversized
divides a number by the size arg.  Fix this by defining
xalloc_oversized (n, s) to work even if s == 0.
* lib/malloca.h, lib/xalloc-oversized.h: Document new behavior.
* lib/xalloc-oversized.h (__xalloc_oversized): Do not crash if S==0.
* tests/test-reallocarray.c (main): Test for the bug.

4 years agoFix messed-up previous patch
Paul Eggert [Sun, 25 Apr 2021 01:17:45 +0000 (18:17 -0700)]
Fix messed-up previous patch

4 years agoxmalloca, etc.: avoid unlikely trap
Paul Eggert [Sun, 25 Apr 2021 01:13:40 +0000 (18:13 -0700)]
xmalloca, etc.: avoid unlikely trap

* lib/xmalloca.h (xnmalloca):
Use size_t, not ptrdiff_t, to avoid implementation-defined
behavior (which could include a trap) if N is 0 and S exceeds
PTRDIFF_MAX.
* lib/xalloc-oversized.h: Adjust comment to match.

4 years agoxmalloca, etc.: fix some xalloc-oversized issues
Paul Eggert [Sun, 25 Apr 2021 00:59:53 +0000 (17:59 -0700)]
xmalloca, etc.: fix some xalloc-oversized issues

* lib/malloca.h (nmalloca):
* lib/xmalloca.h (xnmalloca): Convert S to ptrdiff_t to avoid
arithmetic overflow if N and S are both narrower than ptrdiff_t.
* lib/xalloc-oversized.h (xalloc_oversized):
Don’t say that args must be ptrdiff_t or size_t or wider.
The macro returns the correct answer even when that is not
the case, and it’s the caller’s responsibility to avoid
howlers like (xalloc_oversized (n, s) ? NULL : malloc (n * s))
when N and S are both narrower than ptrdiff_t and size_t.
Add a comment to that effect.
* lib/xmalloca.h: Include xalloc-oversized.h, since this file uses
xalloc_oversized.  Add comments about side effects and avoid
unnecessary parens.
* modules/xmalloca (Depends-on): Add xalloc-oversized.

4 years agoreallocarray: check for ptrdiff_t overflow
Paul Eggert [Sat, 24 Apr 2021 17:45:45 +0000 (10:45 -0700)]
reallocarray: check for ptrdiff_t overflow

* doc/glibc-functions/reallocarray.texi (reallocarray):
Mention ptrdiff_t overflow.
* lib/reallocarray.c (reallocarray): Reindent as per usual GNU.
* lib/stdlib.in.h (reallocarray): Allow reallocarray to be replaced.
* m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY):
Check for ptrdiff_t overflow.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Set up REPLACE_REALLOCARRAY.
* modules/reallocarray (Files): Add malloc.m4.
(configure.ac): Also test REPLACE_REALLOCARRAY.
* modules/reallocarray-tests (Depends-on): Add stdint.
* modules/stdlib (stdlib.h): Substitute REPLACE_REALLOCARRAY.
* tests/test-reallocarray.c: Include stdint.h.
(main): Check for ptrdiff_t overflow.

4 years agocalloc-gnu-tests: add overflow tests
Paul Eggert [Sat, 24 Apr 2021 17:12:15 +0000 (10:12 -0700)]
calloc-gnu-tests: add overflow tests

* tests/test-calloc-gnu.c (identity): New function, replacing ‘eight’.
(main): Do 2 * log2(SIZE_MAX) tests instead of just two tests.
Don’t bother to free on failure.

4 years ago* ChangeLog: Fix thinko.
Paul Eggert [Thu, 22 Apr 2021 19:35:57 +0000 (12:35 -0700)]
* ChangeLog: Fix thinko.

4 years agolibc-config: port better to Fedora Rawhide
Paul Eggert [Thu, 22 Apr 2021 19:29:49 +0000 (12:29 -0700)]
libc-config: port better to Fedora Rawhide

Problem reported by Eric Blake in:
https://lists.gnu.org/r/bug-gnulib/2021-04/msg00181.html
* lib/cdefs.h: Make this closer to glibc, so that we can
merge Gnulib into glibc here.
(__attribute_maybe_unused__): Make identical to glibc’s
definition, though with an additional comment.
(__attribute_nonnull__): Add clarifying comment.
Make inclusion of bits/wordsize.h, bits/long-double.h
dependent on __GLIBC__, not on !__WORDSIZE.
* lib/libc-config.h: Use __attribute_nonnull__,
not __attribute_maybe_unused__, to detect whether
to include sys/cdefs.h.

4 years agorealloc: port to AIX 7.1
Paul Eggert [Wed, 21 Apr 2021 18:10:06 +0000 (11:10 -0700)]
realloc: port to AIX 7.1

* lib/realloc.c (_GL_USE_STDLIB_ALLOC): Do not define.  This
module relies on GNU malloc.  This fixes a test failure on AIX 7.1.

4 years agomalloc: simplify
Paul Eggert [Wed, 21 Apr 2021 18:09:01 +0000 (11:09 -0700)]
malloc: simplify

* lib/malloc.c: Omit unnecessary "#undef malloc".
I recently introduced it by mistake.  This module defines
_GL_USE_STDLIB_ALLOC and so malloc isn’t redefined to rpl_malloc.

4 years agomalloca: avoid ptrdiff_t overflow
Paul Eggert [Wed, 21 Apr 2021 18:07:18 +0000 (11:07 -0700)]
malloca: avoid ptrdiff_t overflow

* lib/malloca.c: Include idx.h, intprops.h.
(mmalloca): Check for ptrdiff_t overflow.  Since this module uses
_GL_USE_STDLIB_ALLOC, it cannot assume GNU malloc semantics.
* modules/malloca (Depends-on): Add idx, intprops.

4 years agocareadlinkat: avoid ptrdiff_t overflow
Paul Eggert [Wed, 21 Apr 2021 18:03:39 +0000 (11:03 -0700)]
careadlinkat: avoid ptrdiff_t overflow

* lib/careadlinkat.c: Include idx.h, minmax.h.
(readlink_stk): Avoid ptrdiff_t overflow in object allocation.
Since this module uses arbitrary allocators (including
stdlib_allocator), it cannot assume GNU malloc semantics.
* modules/careadlinkat (Depends-on): Add idx, minmax.

4 years agoexecute-tests: pacify compiler
Paul Eggert [Wed, 21 Apr 2021 17:13:50 +0000 (10:13 -0700)]
execute-tests: pacify compiler

* tests/test-execute-main.c (main): Use 0x7DEADBEE rather than
0xDEADBEEF for nonces, to avoid provoking AIX XLC compiler warning
that the latter is out of int range.

4 years agomalloc-gnu-tests, etc.: use volatile for clang
Paul Eggert [Wed, 21 Apr 2021 00:11:51 +0000 (17:11 -0700)]
malloc-gnu-tests, etc.: use volatile for clang

In some more test locations, store the result of malloc etc. into
a volatile pointer so that clang doesn’t optimize away the malloc
and thus bypass the test.  This fixes a malloc-gnu test failure on
macOS 11.2.3 with clang 12.0.0 on ARM.
* tests/test-alloca-opt.c (do_allocation):
* tests/test-malloc-gnu.c (main):
* tests/test-malloca.c (do_allocation):
* tests/test-realloc-gnu.c (main):
* tests/test-reallocarray.c (main):
* tests/test-aligned-malloc.c (main):
* tests/test-aligned_alloc.c (main):
Store malloc etc. results into a volatile pointer.

4 years agomalloc-gnu-tests: pacify -Walloc-size-larger-than
Paul Eggert [Mon, 19 Apr 2021 04:18:00 +0000 (21:18 -0700)]
malloc-gnu-tests: pacify -Walloc-size-larger-than

* tests/test-malloc-gnu.c (main):
* tests/test-realloc-gnu.c (main): Hide true intentions from GCC,
to prevent diagnostics like “warning: argument 1 value
9223372036854775808’ exceeds maximum object size
9223372036854775807 [-Walloc-size-larger-than=]”.

4 years agosafe-alloc: fix pointer implementation
Paul Eggert [Mon, 19 Apr 2021 03:50:55 +0000 (20:50 -0700)]
safe-alloc: fix pointer implementation

The old implementation assumed that all pointers use the same
internal representation, but the C standard doesn’t guarantee
this.  Use void * (pointer) not void ** (pointer-to-pointer) for
the internal functions’ API.  The internal functions now return
NULL if and only if they failed, and the macros translate that
into -1 or 0 to satisfy the existing API.
* doc/safe-alloc.texi (Safe Allocation Macros): Mention overflow.
* lib/safe-alloc.c: Major rewrite.  Now this simply
defines SAFE_ALLOC_INLINE and includes safe-alloc.h.
* lib/safe-alloc.h: Include stddef.h, not stdlib.h.
(SAFE_ALLOC_INLINE): New macro; use Gnulib inline function style.
(safe_alloc_realloc_n): New API, which passes and returns
the pointer, and which returns NULL if and only if failure occurs.
(safe_alloc_check): New function.
(ALLOC, ALLOC_N, ALLOC_N_UNINITIALIZED, REALLOC_N):
Redo using the new API for internal functions, and using calloc
which is good enough since it’s GNU-compatible now.
(FREE): Expand to an expression rather than merely to something
that needs a following ‘;’ to become a statement.
* modules/safe-alloc (Depends-on): Add calloc-gnu.

4 years agocalloc-gnu: now LGPLv2+
Paul Eggert [Mon, 19 Apr 2021 03:52:29 +0000 (20:52 -0700)]
calloc-gnu: now LGPLv2+

* modules/calloc-gnu (License): Change from GPL to LGPLv2+.
The old value was evidently a longstanding typo, and calloc
will be needed by LGPLv2+ modules that will want to rely
on GNU behavior.

4 years agosafe-alloc: simplify via reallocarray
Paul Eggert [Sun, 18 Apr 2021 23:53:11 +0000 (16:53 -0700)]
safe-alloc: simplify via reallocarray

* lib/safe-alloc.c: Do not include xalloc-oversized.h.
(safe_alloc_alloc_n, safe_alloc_realloc_n):
Use reallocarray to check for size or ptrdiff_t overflow.
* modules/reallocarray (License): Switch from LGPL to LGPLv2+, as
this is needed for safe-alloc and anyway is more appropriate for
this library function common with BSD.
* modules/safe-alloc (Depends-on): Depend on reallocarray
rather than xalloc-oversized.

4 years agoxalloc-oversized: fix SIZE_MAX optimization bug
Paul Eggert [Sun, 18 Apr 2021 23:30:59 +0000 (16:30 -0700)]
xalloc-oversized: fix SIZE_MAX optimization bug

* lib/xalloc-oversized.h (xalloc_count_t): Remove; no longer
needed and was evidently error-prone anyway.
(xalloc_oversized): Omit some over-optimization that caused
SIZE_MAX to not be treated as too large (the Gnulib convention) on
unusual platforms where PTRDIFF_MAX == SIZE_MAX.  This change
should not affect typical platforms where PTRDIFF_MAX < SIZE_MAX.
When optimizing, simply use ptrdiff_t instead of xalloc_count_t.

4 years agoxalloc: new function xreallocarray
Paul Eggert [Sun, 18 Apr 2021 23:24:51 +0000 (16:24 -0700)]
xalloc: new function xreallocarray

This effectively replaces xnmalloc, which perhaps should be deprecated.
The name xreallocarray should be easier to remember now that
reallocarray is a standard GNU function.
* lib/xalloc.h [GNULIB_XALLOC]: Do not include xalloc-oversized.h.
(xnmalloc, xnrealloc, x2nrealloc): Simplify by using xreallocarray.
* lib/xmalloc.c (xreallocarray): New function.
* modules/xalloc (Depends-on): Add reallocarray;
remove xalloc-oversized.

4 years agogroup-member: simplify via realloc-gnu
Paul Eggert [Sun, 18 Apr 2021 23:08:31 +0000 (16:08 -0700)]
group-member: simplify via realloc-gnu

* lib/group-member.c, modules/group-member:
Simplify similarly to backupfile.

4 years agobackupfile: simplify via realloc-gnu
Paul Eggert [Sun, 18 Apr 2021 23:05:30 +0000 (16:05 -0700)]
backupfile: simplify via realloc-gnu

* lib/backupfile.c: Do not include xalloc-oversized.h.
(numbered_backup): Simplify now that realloc will do the right
thing about ptrdiff_t overflow.
* modules/backupfile (Depends-on): Add realloc-gnu;
remove xalloc-oversized.

4 years agosafe-alloc: improve doc
Paul Eggert [Sun, 18 Apr 2021 22:38:36 +0000 (15:38 -0700)]
safe-alloc: improve doc

* doc/safe-alloc.texi: Clarify that reallocating an array appends
uninitialized storage.  Say ‘sizeof *p’ rather than ‘sizeof(*p)’
which would need a space before the paren to follow GNU style.

4 years agomalloc-gnu-tests, etc.: test ptrdiff_t overflow
Paul Eggert [Sun, 18 Apr 2021 22:29:54 +0000 (15:29 -0700)]
malloc-gnu-tests, etc.: test ptrdiff_t overflow

* modules/calloc-gnu-tests (Depends-on):
* modules/malloc-gnu-tests (Depends-on):
* modules/realloc-gnu-tests (Depends-on): Add stdint.
* tests/test-calloc-gnu.c (main):
* tests/test-malloc-gnu.c (main):,
* tests/test-realloc-gnu.c (main): Test for ptrdiff_t overflow.

4 years agomalloc-gnu, etc.: prefer AS_CASE to woolly AS_IF
Paul Eggert [Sun, 18 Apr 2021 18:31:02 +0000 (11:31 -0700)]
malloc-gnu, etc.: prefer AS_CASE to woolly AS_IF

* m4/calloc.m4 (_AC_FUNC_CALLOC_IF):
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF):
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Use AS_CASE.

4 years agomalloc-gnu, etc.: sync better with Autoconf
Paul Eggert [Sun, 18 Apr 2021 18:23:24 +0000 (11:23 -0700)]
malloc-gnu, etc.: sync better with Autoconf

* m4/calloc.m4 (_AC_FUNC_CALLOC_IF):
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF):
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF):
Avoid some unnecessary differences from Autoconf’s versions.
Separate our platforms into a different line so that it’s easier
to diff.  Use AS_IF in case the args use AC_REQUIRE.
However, don’t bother with omitting the first newline, as
omitting the newline is not Gnulib style and the difference
doesn’t seem to matter here.

4 years agolib/mini-gmp.c
Karl Berry [Sun, 18 Apr 2021 15:01:17 +0000 (08:01 -0700)]
lib/mini-gmp.c

4 years agomalloc-posix, realloc-posix, calloc-posix: Document affected platforms.
Bruno Haible [Sun, 18 Apr 2021 11:58:56 +0000 (13:58 +0200)]
malloc-posix, realloc-posix, calloc-posix: Document affected platforms.

* doc/posix-functions/malloc.texi: Re-add platforms list.
* doc/posix-functions/realloc.texi: Likewise.
* doc/posix-functions/calloc.texi: Likewise.

4 years agoMore systematic file naming.
Bruno Haible [Sun, 18 Apr 2021 11:26:43 +0000 (13:26 +0200)]
More systematic file naming.

* m4/ctype_h.m4: Renamed from m4/ctype.m4.
* m4/threads_h.m4: Renamed from m4/threads.m4.
* m4/uchar_h.m4: Renamed from m4/uchar.m4.

4 years agoAdd comments after 2021-04-11 change.
Bruno Haible [Sun, 18 Apr 2021 11:13:36 +0000 (13:13 +0200)]
Add comments after 2021-04-11 change.

* m4/*_h.m4: Add comments regarding *_REQUIRE_DEFAULTS and
*_MODULE_INDICATOR macros.

4 years agodoc: Update for FreeBSD 13.0/arm64.
Bruno Haible [Sun, 18 Apr 2021 10:37:25 +0000 (12:37 +0200)]
doc: Update for FreeBSD 13.0/arm64.

* doc/posix-headers/stdint.texi: Mention FreeBSD 13 bug.
* m4/stdint.m4: Update comment.

4 years agoxalloc: adjust to malloc ptrdiff_t change
Paul Eggert [Sun, 18 Apr 2021 01:48:38 +0000 (18:48 -0700)]
xalloc: adjust to malloc ptrdiff_t change

* lib/xmalloc.c (HAVE_GNU_CALLOC, HAVE_GNU_MALLOC, HAVE_GNU_REALLOC):
Remove.
(xmalloc, xrealloc, xcalloc): Simplify by assuming GNU behavior.
* modules/xalloc (Depends-on): Add calloc-gnu, malloc-gnu,
realloc-gnu.

4 years agomalloc, etc.: check for ptrdiff_t overflow
Paul Eggert [Sun, 18 Apr 2021 01:44:25 +0000 (18:44 -0700)]
malloc, etc.: check for ptrdiff_t overflow

In glibc 2.30 and later, malloc, realloc and calloc reject
attempts to create objects larger than PTRDIFF_MAX bytes.
This patch changes malloc-gnu etc. to support this behavior
on non-GNU hosts.  It also makes this change for malloc-posix etc.
since it’s a safety measure that ought to be in POSIX (perhaps
we can talk them into that...).

In writing this patch I found a complicated set of code that had
accumulated over the years, some written by yours truly.  I got
rid of the code I couldn’t see the need for nowadays.  Among other
things, the GNU realloc behavior is no longer incompatible with
the C standard, because in C17 the latter was relaxed to allow the
former.  If I went too far in cleaning up, the old stuff can be
resurrected.

This change is mostly for 32-bit platforms, since practical 64-bit
platforms cannot create objects larger than PTRDIFF_MAX bytes anyway.
* doc/posix-functions/calloc.texi:
* doc/posix-functions/malloc.texi:
* doc/posix-functions/realloc.texi:
Mention ptrdiff_t issues, and go into more detail about what
the gnu extension module does.
* doc/posix-functions/realloc.texi: Fix now-obsolete commentary
about C99 vs glibc, as C17 allows the glibc behavior and POSIX
will follow suit when it gets around to it.
* lib/calloc.c, lib/malloc.c, lib/realloc.c:
Simplify by always supplying a GNU-compatible version,
as that suffices for correctness and is good enough for performance.
Include xalloc-oversized.h, and use xalloc_oversized to
check for ptrdiff_t overflow.
(NEED_CALLOC_GNU, NEED_MALLOC_GNU, NEED_REALLOC_GNU): Remove.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF):
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF):
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF):
Don’t start with a newline.  Fix message to match behavior.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Don’t test for size_t overflow,
as the ptrdiff_t test is good enough.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU):
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU):
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU):
Do not define HAVE_CALLOC_GNU, HAVE_MALLOC_GNU, HAVE_REALLOC_GNU.
It’s not worth the aggravation of maintaining these, as they
are confusing (they don’t really mean GNU-compatible anyway).
Don’t bother testing for GNU behavior if we have already decided
to replace the function, since the replacement is always GNUish.
* m4/calloc.m4 (gl_FUNC_CALLOC_POSIX):
* m4/realloc.m4 (gl_FUNC_REALLOC_POSIX):
Defer to gl_FUNC_MALLOC_POSIX.
* m4/malloc.m4 (gl_FUNC_MALLOC_PTRDIFF, gl_CHECK_MALLOC_PTRDIFF):
New macros.
(gl_FUNC_MALLOC_POSIX): Use them to check for ptrdiff_t overflow.
* modules/calloc-gnu, modules/malloc-gnu, modules/realloc-gnu:
Remove no-longer-needed module indicators.
* modules/calloc-posix, modules/malloc-posix, modules/realloc-posix:
Depend on xalloc-oversized.
* modules/malloc-posix: Require gl_FUNC_MALLOC_POSIX instead of
calling it directly, so that other code can require it.
* modules/realloc-posix: Depend on free-posix and malloc-posix.

4 years agostdio: Fix build error in some configurations (regression 2021-04-11).
Bruno Haible [Sat, 17 Apr 2021 15:17:06 +0000 (17:17 +0200)]
stdio: Fix build error in some configurations (regression 2021-04-11).

* m4/stdio_h.m4 (gl_STDIO_H): Move gl_STDIO_MODULE_INDICATOR and
gl_MODULE_INDICATOR invocations from here...
* modules/stdio (configure.ac): ... to here.

4 years agodoc: Update for FreeBSD 11.0, 12.0, 13.0.
Bruno Haible [Sat, 17 Apr 2021 13:29:16 +0000 (15:29 +0200)]
doc: Update for FreeBSD 11.0, 12.0, 13.0.

* doc/posix-headers/*.texi: Update.
* doc/glibc-headers/*.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/pastposix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Update cross-compilation guess.

4 years agomalloc, realloc: fix recently-introduced #undef typos
Paul Eggert [Sat, 17 Apr 2021 00:06:21 +0000 (17:06 -0700)]
malloc, realloc: fix recently-introduced #undef typos

* lib/malloc.c (malloc):
* lib/realloc.c (malloc, realloc): #undef before using.

4 years agohamt tests: Fix link error.
Bruno Haible [Thu, 15 Apr 2021 00:19:24 +0000 (02:19 +0200)]
hamt tests: Fix link error.

* modules/hamt-tests (Makefile.am): Link test-hamt against @LIBINTL@.

4 years agoc-stack: Don't use an undefined C macro (regression from 2020-10-04).
Bruno Haible [Thu, 15 Apr 2021 00:11:51 +0000 (02:11 +0200)]
c-stack: Don't use an undefined C macro (regression from 2020-10-04).

* lib/c-stack.c: Test GNU C version directly, without __GNUC_PREREQ.

4 years agodoc: Fix confusion between LIBADD and LDADD.
Bruno Haible [Mon, 12 Apr 2021 19:09:22 +0000 (21:09 +0200)]
doc: Fix confusion between LIBADD and LDADD.

Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00102.html>.

* doc/gnulib-tool.texi (Multiple instances): For programs, use LDADD,
not LIBADD.

4 years agomalloc, realloc, calloc: Support restricted library symbols on AIX.
Bruno Haible [Sun, 11 Apr 2021 20:00:25 +0000 (22:00 +0200)]
malloc, realloc, calloc: Support restricted library symbols on AIX.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00119.html>.

* lib/malloc.c: Drop the code that intends to collaborate with
AC_FUNC_MALLOC.
* lib/realloc.c: Drop the code that intends to collaborate with
AC_FUNC_REALLOC.
* lib/calloc.c: Drop the code that intends to collaborate with the
nonexistent macro AC_FUNC_CALLOC.

4 years agoSupport several gnulib-tool invocations under the same configure.ac.
Bruno Haible [Sun, 11 Apr 2021 19:25:54 +0000 (21:25 +0200)]
Support several gnulib-tool invocations under the same configure.ac.

Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00104.html>.

This is done by defining the Gnulib module indicator variables per
gnulib-tool invocation. So that a generated .h file is no longer
influenced by the set of modules used in other gnulib-tool invocations.

* gnulib-tool (func_compute_include_guard_prefix): Set
module_indicator_prefix.
(func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): Use it to
modify $(GNULIB_*) variable references in the Automake snippets.
(func_emit_initmacro_start): Push macro definitions for GL_MACRO_PREFIX
and GL_MODULE_INDICATOR_PREFIX.
(func_emit_initmacro_end): Pop these macro definitions.
* pygnulib/GLConfig.py (GLConfig.getIncludeGuardPrefix): New method.
* pygnulib/GLEmiter.py (GLEmiter.initmacro_start): Push macro
definitions for GL_MACRO_PREFIX and GL_MODULE_INDICATOR_PREFIX.
(GLEmiter.initmacro_end): Pop these macro definitions.
(GLEmiter.lib_Makefile_am, GLEmiter.tests_Makefile_am): Use the module
indicator prefix to modify $(GNULIB_*) variable references in the
Automake snippets.
* m4/gnulib-common.m4 (gl_MODULE_INDICATOR_INIT_VARIABLE,
gl_MODULE_INDICATOR_SET_VARIABLE): Use the value of
GL_MODULE_INDICATOR_PREFIX.
* m4/arpa_inet_h.m4: Use new idiom for header files that contain
references to Gnulib module indicator variables:
- Define the main macro through AC_DEFUN_ONCE.
- Define a macro gl_*_H_REQUIRE_DEFAULTS that initializes the Gnulib
  module indicator variables (each prefixed with
  GL_MODULE_INDICATOR_PREFIX).
- Invoke this macro in the gl_*_MODULE_INDICATOR macro.
* m4/ctype.m4: Likewise.
* m4/dirent_h.m4: Likewise.
* m4/fcntl_h.m4: Likewise.
* m4/fnmatch_h.m4: Likewise.
* m4/glob_h.m4: Likewise.
* m4/iconv_h.m4: Likewise.
* m4/inttypes.m4: Likewise.
* m4/langinfo_h.m4: Likewise.
* m4/locale_h.m4: Likewise.
* m4/malloc_h.m4: Likewise.
* m4/math_h.m4: Likewise.
* m4/monetary_h.m4: Likewise.
* m4/netdb_h.m4: Likewise.
* m4/poll_h.m4: Likewise.
* m4/pthread_h.m4: Likewise.
* m4/pty_h.m4: Likewise.
* m4/sched_h.m4: Likewise.
* m4/search_h.m4: Likewise.
* m4/signal_h.m4: Likewise.
* m4/spawn_h.m4: Likewise.
* m4/stddef_h.m4: Likewise.
* m4/stdio_h.m4: Likewise.
* m4/stdlib_h.m4: Likewise.
* m4/string_h.m4: Likewise.
* m4/strings_h.m4: Likewise.
* m4/sys_file_h.m4: Likewise.
* m4/sys_ioctl_h.m4: Likewise.
* m4/sys_random_h.m4: Likewise.
* m4/sys_resource_h.m4: Likewise.
* m4/sys_select_h.m4: Likewise.
* m4/sys_socket_h.m4: Likewise.
* m4/sys_stat_h.m4: Likewise.
* m4/sys_time_h.m4: Likewise.
* m4/sys_times_h.m4: Likewise.
* m4/sys_types_h.m4: Likewise.
* m4/sys_uio_h.m4: Likewise.
* m4/sys_utsname_h.m4: Likewise.
* m4/sys_wait_h.m4: Likewise.
* m4/termios_h.m4: Likewise.
* m4/threads.m4: Likewise.
* m4/time_h.m4: Likewise.
* m4/uchar.m4: Likewise.
* m4/unistd_h.m4: Likewise.
* m4/utime_h.m4: Likewise.
* m4/wchar_h.m4: Likewise.
* m4/wctype_h.m4: Likewise.
* modules/arpa_inet (configure.ac): Invoke the macro
gl_*_H_REQUIRE_DEFAULTS explicitly.
* modules/ctype (configure.ac): Likewise.
* modules/dirent (configure.ac): Likewise.
* modules/fcntl-h (configure.ac): Likewise.
* modules/fnmatch-h (configure.ac): Likewise.
* modules/glob-h (configure.ac): Likewise.
* modules/iconv-h (configure.ac): Likewise.
* modules/inttypes-incomplete (configure.ac): Likewise.
* modules/langinfo (configure.ac): Likewise.
* modules/locale (configure.ac): Likewise.
* modules/malloc-h (configure.ac): Likewise.
* modules/math (configure.ac): Likewise.
* modules/monetary (configure.ac): Likewise.
* modules/netdb (configure.ac): Likewise.
* modules/poll-h (configure.ac): Likewise.
* modules/pthread-h (configure.ac): Likewise.
* modules/pty (configure.ac): Likewise.
* modules/sched (configure.ac): Likewise.
* modules/search (configure.ac): Likewise.
* modules/signal-h (configure.ac): Likewise.
* modules/spawn (configure.ac): Likewise.
* modules/stddef (configure.ac): Likewise.
* modules/stdio (configure.ac): Likewise.
* modules/stdlib (configure.ac): Likewise.
* modules/string (configure.ac): Likewise.
* modules/strings (configure.ac): Likewise.
* modules/sys_file (configure.ac): Likewise.
* modules/sys_ioctl (configure.ac): Likewise.
* modules/sys_random (configure.ac): Likewise.
* modules/sys_resource (configure.ac): Likewise.
* modules/sys_select (configure.ac): Likewise.
* modules/sys_socket (configure.ac): Likewise.
* modules/sys_stat (configure.ac): Likewise.
* modules/sys_time (configure.ac): Likewise.
* modules/sys_times (configure.ac): Likewise.
* modules/sys_types (configure.ac): Likewise.
* modules/sys_uio (configure.ac): Likewise.
* modules/sys_utsname (configure.ac): Likewise.
* modules/sys_wait (configure.ac): Likewise.
* modules/termios (configure.ac): Likewise.
* modules/threads-h (configure.ac): Likewise.
* modules/time (configure.ac): Likewise.
* modules/uchar (configure.ac): Likewise.
* modules/unistd (configure.ac): Likewise.
* modules/utime-h (configure.ac): Likewise.
* modules/wchar (configure.ac): Likewise.
* modules/wctype-h (configure.ac): Likewise.
* m4/af_alg.m4: Update after a macro name changed.
* m4/ctime.m4: Likewise.
* m4/explicit_bzero.m4: Likewise.
* m4/ffs.m4: Likewise.
* m4/ffsl.m4: Likewise.
* m4/ffsll.m4: Likewise.
* m4/flock.m4: Likewise.
* m4/fstat.m4: Likewise.
* m4/getaddrinfo.m4: Likewise.
* m4/getdomainname.m4: Likewise.
* m4/gettimeofday.m4: Likewise.
* m4/hostent.m4: Likewise.
* m4/ioctl.m4: Likewise.
* m4/localtime.m4: Likewise.
* m4/mbslen.m4: Likewise.
* m4/memchr.m4: Likewise.
* m4/memmem.m4: Likewise.
* m4/mempcpy.m4: Likewise.
* m4/memrchr.m4: Likewise.
* m4/mktime.m4: Likewise.
* m4/nanosleep.m4: Likewise.
* m4/passfd.m4: Likewise.
* m4/pselect.m4: Likewise.
* m4/rawmemchr.m4: Likewise.
* m4/select.m4: Likewise.
* m4/servent.m4: Likewise.
* m4/sigabbrev_np.m4: Likewise.
* m4/sigdescr_np.m4: Likewise.
* m4/sockpfaf.m4: Likewise.
* m4/stat.m4: Likewise.
* m4/stpcpy.m4: Likewise.
* m4/stpncpy.m4: Likewise.
* m4/strcase.m4: Likewise.
* m4/strcasestr.m4: Likewise.
* m4/strchrnul.m4: Likewise.
* m4/strdup.m4: Likewise.
* m4/strerror.m4: Likewise.
* m4/strerror_r.m4: Likewise.
* m4/strerrorname_np.m4: Likewise.
* m4/strftime-fixes.m4: Likewise.
* m4/strncat.m4: Likewise.
* m4/strndup.m4: Likewise.
* m4/strnlen.m4: Likewise.
* m4/strpbrk.m4: Likewise.
* m4/strptime.m4: Likewise.
* m4/strsep.m4: Likewise.
* m4/strsignal.m4: Likewise.
* m4/strstr.m4: Likewise.
* m4/strtok_r.m4: Likewise.
* m4/strverscmp.m4: Likewise.
* m4/time_r.m4: Likewise.
* m4/time_rz.m4: Likewise.
* m4/timegm.m4: Likewise.
* m4/timespec_get.m4: Likewise.
* m4/tzset.m4: Likewise.
* modules/accept (configure.ac): Likewise.
* modules/bind (configure.ac): Likewise.
* modules/connect (configure.ac): Likewise.
* modules/flock (configure.ac): Likewise.
* modules/getpeername (configure.ac): Likewise.
* modules/getsockname (configure.ac): Likewise.
* modules/getsockopt (configure.ac): Likewise.
* modules/listen (configure.ac): Likewise.
* modules/recv (configure.ac): Likewise.
* modules/recvfrom (configure.ac): Likewise.
* modules/send (configure.ac): Likewise.
* modules/sendto (configure.ac): Likewise.
* modules/setsockopt (configure.ac): Likewise.
* modules/shutdown (configure.ac): Likewise.
* modules/socket (configure.ac): Likewise. Use the
gl_*_H_REQUIRE_DEFAULTS macros.
* modules/nonblocking (configure.ac): Use the gl_*_H_REQUIRE_DEFAULTS
and gl_MODULE_INDICATOR_INIT_VARIABLE macros.
* modules/sigpipe (configure.ac): Likewise.
* modules/windows-stat-override (configure.ac): Likewise.
* m4/nonblocking.m4: Update a comment.
* m4/sigpipe.m4: Likewise.

4 years agoRename GNULIB_OVERRIDES_CHAR16_T, GNULIB_OVERRIDES_CHAR32_T.
Bruno Haible [Sun, 11 Apr 2021 13:54:18 +0000 (15:54 +0200)]
Rename GNULIB_OVERRIDES_CHAR16_T, GNULIB_OVERRIDES_CHAR32_T.

* GNULIBHEADERS_OVERRIDE_CHAR16_T: Renamed from
GNULIB_OVERRIDES_CHAR16_T.
* GNULIBHEADERS_OVERRIDE_CHAR32_T: Renamed from
GNULIB_OVERRIDES_CHAR32_T.

4 years agoRename GNULIB_OVERRIDES_WINT_T.
Bruno Haible [Sun, 11 Apr 2021 13:50:35 +0000 (15:50 +0200)]
Rename GNULIB_OVERRIDES_WINT_T.

* GNULIBHEADERS_OVERRIDE_WINT_T: Renamed from GNULIB_OVERRIDES_WINT_T.

4 years agoincrement-serial: New program.
Bruno Haible [Sun, 11 Apr 2021 12:38:37 +0000 (14:38 +0200)]
increment-serial: New program.

* build-aux/increment-serial: New file.

4 years agouseless-if-before-free: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:30:03 +0000 (14:30 +0200)]
useless-if-before-free: Implement --version option according to GCS.

* build-aux/useless-if-before-free (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.

4 years agolibtool-next-version: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:28:00 +0000 (14:28 +0200)]
libtool-next-version: Implement --version option according to GCS.

* build-aux/libtool-next-version (scriptversion): New variable.
(func_version): Deduce the copyright year from it. Terminate sentences
with '.'.

4 years agognupload: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:25:56 +0000 (14:25 +0200)]
gnupload: Implement --version option according to GCS.

* build-aux/gnupload (copyright_year, copyright): New variables.
(--version): Print also a short copyright and license notice.

4 years agogit-version-gen: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:22:07 +0000 (14:22 +0200)]
git-version-gen: Implement --version option according to GCS.

* build-aux/git-version-gen (version): State the license. Use wording
from GCS.

4 years agobootstrap: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:20:08 +0000 (14:20 +0200)]
bootstrap: Implement --version option according to GCS.

* build-aux/bootstrap (copyright_year, copyright): New variables.
(--version): New option processing.

4 years agoannounce-gen: Implement --version option according to GCS.
Bruno Haible [Sun, 11 Apr 2021 12:17:13 +0000 (14:17 +0200)]
announce-gen: Implement --version option according to GCS.

* build-aux/announce-gen (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.

4 years agoSimplify GNULIB_* variable initializations.
Bruno Haible [Sun, 11 Apr 2021 00:38:27 +0000 (02:38 +0200)]
Simplify GNULIB_* variable initializations.

* modules/gnulib-common.m4 (gl_MODULE_INDICATOR_INIT_VARIABLE): New
macro.
* m4/arpa_inet_h.m4 (gl_ARPA_INET_H_DEFAULTS): Use it.
* m4/ctype.m4 (gl_CTYPE_H_DEFAULTS): Likewise.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Likewise.
* m4/fnmatch_h.m4 (gl_FNMATCH_H_DEFAULTS): Likewise.
* m4/glob_h.m4 (gl_GLOB_H_DEFAULTS): Likewise.
* m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Likewise.
* m4/langinfo_h.m4 (gl_LANGINFO_H_DEFAULTS): Likewise.
* m4/locale_h.m4 (gl_LOCALE_H_DEFAULTS): Likewise.
* m4/malloc_h.m4 (gl_MALLOC_H_DEFAULTS): Likewise.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Likewise.
* m4/monetary_h.m4 (gl_MONETARY_H_DEFAULTS): Likewise.
* m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Likewise.
* m4/poll_h.m4 (gl_POLL_H_DEFAULTS): Likewise.
* m4/pthread_h.m4 (gl_PTHREAD_H_DEFAULTS): Likewise.
* m4/pty_h.m4 (gl_PTY_H_DEFAULTS): Likewise.
* m4/sched_h.m4 (gl_SCHED_H_DEFAULTS): Likewise.
* m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Likewise.
* m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Likewise.
* m4/spawn_h.m4 (gl_SPAWN_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/strings_h.m4 (gl_HEADER_STRINGS_H_DEFAULTS): Likewise.
* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H_DEFAULTS): Likewise.
* m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Likewise.
* m4/sys_resource_h.m4 (gl_SYS_RESOURCE_H_DEFAULTS): Likewise.
* m4/sys_select_h.m4 (gl_SYS_SELECT_H_DEFAULTS): Likewise.
* m4/sys_socket_h.m4 (gl_SYS_SOCKET_H_DEFAULTS): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Likewise.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_DEFAULTS): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H_DEFAULTS): Likewise.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H_DEFAULTS): Likewise.
* m4/sys_wait_h.m4 (gl_SYS_WAIT_H_DEFAULTS): Likewise.
* m4/termios_h.m4 (gl_TERMIOS_H_DEFAULTS): Likewise.
* m4/threads.m4 (gl_THREADS_H_DEFAULTS): Likewise.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Likewise.
* m4/uchar.m4 (gl_UCHAR_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.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Likewise.

4 years agoBlame GCC, not Coverity, in utimens ChangeLog entry.
Paul Eggert [Sat, 10 Apr 2021 20:39:33 +0000 (13:39 -0700)]
Blame GCC, not Coverity, in utimens ChangeLog entry.

4 years agorealloc: fix undef typo
Paul Eggert [Sat, 10 Apr 2021 20:38:50 +0000 (13:38 -0700)]
realloc: fix undef typo

* lib/realloc.c: #undef realloc if config.h defines it.
This fixes a typo that I introduced in
2011-04-08T18:39:01Z!eggert@cs.ucla.edu.
Apparently nobody uses Gnulib realloc in that way?

4 years agoutimens: fix confusing arg type in internal func
Paul Eggert [Thu, 8 Apr 2021 00:29:59 +0000 (17:29 -0700)]
utimens: fix confusing arg type in internal func

Although the old code was technically correct, this was accidental
and it understandably confused Coverity.  Reported by Ondrej Dubaj in:
https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html
* lib/utimens.c (update_timespec): Change arg type from ‘struct
timespec *[2]’ (pointer to array of 2 pointers to timespecs) to
‘struct timespec **’ (pointer to pointer to the first timespec in
an array of 2 timespecs).  Although the old code happened to be
technically correct, it was misleading and confused Coverity.
And though the type ‘struct timespec (**)[2]’ (pointer to pointer
to array of 2 timespecs) would perhaps be more technically
correct, it would be almost as confusing and would require changes
elsewhere in this file; let’s quit while we’re ahead.

4 years agoexecute tests: Avoid test failure in certain environments.
Bruno Haible [Wed, 7 Apr 2021 23:37:05 +0000 (01:37 +0200)]
execute tests: Avoid test failure in certain environments.

Reported by Dmitry V. Levin <ldv@altlinux.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00082.html>.

* tests/test-execute-main.c (main): Close file descriptors 3..19.
* tests/test-execute-child.c (main): Remove NetBSD workaround.
* modules/execute-tests (configure.ac): Test for close_range function.

4 years ago* lib/xalloc.h: Fix previous commit by adding missing include.
Paul Eggert [Wed, 7 Apr 2021 17:58:40 +0000 (10:58 -0700)]
* lib/xalloc.h: Fix previous commit by adding missing include.

4 years agoxalloc: simplify integer overflow test
Paul Eggert [Wed, 7 Apr 2021 17:28:20 +0000 (10:28 -0700)]
xalloc: simplify integer overflow test

* lib/xalloc.h (x2nrealloc): Simplify integer overflow detection.
This is easier to maintain, and (unlike the old code) exact.

4 years agogroup-member: minor tweak to omit a *
Paul Eggert [Wed, 7 Apr 2021 00:45:33 +0000 (17:45 -0700)]
group-member: minor tweak to omit a *

* lib/group-member.c: Include intprops.h.
(get_group_info): Use INT_MULTIPLY_WRAPV instead of
xalloc_oversized (which does a multiplication) followed by the
same multiplication.  The code was OK as-is; this is just
conceptual simplification, possible now that we have xalloc_count_t.
* modules/group-member: Depend on intprops.

4 years agobackupfile: less-aggressive buffer growth
Paul Eggert [Wed, 7 Apr 2021 00:39:31 +0000 (17:39 -0700)]
backupfile: less-aggressive buffer growth

* lib/backupfile.c: Include intprops.h.
(numbered_backup): Grow buffer by the usual 50%, not 100%.
This is easier to do now that we have xalloc_count_t.
* modules/backup-rename, modules/backupfile: Depend on intprops.

4 years agoxalloc-oversized: export xalloc_count_t
Paul Eggert [Wed, 7 Apr 2021 00:34:56 +0000 (17:34 -0700)]
xalloc-oversized: export xalloc_count_t

* lib/xalloc-oversized.h (__xalloc_oversized, xalloc_oversized):
* lib/xmalloca.h (nmalloca):
Comment re restrictions on arg types.
* lib/xalloc-oversized.h (xalloc_count_t): Rename from
__xalloc_count_type; all uses changed.  This publicizes the type.

4 years agoxalloc: try to pacify gcc -Wsign-compare
Paul Eggert [Tue, 6 Apr 2021 03:08:27 +0000 (20:08 -0700)]
xalloc: try to pacify gcc -Wsign-compare

Problem reported by Marc Nieper-Wißkirchen in:
https://lists.gnu.org/r/bug-gnulib/2021-04/msg00034.html
* lib/xmalloc.c (xpalloc): For odd platforms where SIZE_MAX < IDX_MAX,
use a tricky destination for INT_MULTIPLY_WRAPV instead of an
explicit comparison to SIZE_MAX.  This should be more likely to
pacify gcc -Wsign-compare.

4 years agohamt: Fix coding errors.
Marc Nieper-Wißkirchen [Mon, 5 Apr 2021 13:24:32 +0000 (15:24 +0200)]
hamt: Fix coding errors.

Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00047.html>
after a Coverity run.
* lib/hamt.c (bucket_do_while, hamt_iterator): Add missing
derefencing operator and silence a bogus warning on uninitialized
variables.
* tests/test-hamt.c (test_general): Replace two errorneous
assignment operators with comparison operators.

4 years agopthread-cond: Fix compilation error.
Fabrice Fontaine [Mon, 5 Apr 2021 10:44:41 +0000 (12:44 +0200)]
pthread-cond: Fix compilation error.

* lib/pthread-cond.c (pthread_cond_wait): Use tv.nsec instead of
tv.usec.

4 years agopthread-cond: Fix wrong configure results when <pthread.h> is absent.
Fabrice Fontaine [Sun, 4 Apr 2021 23:13:29 +0000 (01:13 +0200)]
pthread-cond: Fix wrong configure results when <pthread.h> is absent.

* m4/pthread-cond.m4 (gl_PTHREAD_COND): When <pthread.h> does not exist,
set HAVE_PTHREAD_COND_* to 0, not to 1.

4 years agobackupfile, backup-rename: Trim dependencies.
Bruno Haible [Sun, 4 Apr 2021 12:54:33 +0000 (14:54 +0200)]
backupfile, backup-rename: Trim dependencies.

* lib/backupfile.h: Add comment.
* lib/backupfile.c: Include <dirent.h>, for readdir() declaration.
* modules/backup-rename (Depends-on): Remove dirent-safer, fcntl. Add
fcntl-h.
* modules/backupfile (Depends-on): Likewise. Remove xalloc. Add
xalloc-die.

4 years agodoc: Fix syntax error (regression from 2021-04-02).
Bruno Haible [Sun, 4 Apr 2021 10:14:59 +0000 (12:14 +0200)]
doc: Fix syntax error (regression from 2021-04-02).

* doc/posix-functions/strtol.texi: Put @item inside @itemize block.

4 years agohamt: Document the module in the Gnulib manual.
Marc Nieper-Wißkirchen [Sun, 4 Apr 2021 08:35:42 +0000 (10:35 +0200)]
hamt: Document the module in the Gnulib manual.

Suggested by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00026.html>.
* doc/containers.texi: Add a subsection to section 15.11 Container
data types.
* lib/hamt.h: Improve documentation on how Hamt_entry is supposed
to be used.

4 years agosavedir: avoid unlikely undefined behavior
Paul Eggert [Sun, 4 Apr 2021 03:14:36 +0000 (20:14 -0700)]
savedir: avoid unlikely undefined behavior

* lib/savedir.c (streamsavedir): Prefer idx_to size_t where
either will do.  Simplify reallocation of entries.
Use xpalloc to reallocate name_space, to avoid some unlikely
integer overflows.

4 years agoquotearg: avoid undefined and/or O(N**2)
Paul Eggert [Sun, 4 Apr 2021 02:59:10 +0000 (19:59 -0700)]
quotearg: avoid undefined and/or O(N**2)

Avoid undefined and O(N**2) behavior in some very unlikely cases.
* lib/quotearg.c (quotearg_n_options): Document that N must
be less than MIN (INT_MAX, IDX_MAX), and add this to the
abort test; this also avoids a conditional branch.
Use xpalloc instead of xrealloc, to avoid O(N**2) behavior in
very-unlikely cases.

4 years agoxgethostname: reorganize / simplify
Paul Eggert [Sat, 3 Apr 2021 23:07:21 +0000 (16:07 -0700)]
xgethostname: reorganize / simplify

xgethostname and xgetdomainname were essentially copies long
ago, but they’ve diverged.  Bring them back together again
by implementing the (rarely used) latter in terms of the former.
And avoid some unnecessary realloc calls while we’re at it.
* lib/xgetdomainname.c: Rewrite from scratch so that it merely
includes xgethostname.c with a few preliminaries.
* lib/xgethostname.c: Generalize so that it can be included
from xgetdomainname.c.
(GETANAME, XGETANAME): New macros.
(INITIAL_HOSTNAME_LENGTH): Remove.  No need for this parameter.
Use 100 instead, as few hostnames are longer than that.
(XGETANAME): Try getting the hostname into the stack first,
as that avoids a malloc call in the usual case.
Check for both POSIX-style truncation and SunOS 5.5 bug
in a cleaner way, by simply checking string length.
Don’t use x2realloc, which wastes time preserving buffer garbage;
use xpalloc with NULL instead.  Don’t bother shrinking buffer
in the very rare case where the hostname is longer than sizeof
buf; it’s not worth the aggravation.
* modules/xgetdomainname (Depends-on): Remove free-posix, xalloc.
Add xgethostname.

4 years ago*-list tests: Add more tests.
Bruno Haible [Sat, 3 Apr 2021 16:25:56 +0000 (18:25 +0200)]
*-list tests: Add more tests.

* tests/test-array_list.c (check_equals_by_forward_iteration,
check_equals_by_backward_iteration): New functions.
(main): Invoke them.
* tests/test-carray_list.c: Likewise.
* tests/test-linked_list.c: Likewise.
* tests/test-linkedhash_list.c: Likewise.
* tests/test-avltree_list.c: Likewise.
* tests/test-avltreehash_list.c: Likewise.
* tests/test-rbtree_list.c: Likewise.
* tests/test-rbtreehash_list.c: Likewise.

4 years agolist: Add operations first_node, last_node.
Bruno Haible [Sat, 3 Apr 2021 15:59:47 +0000 (17:59 +0200)]
list: Add operations first_node, last_node.

Reported by Marc Nieper-Wißkirchen in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00005.html>.

* lib/gl_list.h (gl_list_first_node, gl_list_last_node): New functions.
(struct gl_list_implementation): Add members first_node, last_node.
* lib/gl_array_list.c (gl_array_first_node, gl_array_last_node): New
functions.
(gl_array_list_implementation): Add the new operations.
* lib/gl_carray_list.c (gl_carray_first_node, gl_carray_last_node): New
functions.
(gl_carray_list_implementation): Add the new operations.
* lib/gl_anylinked_list2.h (gl_linked_first_node, gl_linked_last_node):
New functions.
* lib/gl_linked_list.c (gl_linked_list_implementation): Add the new
operations.
* lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation):
Likewise.
* lib/gl_anytree_list2.h (gl_tree_first_node, gl_tree_last_node): New
functions.
* lib/gl_avltree_list.c (gl_avltree_list_implementation): Add the new
operations.
* lib/gl_avltreehash_list.c (gl_avltreehash_list_implementation):
Likewise.
* lib/gl_rbtree_list.c (gl_rbtree_list_implementation): Likewise.
* lib/gl_rbtreehash_list.c (gl_rbtreehash_list_implementation):
Likewise.
* lib/gl_sublist.c (gl_sublist_first_node, gl_sublist_last_node): New
functions.
(gl_sublist_list_implementation): Add the new operations.
* lib/gl_list.hh (class gl_List): Add member functions first_node,
last_node.
* doc/containers.texi: Update table.

4 years agoxalloc-die: Fix compilation error (regression from 2021-03-28).
Bruno Haible [Sat, 3 Apr 2021 15:41:18 +0000 (17:41 +0200)]
xalloc-die: Fix compilation error (regression from 2021-03-28).

* lib/xalloc.h: Don't include idx.h and xalloc-oversized.h if the module
'xalloc' is not in use.
* modules/xalloc-die (Depends-on): Remove xalloc-oversized.

4 years agohamt: New module.
Marc Nieper-Wißkirchen [Sat, 3 Apr 2021 09:23:00 +0000 (11:23 +0200)]
hamt: New module.

This module provides (persistent) hash array mapped tries.
* MODULES.html.sh: Add hamt.
* lib/hamt.c: New file.
* lib/hamt.h: New file.
* modules/hamt: New file.
* modules/hamt-tests: New file.
* tests/test-hamt.c: New file.

4 years agostrtoul, strtoll, strtoull: Fix compilation warning.
Bruno Haible [Fri, 2 Apr 2021 18:56:28 +0000 (20:56 +0200)]
strtoul, strtoll, strtoull: Fix compilation warning.

* lib/strtol.c (strtol): Undefine before defining as a macro.

4 years agostrtoll: Work around a bug on native Windows and Minix.
Bruno Haible [Fri, 2 Apr 2021 18:46:15 +0000 (20:46 +0200)]
strtoll: Work around a bug on native Windows and Minix.

* lib/stdlib.in.h (strtoll): Override if REPLACE_STRTOLL is 1.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_STRTOLL.
* m4/strtoll.m4 (gl_FUNC_STRTOLL): Test whether strtoll works. Set
REPLACE_STRTOLL.
* modules/stdlib (Makefile.am): Substitute REPLACE_STRTOLL.
* modules/strtoll (configure.ac): Test REPLACE_STRTOLL.
* tests/test-strtoll.c (main): Add tests of hexadecimal integer syntax.
* doc/posix-functions/strtoll.texi: Mention the bug.

4 years agostrtol: Work around a bug on native Windows and Minix.
Bruno Haible [Fri, 2 Apr 2021 18:42:13 +0000 (20:42 +0200)]
strtol: Work around a bug on native Windows and Minix.

* lib/stdlib.in.h (strtol): New declaration.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtol is declared.
(gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOL, HAVE_STRTOL,
REPLACE_STRTOL.
* m4/strtol.m4 (gl_FUNC_STRTOL): Require gl_STDLIB_H_DEFAULTS. Test
whether strtol works. Set REPLACE_STRTOL.
* modules/stdlib (Makefile.am): Substitute GNULIB_STRTOL, HAVE_STRTOL,
REPLACE_STRTOL.
* modules/strtol (Status, Notice): Remove.
(Depends-on): Add stdlib.
(configure.ac): Test HAVE_STRTOL and REPLACE_STRTOL. Invoke
gl_STDLIB_MODULE_INDICATOR.
* tests/test-strtol.c (main): Add tests of hexadecimal integer syntax.
* doc/posix-functions/strtol.texi: Mention the bug.

4 years agostrtoull: Work around a bug on native Windows and Minix.
Bruno Haible [Fri, 2 Apr 2021 18:14:28 +0000 (20:14 +0200)]
strtoull: Work around a bug on native Windows and Minix.

* lib/stdlib.in.h (strtoull): Override if REPLACE_STRTOULL is 1.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_STRTOULL.
* m4/strtoull.m4 (gl_FUNC_STRTOULL): Test whether strtoull works. Set
REPLACE_STRTOULL.
* modules/stdlib (Makefile.am): Substitute REPLACE_STRTOULL.
* modules/strtoull (configure.ac): Test REPLACE_STRTOULL.
* tests/test-strtoull.c (main): Add tests of hexadecimal integer syntax.
* doc/posix-functions/strtoull.texi: Mention the bug.

4 years agostrtoul: Work around a bug on native Windows and Minix.
Bruno Haible [Fri, 2 Apr 2021 17:56:28 +0000 (19:56 +0200)]
strtoul: Work around a bug on native Windows and Minix.

Reported by Eric Blake <eblake@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00082.html>.

* lib/stdlib.in.h (strtoul): New declaration.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtoul is declared.
(gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOUL, HAVE_STRTOUL,
REPLACE_STRTOUL.
* m4/strtoul.m4 (gl_FUNC_STRTOUL): Require gl_STDLIB_H_DEFAULTS. Test
whether strtoul works. Set REPLACE_STRTOUL.
* modules/stdlib (Makefile.am): Substitute GNULIB_STRTOUL, HAVE_STRTOUL,
REPLACE_STRTOUL.
* modules/strtoul (Status, Notice): Remove.
(Depends-on): Add stdlib.
(configure.ac): Test HAVE_STRTOUL and REPLACE_STRTOUL. Invoke
gl_STDLIB_MODULE_INDICATOR.
* tests/test-strtoul.c (main): Add tests of hexadecimal integer syntax.
* doc/posix-functions/strtoul.texi: Mention the bug.

4 years agostrtol, strtoul, strtoll, strtoull: Optimize.
Bruno Haible [Fri, 2 Apr 2021 17:50:19 +0000 (19:50 +0200)]
strtol, strtoul, strtoll, strtoull: Optimize.

* lib/strtol.c (GROUP_PARAM_PROTO): New macro.
(INTERNAL): Define differently if !USE_NUMBER_GROUPING.
(INTERNAL (strtol)): Define without 'int group' parameter if
!USE_NUMBER_GROUPING.
(strtol): Don't define if !USE_NUMBER_GROUPING.

4 years agostrto*l: Don't pass invalid arguments to isspace, isalnum, toupper.
Bruno Haible [Fri, 2 Apr 2021 17:47:53 +0000 (19:47 +0200)]
strto*l: Don't pass invalid arguments to isspace, isalnum, toupper.

* lib/strtol.c (ISSPACE, ISALPHA, TOUPPER): Cast argument to
'unsigned char' before passing it to the functions isspace(), isalpha(),
toupper().

4 years agoglob: Reject ~user syntax, when flag GLOB_TILDE_CHECK is given.
Bruno Haible [Fri, 2 Apr 2021 15:34:46 +0000 (17:34 +0200)]
glob: Reject ~user syntax, when flag GLOB_TILDE_CHECK is given.

Reported and patch suggested by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00136.html>.

* lib/glob.c (__glob) [WINDOWS32]: If flag GLOB_TILDE_CHECK is given, do
error handling like when ~user is allowed by the user is unknown.

4 years agoxalloc: delay setting size until success
Paul Eggert [Thu, 1 Apr 2021 07:59:54 +0000 (00:59 -0700)]
xalloc: delay setting size until success

* lib/xalloc.h (x2nrealloc): Don’t change *PN until after xrealloc
succeeds, in case xalloc_die or one of its callees or longjmp
targets uses *PN.  Similar code in xpalloc already does this.

4 years agoxalloc: new function xpalloc, from dfa
Paul Eggert [Mon, 29 Mar 2021 03:02:21 +0000 (20:02 -0700)]
xalloc: new function xpalloc, from dfa

Move xpalloc from dfa.c to xmalloc.c and change it from static to
extern.  The function is useful in other contexts; I’m about to
use it in coreutils.
* lib/dfa.c: Include idx.h, instead of rolling our own idx_t and
IDX_MAX.  Do not include intprops.h; no longer needed.
(xpalloc): Move from here ...
* lib/xmalloc.c (xpalloc): ... to here, and make it extern.
Include intprops.h and minmax.h, needed by xpalloc.
* lib/xalloc.h: Include idx.h, for idx_t.
* modules/dfa (Depends-on): Add idx; remove intprops.
* modules/xalloc (Depends-on): Add idx, intprops, minmax.

4 years agolinked-list tests: Add another test for SIGNAL_SAFE_LIST.
Bruno Haible [Sun, 28 Mar 2021 18:10:43 +0000 (20:10 +0200)]
linked-list tests: Add another test for SIGNAL_SAFE_LIST.

* tests/test-asyncsafe-linked_list-strong.c: Renamed from
tests/test-asyncsafe-linked_list.c.
* tests/test-asyncsafe-linked_list-strong.sh: Renamed from
tests/test-asyncsafe-linked_list.sh.
* tests/test-asyncsafe-linked_list-weak.c: New file, based on
tests/test-asyncsafe-linked_list.c.
* tests/test-asyncsafe-linked_list-weak.sh: New file, based on
tests/test-asyncsafe-linked_list.sh.
* modules/linked-list-tests (Files): Add
tests/test-asyncsafe-linked_list-weak.*,
tests/test-asyncsafe-linked_list-strong.*.
(Makefile.am): Arrange to test also
tests/test-asyncsafe-linked_list-weak.sh. Mark
test-asyncsafe-linked_list-weak.sh and
test-asyncsafe-linked_list-strong.sh as expected failures.

4 years agorenameatu tests: Add unit test for bug found on macOS.
Bruno Haible [Sat, 27 Mar 2021 16:46:58 +0000 (17:46 +0100)]
renameatu tests: Add unit test for bug found on macOS.

* tests/test-renameatu.c (main): Add test for identical rename with
RENAME_NOREPLACE.

4 years agounistdio/*-vasnprintf: Fix errno value (regression from yesterday).
Bruno Haible [Sat, 27 Mar 2021 00:14:33 +0000 (01:14 +0100)]
unistdio/*-vasnprintf: Fix errno value (regression from yesterday).

* modules/unistdio/u8-vasnprintf (Depends-on): Add free-posix.
* modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u16-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u32-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise.
* modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.

4 years agovasnprintf: Fix memory leak (regression from yesterday).
Bruno Haible [Sat, 27 Mar 2021 00:12:07 +0000 (01:12 +0100)]
vasnprintf: Fix memory leak (regression from yesterday).

* lib/vasnprintf.c (VASNPRINTF): Restore omitted CLEANUP invocation.
Some more simplifications of errno around free().

4 years agofprintf-posix: fix typo
Akim Demaille [Fri, 26 Mar 2021 05:40:06 +0000 (06:40 +0100)]
fprintf-posix: fix typo

* modules/fprintf-posix (Depends-on): Fix typo.

4 years agofree-posix: use more often in other modules
Paul Eggert [Thu, 25 Mar 2021 19:41:41 +0000 (12:41 -0700)]
free-posix: use more often in other modules

This lets us simplify cleanup code that calls ‘free’.
* lib/amemxfrm.c (amemxfrm):
* lib/areadlink-with-size.c (areadlink_with_size):
* lib/areadlinkat-with-size.c (areadlinkat_with_size):
* lib/astrxfrm.c (astrxfrm):
* lib/dprintf.c (dprintf):
* lib/execute.c (execute):
* lib/execvpe.c (execvpe):
* lib/fchdir.c (get_name):
* lib/file-has-acl.c (file_has_acl):
* lib/fprintf.c (fprintf):
* lib/getcwd-lgpl.c (rpl_getcwd):
* lib/getgroups.c (rpl_getgroups):
* lib/link.c (link, rpl_link):
* lib/linkat.c (link_immediate, link_follow, linkat_follow):
* lib/localename.c (newlocale, duplocale):
* lib/mgetgroups.c (mgetgroups):
* lib/mountlist.c (read_file_system_list):
* lib/pipe-filter-gi.c (pipe_filter_gi_close):
* lib/putenv.c (_unsetenv, putenv):
* lib/read-file.c (read_file):
* lib/rename.c (rpl_rename):
* lib/savedir.c (streamsavedir, savedir):
* lib/spawni.c (do_open, __spawni):
* lib/spawn-pipe.c (create_pipe):
* lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv):
* lib/striconveh.c (mem_cd_iconveh_internal, str_cd_iconveh)
(mem_iconveh, str_iconveh):
* lib/supersede.c (open_supersede, close_supersede):
* lib/vasnprintf.c (VASNPRINTF):
* lib/vdprintf.c (vdprintf):
* lib/vfprintf.c (vfprintf):
* lib/wcscoll-impl.h (wcscoll):
* lib/wcsxfrm-impl.h (wcsxfrm):
* lib/xgetdomainname.c (xgetdomainname):
* lib/xgethostname.c (xgethostname):
Simplify by assuming that ‘free’ preserves errno.
* lib/localename.c: Do not include errno.h.
* modules/amemxfrm, modules/areadlink-with-size:
* modules/areadlinkat-with-size, modules/astrxfrm:
* modules/c-vasnprintf, modules/dprintf, modules/execute:
* modules/execvpe, modules/fchdir, modules/file-has-acl:
* modules/fprintf-posix, modules/getcwd-lgpl, modules/getgroups:
* modules/link, modules/linkat, modules/localename:
* modules/mgetgroups, modules/mountlist, modules/pipe-filter-gi:
* modules/posix_spawn-internal, modules/putenv, modules/read-file:
* modules/rename, modules/savedir, modules/spawn-pipe:
* modules/striconv, modules/striconveh, modules/supersede:
* modules/vasnprintf, modules/vdprintf, modules/vfprintf-posix:
* modules/wcscoll, modules/wcsxfrm, modules/xgetdomainname:
* modules/xgethostname:
Depend on free-posix.

4 years agorenameatu: work around macOS 11.2 renameatx_np bug
Paul Eggert [Thu, 25 Mar 2021 03:40:46 +0000 (20:40 -0700)]
renameatu: work around macOS 11.2 renameatx_np bug

* lib/renameatu.c (renameatu) [RENAME_EXCL]: Use lstatat test here too.

4 years agoclean-temp-simple: Fix a rare memory leak.
Bruno Haible [Tue, 23 Mar 2021 00:19:06 +0000 (01:19 +0100)]
clean-temp-simple: Fix a rare memory leak.

* lib/clean-temp-simple.c (register_temporary_file): Fix cleanup code.

4 years agoclean-temp-simple: Relicense under LGPLv2+.
Bruno Haible [Mon, 22 Mar 2021 23:16:15 +0000 (00:16 +0100)]
clean-temp-simple: Relicense under LGPLv2+.

* modules/clean-temp-simple (License): Change to LGPLv2+.

4 years agoclean-temp-simple: Remove dependency upon xalloc, xalloc-die, xlist.
Bruno Haible [Mon, 22 Mar 2021 23:08:38 +0000 (00:08 +0100)]
clean-temp-simple: Remove dependency upon xalloc, xalloc-die, xlist.

* lib/clean-temp-private.h (clean_temp_init): Change return type to
'int'.
* lib/clean-temp-simple.h (register_temporary_file): Change return type
to 'int'.
* lib/clean-temp-simple.c: Don't include xalloc.h, gl_xlist.h. Include
gl_list.h instead.
(init_failed): New variable.
(do_clean_temp_init): Set it.
(clean_temp_init): Return an error indicator.
(register_temporary_file): Invoke gl_list_nx_create_empty instead of
gl_list_create_empty. Invoke strdup instead of xstrdup. Invoke
gl_list_nx_add_first instead of gl_list_add_first. Return an error
indicator.
* lib/clean-temp.c (create_temp_dir, gen_register_open_temp): Call
xalloc_die() if clean_temp_init or register_temporary_file failed.
* modules/clean-temp-simple (Depends-on): Remove xalloc, xalloc-die,
xlist.

4 years agoclean-temp-simple: New module.
Bruno Haible [Mon, 22 Mar 2021 21:48:23 +0000 (22:48 +0100)]
clean-temp-simple: New module.

* lib/clean-temp-simple.h: New file, based on lib/clean-temp.h.
* lib/clean-temp-private.h: New file, based on lib/clean-temp.c.
* lib/clean-temp-simple.c: New file, based on lib/clean-temp.c.
* lib/clean-temp.h: Include clean-temp-simple.h.
(register_temporary_file, unregister_temporary_file,
cleanup_temporary_file): Remove declarations.
* lib/clean-temp.c: Don't include <limits.h>, <stdint.h>. Include
<signal.h>, <stdio.h>, clean-temp-simple.h, clean-temp-private.h.
(file_cleanup_list_lock, file_cleanup_list): Moved to
clean-temp-simple.c.
(struct tempdir, dir_cleanup_list, struct closeable_fd, descriptors):
Moved to clean-temp-private.h.
(string_equals, SIZE_BITS, string_hash, fatal_signal_set,
init_fatal_signal_set, asyncsafe_close): Moved to clean-temp-simple.c.
(asyncsafe_fclose_variant): Use get_fatal_signal_set() here.
(cleanup_action, do_init_clean_temp, clean_temp_once, init_clean_temp,
register_temporary_file, unregister_temporary_file, do_unlink,
cleanup_temporary_file): Moved to clean-temp-simple.c.
(create_temp_dir, cleanup_temp_file, cleanup_temp_dir_contents,
gen_register_open_temp, close_temp): Update for changed function names.
(fclose_variant_temp): Don't call init_fatal_signal_set().
* modules/clean-temp-simple: New file, based on modules/clean-temp.
* modules/clean-temp (Depends-on): Add clean-temp-simple, list. Remove
stdint.
(configure.ac): Don't define SIGNAL_SAFE_LIST here.

4 years agoerror: Relicense under LGPLv2+.
Bruno Haible [Mon, 22 Mar 2021 17:28:02 +0000 (18:28 +0100)]
error: Relicense under LGPLv2+.

Pino Toscano's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00109.html>.
Paul Eggert's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00110.html>.

* modules/error (License): Change to LGPLv2+.