]> Savannah Git Hosting - gnulib.git/log
gnulib.git
6 months agoselect: Document a Haiku bug.
Bruno Haible [Fri, 1 Nov 2024 22:04:06 +0000 (23:04 +0100)]
select: Document a Haiku bug.

* doc/posix-functions/select.texi: Mention a Haiku bug.

6 months agoeealloc: Revert last change.
Bruno Haible [Fri, 1 Nov 2024 12:44:12 +0000 (13:44 +0100)]
eealloc: Revert last change.

* m4/eealloc.m4 (gl_EEMALLOC): Invoke _AC_FUNC_MALLOC_IF, not
gl_CHECK_MALLOC_POSIX.

6 months agorealloc-posix: Fix test failure on AIX (regression 2024-10-27).
Bruno Haible [Fri, 1 Nov 2024 12:26:40 +0000 (13:26 +0100)]
realloc-posix: Fix test failure on AIX (regression 2024-10-27).

* m4/realloc.m4 (gl_FUNC_REALLOC_0_NONNULL): New macro.
* modules/realloc-posix (configure.ac): Invoke it.

6 months agoeealloc: Use the same cross-compilation guess as malloc-posix.
Bruno Haible [Fri, 1 Nov 2024 11:28:05 +0000 (12:28 +0100)]
eealloc: Use the same cross-compilation guess as malloc-posix.

* m4/eealloc.m4 (gl_EEMALLOC): Invoke gl_CHECK_MALLOC_POSIX, not
_AC_FUNC_MALLOC_IF.
* modules/malloca (Files): Add m4/malloc.m4.
* modules/regex (Files): Likewise.

6 months agoImprove log output of an Autoconf test.
Bruno Haible [Fri, 1 Nov 2024 11:25:22 +0000 (12:25 +0100)]
Improve log output of an Autoconf test.

* m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): On native Windows, report
"guessing yes/no".
(gl_FUNC_MALLOC_POSIX): Update.
* m4/strdup.m4 (gl_FUNC_STRDUP_POSIX): Likewise.

6 months agomalloc, realloc: fix $3 bug
Paul Eggert [Fri, 1 Nov 2024 02:22:22 +0000 (19:22 -0700)]
malloc, realloc: fix $3 bug

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00284.html
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF):
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF):
Sync from bleeding-edge Autoconf again.

6 months agocrc: Support generating the tables also when cross-compiling.
Bruno Haible [Thu, 31 Oct 2024 23:17:20 +0000 (00:17 +0100)]
crc: Support generating the tables also when cross-compiling.

* m4/build-cc.m4: New file.
* modules/crc (Files): Add it.
(configure.ac): Invoke gl_BUILD_CC. Don't set GL_CROSS_COMPILING.
(Makefile.am): Use $(BUILD_CC) etc. instead of $(CC) etc.

6 months agomalloc-posix, realloc-posix: Fix incorrect expansion of AC_FUNC_MALLOC.
Bruno Haible [Thu, 31 Oct 2024 21:11:22 +0000 (22:11 +0100)]
malloc-posix, realloc-posix: Fix incorrect expansion of AC_FUNC_MALLOC.

* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Handle the case of a missing third
argument.
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Likewise.

6 months agomalloc-gnu, eealloc: Make code more future-proof.
Bruno Haible [Thu, 31 Oct 2024 21:04:42 +0000 (22:04 +0100)]
malloc-gnu, eealloc: Make code more future-proof.

* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Protect evaluation of
$gl_cross_guess_normal.
* m4/eealloc.m4 (gl_EEMALLOC, gl_EEREALLOC): Likewise.

6 months agomalloc-posix, calloc-posix, realloc-posix: Optimize on MSVC.
Bruno Haible [Thu, 31 Oct 2024 19:54:52 +0000 (20:54 +0100)]
malloc-posix, calloc-posix, realloc-posix: Optimize on MSVC.

* m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Assume that malloc sets errno
upon failure if UCRT is in use.

6 months agorealloc-posix tests: Enhance tests.
Bruno Haible [Thu, 31 Oct 2024 19:54:45 +0000 (20:54 +0100)]
realloc-posix tests: Enhance tests.

* tests/test-realloc-posix.c (main): Check errno also after normal
failing realloc calls.

6 months agorealloc-posix tests: Fix memory leak.
Bruno Haible [Thu, 31 Oct 2024 19:54:41 +0000 (20:54 +0100)]
realloc-posix tests: Fix memory leak.

* tests/test-realloc-posix.c (main): Don't clobber variable 'p' in
failing call.

6 months agocalloc-posix: Add tests.
Bruno Haible [Thu, 31 Oct 2024 19:54:36 +0000 (20:54 +0100)]
calloc-posix: Add tests.

* tests/test-calloc-posix.c: New file.
* modules/calloc-posix-tests: New file.

6 months agomalloc-posix: Add tests.
Bruno Haible [Thu, 31 Oct 2024 19:54:15 +0000 (20:54 +0100)]
malloc-posix: Add tests.

* tests/test-malloc-posix.c: New file.
* modules/malloc-posix-tests: New file.

6 months agorealloc-posix: Set errno when failing (regression 2029-10-29).
Bruno Haible [Thu, 31 Oct 2024 19:53:17 +0000 (20:53 +0100)]
realloc-posix: Set errno when failing (regression 2029-10-29).

* lib/realloc.c (rpl_realloc): When failing, with HAVE_MALLOC_POSIX not
defined, set errno.

6 months agocrc: Avoid potential conflict with other configure.ac files.
Bruno Haible [Thu, 31 Oct 2024 19:51:10 +0000 (20:51 +0100)]
crc: Avoid potential conflict with other configure.ac files.

Suggested by Simon Josefsson.

* modules/crc (configure.ac, Makefile.am): Rename CROSS_COMPILING to
GL_CROSS_COMPILING.

6 months agocrc: Fix compile warnings
Sam Russell [Thu, 31 Oct 2024 13:59:37 +0000 (14:59 +0100)]
crc: Fix compile warnings

* lib/crc-generate-table.c: Mark non-exported functions as static
* lib/crc.c: Mark non-exported functions as static

Signed-off-by: Simon Josefsson <simon@josefsson.org>
6 months agocrc: Don't attempt to run a compiled C program when cross-compiling.
Bruno Haible [Thu, 31 Oct 2024 13:48:35 +0000 (14:48 +0100)]
crc: Don't attempt to run a compiled C program when cross-compiling.

* lib/crc-generate-table.c: Don't include config.h.
* modules/crc (configure.ac): Define CROSS_COMPILING variable. Invoke
AC_PROG_MKDIR_P.
(Makefile.am): When cross-compiling, don't regenerate crc-sliceby8.h.
Don't use Gnulib modules while compiling the generator.

6 months agocrc: Tweak generator.
Bruno Haible [Thu, 31 Oct 2024 13:23:09 +0000 (14:23 +0100)]
crc: Tweak generator.

* lib/crc-generate-table.c (print_header): Don't emit a blank line at
the end.
(print_copyright_notice): Prepend a "DO NOT EDIT" line.
(main): Fail if disk is full after we wrote part of the file.

6 months agocrc: make it a maintainer setting rather than a user setting.
Simon Josefsson [Thu, 31 Oct 2024 12:10:34 +0000 (13:10 +0100)]
crc: make it a maintainer setting rather than a user setting.

* m4/crc.m4 (gl_CRC_SLICE_BY_8): Drop AC_ARG_ENABLE.

6 months agocrc: New optimised slice-by-8 implementation
Sam Russell [Sun, 27 Oct 2024 12:19:17 +0000 (13:19 +0100)]
crc: New optimised slice-by-8 implementation

* lib/crc.c: Implementation of slice-by-8 algorithm
* lib/crc-generate-table.c: Generation code for CRC32 lookup tables
* m4/crc.m4: Autoconf enable slice-by-8, flag to disable
* modules/crc (Depends-on): Add endian.
(Makefile.am): Build slice-by-8 tables from crc-generate-table.c.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
6 months agoposix_memalign: Fix configure test (regression yesterday).
Bruno Haible [Thu, 31 Oct 2024 11:13:17 +0000 (12:13 +0100)]
posix_memalign: Fix configure test (regression yesterday).

* m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): Fix typo in comment.
Fix variable name.

6 months agoaligned_alloc: Fix comment.
Bruno Haible [Thu, 31 Oct 2024 11:09:46 +0000 (12:09 +0100)]
aligned_alloc: Fix comment.

* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Fix typo in comment.

6 months agoassert-h: Allow mixed use of gcc/g++ also on Haiku 2022.
Bruno Haible [Thu, 31 Oct 2024 03:34:29 +0000 (04:34 +0100)]
assert-h: Allow mixed use of gcc/g++ also on Haiku 2022.

* m4/assert_h.m4 (gl_ASSERT_H): Don't assume that in C mode, <assert.h>
defines static_assert.

6 months agofutimes, utimensat, utimes, utime: Document Haiku malfunction.
Bruno Haible [Wed, 30 Oct 2024 22:21:04 +0000 (23:21 +0100)]
futimes, utimensat, utimes, utime: Document Haiku malfunction.

* doc/posix-functions/futimens.texi: Mention Haiku's brokenness.
* doc/posix-functions/utimensat.texi: Likewise.
* doc/posix-functions/utimes.texi: Likewise.
* doc/pastposix-functions/utime.texi: Likewise.

6 months agoposix_memalign: check for GNU behavior with size 0
Paul Eggert [Wed, 30 Oct 2024 19:47:02 +0000 (12:47 -0700)]
posix_memalign: check for GNU behavior with size 0

* lib/posix_memalign.c: Include stdckdint.h.
(posix_memalign): Test for overflow more straightforwardly,
and more portably to unlikely platforms where SIZE_MAX <= INT_MAX.
Treat a zero size as if it were alignment.
* m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN):
* tests/test-posix_memalign.c (main):
Test zero size too.  Use volatile to avoid compiler optimizations.
* modules/posix_memalign (Depends-on): Add stdckdint.

6 months agoaligned_alloc: check for GNU behavior with size 0
Paul Eggert [Wed, 30 Oct 2024 18:54:57 +0000 (11:54 -0700)]
aligned_alloc: check for GNU behavior with size 0

If someone ever needs to distinguish between GNU and merely POSIX
behavior we can split this into two modules, but for now just
make this module act like GNU.
* lib/aligned_alloc.c (aligned_alloc): Treat zero size like GNU.
* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC):
* tests/test-aligned_alloc.c (main):
Test zero size too.

6 months agoassert-h, stdbool: Fix compilation error with MSVC 14 (regr. yesterday).
Bruno Haible [Wed, 30 Oct 2024 14:56:41 +0000 (15:56 +0100)]
assert-h, stdbool: Fix compilation error with MSVC 14 (regr. yesterday).

* m4/assert_h.m4 (gl_ASSERT_H): Add parentheses to the preprocessor
expression.
* m4/c-bool.m4 (gl_C_BOOL): Likewise.

6 months agomalloc, realloc: sync from Autoconf master
Paul Eggert [Wed, 30 Oct 2024 05:01:44 +0000 (22:01 -0700)]
malloc, realloc: sync from Autoconf master

* m4/malloc.m4 (_AC_FUNC_MALLOC_IF):
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF):
Sync from bleeding-edge Autoconf.  All uses changed.

6 months agomalloc: fix recent doc bug for AIX 7.3
Paul Eggert [Wed, 30 Oct 2024 05:01:43 +0000 (22:01 -0700)]
malloc: fix recent doc bug for AIX 7.3

* doc/posix-functions/malloc.texi: Undo previous change,
as _LINUX_SOURCE_COMPAT no longer affects malloc on AIX 7.3.
It did affect it in AIX 7.1 but 7.1 is no longer supported.

6 months agorealloc-posix: realloc (p, 0) yields nonnull
Paul Eggert [Wed, 30 Oct 2024 05:01:42 +0000 (22:01 -0700)]
realloc-posix: realloc (p, 0) yields nonnull

* lib/realloc.c: Include <stdckdint.h>, not "xalloc-oversized.h".
Use of xalloc_oversized replaced by ckd_add.
(rpl_realloc) [!NEED_SANITIZED_REALLOC]:
Treat realloc (p, 0) as if it were a realloc (p, 1) that never fails.
That’s easier, reduces module dependencies,
and better supports the future alloc-0-nonnull module.
* modules/realloc-posix (Depends-on): Remove free-posix,
malloc-posix, xalloc-oversized.  Add stdckdint.

6 months agobackupfile: Remove non-existent module dependency.
Collin Funk [Wed, 30 Oct 2024 03:12:25 +0000 (20:12 -0700)]
backupfile: Remove non-existent module dependency.

* modules/backupfile (Depends-on): Remove irealloc dependency since the
function is a part of the ialloc module.

6 months agoFix indentation in config.h (regression 2024-09-25).
Bruno Haible [Tue, 29 Oct 2024 15:21:06 +0000 (16:21 +0100)]
Fix indentation in config.h (regression 2024-09-25).

* m4/gnulib-common.m4 (gl_COMMON_BODY): Fix a '#else' indentation.

6 months agoassert-h, stdbool: Allow mixed use of gcc/g++ and clang/clang++ again.
Bruno Haible [Tue, 29 Oct 2024 12:48:36 +0000 (13:48 +0100)]
assert-h, stdbool: Allow mixed use of gcc/g++ and clang/clang++ again.

* m4/assert_h.m4 (gl_ASSERT_H): Improve indentation. With GCC and clang,
don't use the value of HAVE_C_STATIC_ASSERT.
* m4/c-bool.m4 (gl_C_BOOL): With GCC and clang, don't use the value of
HAVE_C_BOOL.

6 months agodoc: Don't mention Java dependency.
Bruno Haible [Tue, 29 Oct 2024 04:02:20 +0000 (05:02 +0100)]
doc: Don't mention Java dependency.

* doc/build-automation.texi (Building gnulib): Remove Java from the
needed tools.

6 months agodoc: Mention Python dependency.
Collin Funk [Tue, 29 Oct 2024 02:59:35 +0000 (19:59 -0700)]
doc: Mention Python dependency.

* doc/build-automation.texi (Building gnulib): Document that Python is
needed for gnulib-tool.

6 months agodoc: Improve usability of generated PDF.
Bruno Haible [Mon, 28 Oct 2024 12:24:34 +0000 (13:24 +0100)]
doc: Improve usability of generated PDF.

* doc/gnulib.texi: Use a brown colour for interactive links.

6 months agorealloc-gnu: Fix typo in deprecation notice.
Collin Funk [Sun, 27 Oct 2024 23:58:59 +0000 (16:58 -0700)]
realloc-gnu: Fix typo in deprecation notice.

* modules/realloc-gnu (Notice): Recommend 'realloc-posix' in the
deprecation notice.

6 months agorealloc-gnu: Replace module with an alias to realloc-posix.
Bruno Haible [Sun, 27 Oct 2024 23:18:35 +0000 (00:18 +0100)]
realloc-gnu: Replace module with an alias to realloc-posix.

* tests/test-realloc-posix.c: Renamed from tests/test-realloc-gnu.c. Add
more tests, not yet activated.
* modules/realloc-posix-tests: Renamed from modules/realloc-gnu-tests.
Test test-realloc-posix instead of test-realloc-gnu.
* modules/realloc-gnu: Mark as a deprecated alias of 'realloc-posix'.
* lib/stdlib.in.h (realloc): Ignore GNULIB_REALLOC_GNU.
* modules/stdlib (Makefile.am): Don't substitute GNULIB_REALLOC_GNU,
REPLACE_REALLOC_FOR_REALLOC_GNU.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Don't initialize
GNULIB_REALLOC_GNU.
(gl_STDLIB_H_DEFAULTS): Don't initialize
REPLACE_REALLOC_FOR_REALLOC_GNU.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Remove macro.
* m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Update comment.
* doc/posix-functions/realloc.texi: Remove description of module
'realloc-gnu'.
* MODULES.html.sh (Memory management functions <stdlib.h>): Remove
realloc-gnu. Add realloc-posix.

6 months agodoc: Add a module index.
Bruno Haible [Sun, 27 Oct 2024 16:01:29 +0000 (17:01 +0100)]
doc: Add a module index.

* doc/Makefile (undocumented-modules.texi): New rule.
(%.info, %.html, %.dvi, %.pdf): Depend on undocumented-modules.texi.
(mostlyclean): Remove also *.m and *.tmp.
(force): New rule.
* doc/*.texi: Add module index entries.
* doc/*/*.texi: Likewise.

6 months agoposix_memalign: port better to OpenBSD 6.2+ cross
Paul Eggert [Sat, 26 Oct 2024 21:34:10 +0000 (14:34 -0700)]
posix_memalign: port better to OpenBSD 6.2+ cross

* m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN):
Don’t assume sizeof (void *) <= 32 (!).
The bug is fixed in OpenBSD 6.2+.

6 months agoposix_memalign-tests: fix message typo
Paul Eggert [Sat, 26 Oct 2024 17:07:53 +0000 (10:07 -0700)]
posix_memalign-tests: fix message typo

* tests/test-posix_memalign.c (main): Fix diagnostic typo.

6 months agoaligned_alloc: document glibc bug 32301
Paul Eggert [Sat, 26 Oct 2024 17:06:55 +0000 (10:06 -0700)]
aligned_alloc: document glibc bug 32301

* doc/posix-functions/aligned_alloc.texi:
* doc/posix-functions/posix_memalign.texi: Mention glibc bug
32301, which it is not worth our time to work around.

6 months agoeealloc: update commentary
Paul Eggert [Sat, 26 Oct 2024 00:02:02 +0000 (17:02 -0700)]
eealloc: update commentary

Even if we remove eealloc we might as well add commentary
explaining some of its confusion, before we remove it.
* lib/eealloc.h: Update comment.
* modules/eealloc (Description):
Update, since eealloc is not glibc compatible.

6 months agoregex: Avoid dialog while running configure test on Haiku/x86_64.
Bruno Haible [Sat, 26 Oct 2024 19:10:30 +0000 (21:10 +0200)]
regex: Avoid dialog while running configure test on Haiku/x86_64.

Reported by Alexandru Popa <alpopa@gmail.com> in
<https://sourceforge.net/p/clisp/mailman/message/58831511/>.

* m4/regex.m4 (gl_REGEX): Disable dialog upon abort on Haiku.

6 months agoregex: Make configure test more maintainable.
Bruno Haible [Sat, 26 Oct 2024 18:58:05 +0000 (20:58 +0200)]
regex: Make configure test more maintainable.

* m4/regex.m4 (gl_REGEX): Include <malloc.h> before testing for
M_CHECK_ACTION.

6 months agoexecute, spawn-pipe: Fix compilation error on Cygwin (regr. 2024-10-22).
Bruno Haible [Sat, 26 Oct 2024 18:19:40 +0000 (20:19 +0200)]
execute, spawn-pipe: Fix compilation error on Cygwin (regr. 2024-10-22).

* lib/windows-path.h: Include <stdlib.h>.

6 months agopipe-filter-gi: Correct documentation.
Bruno Haible [Sat, 26 Oct 2024 17:42:10 +0000 (19:42 +0200)]
pipe-filter-gi: Correct documentation.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00199.html>.

* lib/pipe-filter.h (pipe_filter_gi_create): Don't say that this
function may return NULL.

6 months agoeealloc: Relicense under LGPLv2+.
Bruno Haible [Fri, 25 Oct 2024 19:59:45 +0000 (21:59 +0200)]
eealloc: Relicense under LGPLv2+.

Jim Meyering's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00192.html>.

* modules/eealloc (License): Change to LGPLv2+.
* lib/eealloc.h: Update license notice.
* lib/eealloc.c: Likewise.

6 months agoxalloc: Adjust dependencies after last change.
Bruno Haible [Fri, 25 Oct 2024 11:59:41 +0000 (13:59 +0200)]
xalloc: Adjust dependencies after last change.

* modules/xalloc (Depends-on): Remove realloc-gnu. Add realloc-posix.

6 months agoialloc: Fix dependencies.
Bruno Haible [Fri, 25 Oct 2024 11:55:08 +0000 (13:55 +0200)]
ialloc: Fix dependencies.

* modules/ialloc (Depends-on): Add realloc-posix.

6 months agorealloc: minor style coalescing
Paul Eggert [Fri, 25 Oct 2024 04:55:46 +0000 (21:55 -0700)]
realloc: minor style coalescing

* lib/alignalloc.h (alignalloc):
* lib/eealloc.h (eerealloc):
* lib/ialloc.h (irealloc, ireallocarray):
* lib/safe-alloc.h (safe_alloc_realloc_n):
Adjust commentary and code to better match what’s used elsewhere.
This doesn’t change behavior.

6 months agoxalloc: port to Cheri, strict C23, realloc null
Paul Eggert [Fri, 25 Oct 2024 04:52:19 +0000 (21:52 -0700)]
xalloc: port to Cheri, strict C23, realloc null

* lib/xmalloc.c [__CHERI_PURE_CAPABILITY__]: Include <cheri.h>.
(xrealloc, xreallocarray): Support Cheri.  Avoid undefined
behavior in strict C23.  Work better on platforms where
realloc (p, 0) returns a null pointer

6 months agoreallocarray: simplify
Paul Eggert [Fri, 25 Oct 2024 04:34:12 +0000 (21:34 -0700)]
reallocarray: simplify

* lib/reallocarray.c (reallocarray): Use simpler workaround
for realloc glitch, which does not involve malloc.
* modules/reallocarray (Depends-on): Remove malloc-posix.

6 months agoialloc: fix realloc-gnu dependency
Paul Eggert [Wed, 23 Oct 2024 21:33:43 +0000 (14:33 -0700)]
ialloc: fix realloc-gnu dependency

* modules/ialloc (Depends-on): Remove realloc-gnu,
as ialloc.c does not depend on GNU semantics for realloc.

6 months agobackupfile: fix irealloc dependency
Paul Eggert [Wed, 23 Oct 2024 21:30:35 +0000 (14:30 -0700)]
backupfile: fix irealloc dependency

* modules/backupfile (Depends-on): Depend on irealloc,
not realloc-gnu, as the code now uses irealloc not realloc
and does not depend on GNU semantics anyway.

6 months agogroup-member: fix malloc-gnu dependency
Paul Eggert [Wed, 23 Oct 2024 21:27:45 +0000 (14:27 -0700)]
group-member: fix malloc-gnu dependency

* modules/group-member (Depends-on): Depend on malloc-gnu,
not realloc-gnu, since the code uses malloc not realloc.

6 months agorealloc: still more improvements for realloc (p, 0)
Paul Eggert [Wed, 23 Oct 2024 20:51:29 +0000 (13:51 -0700)]
realloc: still more improvements for realloc (p, 0)

* doc/posix-functions/malloc.texi: AIX is sans _LINUX_SOURCE_COMPAT.
* doc/posix-functions/realloc.texi:
Give more details about what recent POSIX versions say,
and fix some misperceptions about C89 through C11.
Document that the GNU behavior does not conform to POSIX,
and that AIX's behavior with _LINUX_SOURCE_COMPAT
matches glibc's circa 1999 behavior, not its current behavior.
Be a little less confident about realloc-gnu, since it doesn't
fully implement current glibc behavior.
Give more details about when memory leaks or false positives can occur.
* doc/posix-functions/reallocarray.texi:
Say that it shares realloc’s woes with zero sizes.

6 months agocrc: New tests for non-byte-aligned data.
Sam Russell [Tue, 22 Oct 2024 20:16:01 +0000 (22:16 +0200)]
crc: New tests for non-byte-aligned data.

* tests/test-crc.c: New tests.
* modules/crc-tests (Files): Add dependency on randomb.c

Signed-off-by: Simon Josefsson <simon@josefsson.org>
6 months agoexecute, spawn-pipe: Support DLL dependencies of Windows executables.
Bruno Haible [Tue, 22 Oct 2024 20:08:24 +0000 (22:08 +0200)]
execute, spawn-pipe: Support DLL dependencies of Windows executables.

Reported by Michele Locati <michele@locati.it>.

* lib/windows-path.h: New file.
* lib/windows-path.c: New file.
* lib/windows-spawn.h (compose_envblock): Add new_PATH parameter.
(spawnpvech): Add dll_dirs parameter. Call extended_PATH.
* lib/windows-spawn.c: Include windows-path.h.
(compose_envblock): Add new_PATH parameter.
* modules/windows-spawn (Description): Now applies to Cygwin as well.
(Files): Add lib/windows-path.h, lib/windows-path.c.
(configure.ac): Define GL_COND_OBJ_WINDOWS_PATH.
(Makefile.am): Conditionally compile windows-path.c.
(Include): Add windows-path.h.
* lib/spawni.c (__spawni): Update compose_envblock call.
* lib/execute.h (execute): Add dll_dirs parameter.
* lib/execute.c: Include windows-path.h.
(execute): Add dll_dirs parameter. Pass it down to spawnpvech. Call
extended_environ.
* lib/spawn-pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi):
Add dll_dirs parameter.
* lib/spawn-pipe.c: Include windows-path.h.
(create_pipe): Add dll_dirs parameter. Pass it down to spawnpvech. Call
extended_environ.
(create_pipe_bidi, create_pipe_in, create_pipe_out): Add dll_dirs
parameter.
* lib/javaexec.c (execute_java_class): Update execute invocations.
* lib/cygpath.c (execute_and_read_line): Update create_pipe_in
invocation.
* lib/javaversion.c (execute_and_read_line): Likewise.
* lib/csharpcomp.c (compile_csharp_using_mono,
compile_csharp_using_dotnet, compile_csharp_using_sscli): Update
execute, create_pipe_in invocations.
* lib/csharpexec.c (execute_csharp_using_mono,
execute_csharp_using_dotnet, execute_csharp_using_sscli): Likewise.
* lib/javacomp.c (compile_using_envjavac, compile_using_javac,
execute_and_read_line, is_javac_present): Likewise.
* lib/pipe-filter-gi.c (pipe_filter_gi_create): Update create_pipe_bidi
invocation.
* lib/pipe-filter-ii.c (pipe_filter_ii_execute): Likewise.
* tests/test-execute-main.c (main): Update execute invocations.
* tests/test-execute-script.c (main): Likewise.
* tests/test-spawn-pipe-main.c (main): Update create_pipe_bidi
invocation.
* tests/test-spawn-pipe-script.c (main): Update create_pipe_in
invocations.
* NEWS: Mention the changes.

6 months agoreallocarray: Don't assume unportable behaviour of realloc.
Bruno Haible [Mon, 21 Oct 2024 15:20:37 +0000 (17:20 +0200)]
reallocarray: Don't assume unportable behaviour of realloc.

* lib/reallocarray.c (reallocarray): Handle the nbytes==0 case
explicitly.
* modules/reallocarray (Depends-on): Remove realloc-gnu. Add
malloc-posix, realloc-posix.

6 months agorealloc: Optionally check for undefined behaviour.
Bruno Haible [Mon, 21 Oct 2024 13:29:40 +0000 (15:29 +0200)]
realloc: Optionally check for undefined behaviour.

* m4/realloc.m4 (gl_FUNC_REALLOC_SANITIZED): New macro.
(gl_FUNC_REALLOC_POSIX): Require it. If a sanitized realloc is
requested, define NEED_SANITIZED_REALLOC and compile realloc.c.
(gl_FUNC_REALLOC_GNU): Require it. If a sanitized realloc is requested,
don't compile realloc.c a second time.
* lib/realloc.c (rpl_realloc): If NEED_SANITIZED_REALLOC is defined,
abort in the case of undefined behaviour.

6 months agorealloc: more improvements for realloc (p, 0)
Paul Eggert [Sat, 19 Oct 2024 21:18:49 +0000 (14:18 -0700)]
realloc: more improvements for realloc (p, 0)

* doc/posix-functions/realloc.texi (realloc):
Document more realloc (p, 0) gotchas: evolution of C standards,
errno values, which glibc versions do what, how programs might
misbehave, what happens when not growing.

6 months agoautoupdate
Karl Berry [Sat, 19 Oct 2024 14:07:02 +0000 (07:07 -0700)]
autoupdate

6 months agorealloc: Improve documentation.
Bruno Haible [Sat, 19 Oct 2024 12:23:39 +0000 (14:23 +0200)]
realloc: Improve documentation.

* doc/posix-functions/realloc.texi: Regarding realloc(p,0), document
what the platforms actually do, not merely theoretical possibilities.

6 months agoUse a warranty disclaimer in all-permissive license notices, part 2.
Collin Funk [Fri, 18 Oct 2024 03:25:36 +0000 (20:25 -0700)]
Use a warranty disclaimer in all-permissive license notices, part 2.

* doc/gnulib-intro.texi (Copyright): Add a short warranty disclaimer
sentence.
* users.txt: Likewise.
* modules/COPYING: Likewise.

6 months agoUse a warranty disclaimer in all-permissive license notices.
Bruno Haible [Thu, 17 Oct 2024 19:52:41 +0000 (21:52 +0200)]
Use a warranty disclaimer in all-permissive license notices.

* etc/license-notices/unlimited: Add a short warranty disclaimer
sentence.
* m4/*.m4: Update.
* build-aux/prefix-gnulib-mk: Likewise.
* HACKING: Likewise.

6 months agogettext: Un-obsolete.
Bruno Haible [Thu, 17 Oct 2024 13:13:49 +0000 (15:13 +0200)]
gettext: Un-obsolete.

Reported by Assaf Gordon <assafgordon@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00047.html>.

* modules/gettext (Description): Add a third purpose.
(Status, Notice): Remove sections.

6 months agocrc tests: Add a benchmark program.
Bruno Haible [Wed, 16 Oct 2024 20:06:11 +0000 (22:06 +0200)]
crc tests: Add a benchmark program.

* tests/macros.h (randomb): New declaration.
* tests/randomb.c: New file.
* tests/bench-crc.c: New file.
* modules/crc-tests (Files): Add them. Add tests/macros.h,
tests/bench.h.
(Depends-on): Add getrusage, gettimeofday.
(Makefile.am): Arrange to compile bench-crc.

6 months agopthread-h tests: Fix a compilation error on MacOS X 10.4.
Bruno Haible [Wed, 16 Oct 2024 10:46:26 +0000 (12:46 +0200)]
pthread-h tests: Fix a compilation error on MacOS X 10.4.

Reported by Sevan Janiyan <venture37@geeklan.co.uk> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00183.html>.

* tests/test-pthread.c: Omit the PTHREAD_RWLOCK_INITIALIZER test if
module 'pthread-rwlock' is not in use.

6 months agoautoupdate
Karl Berry [Tue, 15 Oct 2024 13:43:57 +0000 (06:43 -0700)]
autoupdate

6 months agostring-desc: New function string_desc_c_casecmp.
Bruno Haible [Sun, 13 Oct 2024 10:01:08 +0000 (12:01 +0200)]
string-desc: New function string_desc_c_casecmp.

* lib/string-desc.h: New declaration.
* lib/string-desc.c: Include <limits.h>, c-ctype.h.
(string_desc_c_casecmp): New function.
* modules/string-desc (Depends-on): Add c-ctype.
* tests/test-string-desc.c (main): Add tests of string_desc_c_casecmp.

6 months agostring-desc: Fix categorization string_desc_new_addr.
Bruno Haible [Sun, 13 Oct 2024 09:35:12 +0000 (11:35 +0200)]
string-desc: Fix categorization string_desc_new_addr.

* lib/string-desc.h (string_desc_new_addr): Move to section
"Side-effect-free operations".
* lib/string-desc.c (string_desc_new_addr): Move accordingly.

6 months agodoc: Recommend string descriptors for application area like parsers.
Bruno Haible [Sat, 12 Oct 2024 07:23:24 +0000 (09:23 +0200)]
doc: Recommend string descriptors for application area like parsers.

* doc/string-desc.texi (Handling strings with NUL characters): Mention
the ease of taking a substring.

6 months agobison-i18n: Add support for mingw builds on Cygwin hosts.
Bruno Haible [Fri, 11 Oct 2024 15:43:02 +0000 (17:43 +0200)]
bison-i18n: Add support for mingw builds on Cygwin hosts.

* m4/bison-i18n.m4 (BISON_I18N): Define also BISON_LOCALEDIR_c and
BISON_LOCALEDIR_c_make.
* modules/bison-i18n (Files): Add m4/build-to-host.m4.

6 months agobuild-to-host.m4: Add one more convenience macro.
Bruno Haible [Fri, 11 Oct 2024 15:41:11 +0000 (17:41 +0200)]
build-to-host.m4: Add one more convenience macro.

* m4/build-to-host.m4 (gl_BUILD_TO_HOST_DATADIR): New macro.

6 months agocsharpcomp-script: Handle directories with spaces correctly.
Bruno Haible [Thu, 10 Oct 2024 17:39:36 +0000 (19:39 +0200)]
csharpcomp-script: Handle directories with spaces correctly.

Reported by Michele Locati <michele@locati.it>.

* build-aux/csharpcomp.sh.in (command_for_print, command_for_eval,
options_csc_for_print, options_csc_for_eval, sources_csc_for_print,
sources_csc_for_eval): New variables.
(sed_protect_1, sed_protect_2a, sed_protect_2b, sed_protect_2c,
sed_protect_3a, sed_protect_3b): New variables, copied from
build-aux/x-to-1.in.
(func_add_word_to_command): New function, copied from
build-aux/x-to-1.in.
(func_add_word_to_options_csc, func_add_word_to_sources_csc): New
functions.
(options_csc, sources_csc): Remove variables. Use
func_add_word_to_options_csc, func_add_word_to_sources_csc instead of
augmenting them.
Use options_csc_for_print, options_csc_for_eval, sources_csc_for_print,
sources_csc_for_eval when invoking csc.
* build-aux/csharpexec.sh.in (sed_quote_subst): Remove unused variable.

6 months agojava{comp,exec}-script, csharp{comp,exec}-script: Improve debugging.
Bruno Haible [Thu, 10 Oct 2024 17:15:06 +0000 (19:15 +0200)]
java{comp,exec}-script, csharp{comp,exec}-script: Improve debugging.

* build-aux/javaexec.sh.in: Send debugging output to stderr, not stdout.
* build-aux/javacomp.sh.in: Likewise.
* build-aux/csharpexec.sh.in: Likewise.
* build-aux/csharpcomp.sh.in: Likewise.

6 months agocsharpcomp: Avoid error on Windows.
Bruno Haible [Wed, 9 Oct 2024 15:22:59 +0000 (17:22 +0200)]
csharpcomp: Avoid error on Windows.

Reported by Michele Locati <michele@locati.it>.

* build-aux/csharpcomp.sh.in: Don't produce -reference options for DLLs
whose name starts with a lowercase letter or contains '.Native.'.
* lib/csharpcomp.c (name_is_dll): Filter our file names that start with
a lowercase letter or contain '.Native.'.

6 months agocsharpcomp-script: Recognize dotnet even without --enable-csharp=dotnet.
Bruno Haible [Wed, 9 Oct 2024 14:33:02 +0000 (16:33 +0200)]
csharpcomp-script: Recognize dotnet even without --enable-csharp=dotnet.

* m4/csharpcomp.m4 (gt_CSHARPCOMP): Try 'dotnet' also when
--enable-csharp=dotnet is not specified.

6 months agocsharpcomp: Add support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 01:20:00 +0000 (03:20 +0200)]
csharpcomp: Add support for dotnet.

* lib/csharpcomp.c: Include <dirent.h>, concat-filename.h, xvasprintf.h.
(name_is_dll): New function, from lib/csharpexec.c.
(compile_csharp_using_dotnet): New function.
(compile_csharp_class): Invoke compile_csharp_using_dotnet.
* modules/csharpcomp (Depends-on): Add xconcat-filename, scandir,
alphasort, xvasprintf.

6 months agocsharpcomp-script: Add support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 01:14:26 +0000 (03:14 +0200)]
csharpcomp-script: Add support for dotnet.

* m4/csharpcomp.m4 (gt_CSHARPCOMP): Support 'dotnet' as implementation.
Set HAVE_DOTNET_SDK, HAVE_DOTNET_CSC.
* build-aux/csharpcomp.sh.in: Add implementations for the cases
$HAVE_DOTNET_SDK = 1 and $HAVE_DOTNET_CSC = 1.

6 months agocsharpexec: Add support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 01:14:04 +0000 (03:14 +0200)]
csharpexec: Add support for dotnet.

* lib/csharpexec.c: Include <dirent.h>, <errno.h>, <sys/stat.h>,
dirname.h, concat-filename.h, canonicalize.h, spawn-pipe.h,
wait-process.h, xalloc.h, copy-file.h, clean-temp-simple.h,
clean-temp.h.
(name_is_dll, execute_csharp_using_dotnet): New functions.
(execute_csharp_program): Invoke execute_csharp_using_dotnet.
* modules/csharpexec (Depends-on): Add stat, dirname, xconcat-filename,
canonicalize, spawn-pipe, wait-process, scandir, alphasort, copy-file,
clean-temp-simple, clean-temp.

6 months agocsharpexec-script: Add support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 01:12:42 +0000 (03:12 +0200)]
csharpexec-script: Add support for dotnet.

* m4/csharpexec.m4 (gt_CSHARPEXEC): Support 'dotnet' as implementation.
Set HAVE_DOTNET.
* build-aux/csharpexec.sh.in (func_tmpdir): New function, copied from
build-aux/csharpcomp.sh.in.
Add implementation for the case $HAVE_DOTNET = 1.

6 months agocsharpexec-script, csharpcomp-script: Prepare support for dotnet.
Bruno Haible [Wed, 9 Oct 2024 01:11:32 +0000 (03:11 +0200)]
csharpexec-script, csharpcomp-script: Prepare support for dotnet.

* m4/csharp.m4 (gt_CSHARP_CHOICE): Recognize 'dotnet' as value of
--enable-csharp.

6 months agocsharpcomp: Behave like csharpcomp-script.
Bruno Haible [Wed, 9 Oct 2024 01:09:15 +0000 (03:09 +0200)]
csharpcomp: Behave like csharpcomp-script.

* lib/csharpcomp.c (compile_csharp_using_sscli): Pass the option
'-nologo' to csc.

6 months agocsharpcomp: Fix memory management bug (regression yesterday).
Bruno Haible [Wed, 9 Oct 2024 01:05:33 +0000 (03:05 +0200)]
csharpcomp: Fix memory management bug (regression yesterday).

* lib/csharpcomp.c (compile_csharp_using_sscli): Allocate the source
options with malloc() always, not sometimes with malloca() and sometimes
with malloc().

6 months agocsharpcomp: Improve Cygwin support.
Bruno Haible [Mon, 7 Oct 2024 18:25:06 +0000 (20:25 +0200)]
csharpcomp: Improve Cygwin support.

* lib/csharpcomp.c: Include cygpath.h.
(compile_csharp_using_sscli): Convert the file names passed to 'csc' to
native Windows syntax.
* modules/csharpcomp (Depends-on): Add cygpath.

6 months agocsharpcomp-script: Improve Cygwin support.
Bruno Haible [Mon, 7 Oct 2024 18:20:14 +0000 (20:20 +0200)]
csharpcomp-script: Improve Cygwin support.

* build-aux/csharpcomp.sh.in: Convert the file names passed to 'csc' to
native Windows syntax.

6 months agocsharpexec: Improve Cygwin support.
Bruno Haible [Mon, 7 Oct 2024 18:15:44 +0000 (20:15 +0200)]
csharpexec: Improve Cygwin support.

* lib/csharpexec.c: Include cygpath.h.
(execute_csharp_using_sscli): Convert the first 'clix' argument to
native Windows syntax.
* modules/csharpexec (Depends-on): Add cygpath.

6 months agocsharpexec-script: Improve Cygwin support.
Bruno Haible [Mon, 7 Oct 2024 18:14:04 +0000 (20:14 +0200)]
csharpexec-script: Improve Cygwin support.

* build-aux/csharpexec.sh.in: Convert the first 'clix' argument to
native Windows syntax.

6 months agocygpath: New module.
Bruno Haible [Mon, 7 Oct 2024 18:10:16 +0000 (20:10 +0200)]
cygpath: New module.

* lib/cygpath.h: New file.
* lib/cygpath.c: New file, based on lib/javaversion.c.
* modules/cygpath: New file.

6 months agomntent: Fix syntax error when module 'hasmntopt' is not in use.
Bruno Haible [Mon, 7 Oct 2024 16:58:30 +0000 (18:58 +0200)]
mntent: Fix syntax error when module 'hasmntopt' is not in use.

Reported by Bernhard Voelker <mail@bernhard-voelker.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00039.html>.

* modules/mntent (configure.ac): Invoke gl_MNTENT_H_REQUIRE_DEFAULTS.

6 months agofile-has-acl: Fix test failure on Cygwin.
Bruno Haible [Mon, 7 Oct 2024 12:59:00 +0000 (14:59 +0200)]
file-has-acl: Fix test failure on Cygwin.

* lib/file-has-acl.c (file_has_aclinfo): On Cygwin, don't fail if
acl_get_file (name, ACL_TYPE_DEFAULT) returns NULL on a file of unknown
type.

6 months agofile-has-acl: Fix performance regression on FreeBSD, Cygwin.
Bruno Haible [Mon, 7 Oct 2024 12:30:52 +0000 (14:30 +0200)]
file-has-acl: Fix performance regression on FreeBSD, Cygwin.

* lib/dirent.in.h (_GL_DT_NOTDIR): New macro.
* lib/acl.h (ACL_SYMLINK_FOLLOW): Increase value.
* lib/file-has-acl.c (file_has_aclinfo): Don't call
acl_get_file (name, ACL_TYPE_DEFAULT) if we know that name does not
denote a directory.
(file_has_acl): Extract from *SB the information that NAME is not a
directory.

6 months agofile-has-acl: Fix comments.
Bruno Haible [Mon, 7 Oct 2024 11:52:59 +0000 (13:52 +0200)]
file-has-acl: Fix comments.

* lib/file-has-acl.c (file_has_aclinfo): Fix typo in comment.

6 months agojavacomp, javaversion: Fix resource leak.
Bruno Haible [Sun, 6 Oct 2024 23:14:20 +0000 (01:14 +0200)]
javacomp, javaversion: Fix resource leak.

* lib/javacomp.c (execute_and_read_line): When fdopen fails, terminate
the program.
* lib/javaversion.c (execute_and_read_line): Likewise. When we can't
read a single line, call fclose and wait_subprocess, to free resources.

6 months agomktime: fix daylight default
Paul Eggert [Sat, 5 Oct 2024 16:02:23 +0000 (09:02 -0700)]
mktime: fix daylight default

Problem for FreeBSD 14 reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00026.html
* m4/mktime.m4 (gl_PREREQ_MKTIME): Default daylight to 1, not 0.

7 months agomktime: improve thread-safety
Paul Eggert [Sat, 5 Oct 2024 04:07:09 +0000 (21:07 -0700)]
mktime: improve thread-safety

* lib/mktime.c (__mktime_internal) [!_LIBC]: Double the number of
probes.  Although this isn’t guaranteed to suffice, it should be
good enough for practical applications, and fixing the problem
in general would require access to the underlying tz state lock
which would be hard to do.

7 months agomktime: fix timegm bug that set tmp->tm_isdst
Paul Eggert [Sat, 5 Oct 2024 02:01:30 +0000 (19:01 -0700)]
mktime: fix timegm bug that set tmp->tm_isdst

* lib/timegm.c (__timegm64): Omit now-unnecessary initialization
of tm_isdst.  Anyway, the initialization was always wrong, since
timegm should not modify *TMP when it fails.