Bruno Haible [Sun, 30 Jun 2024 15:21:04 +0000 (17:21 +0200)]
vdzprintf-posix: Add tests.
* tests/test-fprintf-posix.h (test_function): Use RETTYPE instead of
'int'.
* tests/test-fprintf-posix.c (RETTYPE): New macro.
* tests/test-vdprintf-posix.c (RETTYPE): New macro.
* tests/test-vfprintf-posix.c (RETTYPE): New macro.
* tests/test-xfprintf-posix.c (RETTYPE): New macro.
* tests/test-vdzprintf-posix.c: New file, based on
tests/test-vdprintf-posix.c.
* tests/test-vdzprintf-posix.sh: New file, based on
tests/test-vdprintf-posix.sh.
* modules/vdzprintf-posix-tests: New file.
Paul Eggert [Sun, 30 Jun 2024 10:27:48 +0000 (11:27 +0100)]
strnlen: avoid undefined memcmp behavior
Problem reported by Po Lu in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00288.html
* config/srclist.txt: Don’t mention strnlen.c even in a comment,
as the Gnulib and glibc implementations have diverged for
portability reasons, and they’re never likely to merge.
* lib/strnlen.c (strnlen): Avoid undefined behavior if
the array S points to has fewer than MAXLEN bytes.
Jim Meyering [Sat, 29 Jun 2024 22:08:19 +0000 (15:08 -0700)]
bootstrap-funclib.sh: shrink or split too-long lines
* top/bootstrap-funclib.sh: The generated bootstrap file had lines
lines that triggered a syntax-check failure. Sure, I could have
exempted this file, but it was easy to comply. Besides, this also
fixed a quoting bug in the event that ${GNULIB_URL:-$default_gnulib_url}
had a value requiring double quotes.
* build-aux/bootstrap: Regenerate.
Bruno Haible [Sat, 29 Jun 2024 11:28:14 +0000 (13:28 +0200)]
tests: Avoid test failures due to VirtualBox specific bug.
* tests/virtualbox.h: New file.
* tests/test-pthread-cond.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* tests/test-cnd.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* tests/test-cond.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* tests/test-pthread_sigmask1.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* tests/test-pthread_sigmask2.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* tests/test-sigprocmask.c: Include virtualbox.h.
(main): Skip the test under VirtualBox with KVM paravirtualization and
more than 1 CPU.
* modules/pthread-cond-tests (Files): Add tests/virtualbox.h.
* modules/cnd-tests (Files): Likewise.
* modules/cond-tests (Files): Likewise.
* modules/pthread_sigmask-tests (Files): Likewise.
* modules/sigprocmask-tests (Files): Likewise.
Bruno Haible [Fri, 28 Jun 2024 20:15:23 +0000 (22:15 +0200)]
cond tests: Avoid theoretically possible failure.
* tests/test-cnd.c (cnd_wait_routine, cnd_timedwait_routine): Report to
the main thread if this thread comes too late.
(test_cnd_wait, test_cnd_timedwait): Return a 'skipped' value.
(main): Print SKIP instead of OK if the essence of the test was skipped.
* tests/test-cond.c (cond_routine, timedcond_routine): Report to the
main thread if this thread comes too late.
(test_cond, test_timedcond): Return a 'skipped' value.
(main): Print SKIP instead of OK if the essence of the test was skipped.
* tests/test-pthread-cond.c (pthread_cond_wait_routine,
pthread_cond_timedwait_routine): Report to the main thread if this
thread comes too late.
(test_pthread_cond_wait, test_pthread_cond_timedwait): Return a
'skipped' value.
(main): Print SKIP instead of OK if the essence of the test was skipped.
Paul Eggert [Wed, 26 Jun 2024 16:16:06 +0000 (17:16 +0100)]
strnlen: document Android bug
* doc/posix-functions/strnlen.texi (strnlen):
Mention Android 5.0 bug reported by Po Lu in this thread:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00271.html
Collin Funk [Wed, 26 Jun 2024 04:39:50 +0000 (21:39 -0700)]
idpriv-droptemp: Handle large user and group ids.
* lib/idpriv-droptemp.c (saved_uid): Use uid_t instead of int.
(saved_gid): Use gid_t instead of int.
(idpriv_temp_drop): Use uid_t and gid_t instead of int.
(idpriv_temp_restore): Likewise.
Bruno Haible [Tue, 25 Jun 2024 23:05:05 +0000 (01:05 +0200)]
c-vazsprintf-gnu: Add tests.
* tests/test-vazsprintf-gnu.h: New file, extracted from
tests/test-vazsprintf-gnu.c.
* tests/test-vazsprintf-gnu.c: Include test-vazsprintf-gnu.h.
(test_function): Moved out to tests/test-vazsprintf-gnu.h.
* modules/vazsprintf-gnu-tests (Files): Add tests/test-vazsprintf-gnu.h.
* tests/test-c-vazsprintf-gnu.c: New file.
* tests/test-c-vazsprintf-gnu.sh: New file, based on
tests/test-c-snprintf.sh.
* modules/c-vazsprintf-gnu-tests: New file.
Bruno Haible [Tue, 25 Jun 2024 23:04:43 +0000 (01:04 +0200)]
c-zsnprintf-gnu: Add tests.
* tests/test-c-zsnprintf-gnu.c: New file.
* tests/test-c-zsnprintf-gnu.sh: New file, based on
tests/test-c-snprintf.sh.
* modules/c-zsnprintf-gnu-tests: New file.
Bruno Haible [Tue, 25 Jun 2024 23:04:02 +0000 (01:04 +0200)]
c-vzsnprintf-gnu: Add tests.
* tests/test-c-vzsnprintf-gnu.c: New file, based on
tests/test-vzsnprintf-gnu.c.
* tests/test-c-vzsnprintf-gnu.sh: New file, based on
tests/test-c-snprintf.sh.
* modules/c-vzsnprintf-gnu-tests: New file.
Bruno Haible [Tue, 25 Jun 2024 17:27:42 +0000 (19:27 +0200)]
c-vasnprintf: Add tests.
* tests/test-c-vasnprintf.c: New file, based on tests/test-c-snprintf.c.
* tests/test-c-vasnprintf.sh: New file, based on
tests/test-c-snprintf.sh.
* modules/c-vasnprintf-tests: New file.
Bruno Haible [Tue, 25 Jun 2024 14:40:28 +0000 (16:40 +0200)]
vzsprintf-gnu: Add tests.
* tests/test-vzsprintf-gnu.c: New file.
* tests/test-zsprintf-gnu.h: New file, based on
tests/test-zsnprintf-gnu.h.
* modules/vzsprintf-gnu-tests: New file.
Bruno Haible [Tue, 25 Jun 2024 14:38:11 +0000 (16:38 +0200)]
vzsnprintf-gnu: Add tests.
* tests/test-vzsnprintf-gnu.c: New file.
* tests/test-zsnprintf-gnu.h: New file, based on
tests/test-snprintf-gnu.h.
* modules/vzsnprintf-gnu-tests: New file.
Bruno Haible [Mon, 24 Jun 2024 23:09:49 +0000 (01:09 +0200)]
vzsprintf-posix: Add tests.
* tests/test-vzsprintf-posix.c: New file.
* tests/test-zsprintf-posix.h: New file, based on
tests/test-zsnprintf-posix.h.
* modules/vzsprintf-posix-tests: New file.
Bruno Haible [Mon, 24 Jun 2024 23:09:28 +0000 (01:09 +0200)]
vzsnprintf-posix: Add tests.
* tests/test-vzsnprintf-posix.c: New file.
* tests/test-zsnprintf-posix.h: New file, based on
tests/test-snprintf-posix.h.
* modules/vzsnprintf-posix-tests: New file.
Bruno Haible [Mon, 24 Jun 2024 18:11:48 +0000 (20:11 +0200)]
c-vasnprintf: Relicense under LGPLv2+.
* lib/c-vasnprintf.h: Rebase on lib/vasnprintf.h.
* lib/c-vasnprintf.c: Rebase on lib/unistdio/ulc-vasnprintf.c.
* modules/c-vasnprintf (License): Change to LGPLv2+.
Bruno Haible [Sat, 22 Jun 2024 20:02:53 +0000 (22:02 +0200)]
obstack-zprintf: Add more tests.
* tests/test-obstack-zprintf-big.c: New file, based on
tests/test-vasnprintf-big.c.
* modules/obstack-zprintf-extra-tests: New file.
* modules/obstack-zprintf-tests (Depends-on): Add it.
Bruno Haible [Sat, 22 Jun 2024 19:59:50 +0000 (21:59 +0200)]
obstack-zprintf: Add tests.
* tests/test-obstack-printf.h: New file, based on
tests/test-obstack-printf.c.
* tests/test-obstack-printf.c: Include test-obstack-printf.h.
(obstack_chunk_alloc, obstack_chunk_free, test_function): Moved to
tests/test-obstack-printf.h.
(test_obstack_vprintf, test_obstack_printf): Remove functions.
(main): Inline them here.
* tests/test-obstack-zprintf.c: New file, based on
tests/test-obstack-printf.c.
* modules/obstack-printf-tests (Files): Add tests/test-obstack-printf.h.
* modules/obstack-zprintf-tests: New file.
Bruno Haible [Sat, 22 Jun 2024 10:21:51 +0000 (12:21 +0200)]
c-vasprintf: Make return convention consistent with other modules.
* lib/c-vasprintf.h (c_asprintf, c_vasprintf): Add specification.
* lib/c-asprintf.c: Replaced with code based on lib/asprintf.c.
* lib/c-vasprintf.c: Replaced with code based on lib/vasprintf.c.
* modules/c-vasprintf (Depends-on): Add stdint.
(License): Change to LGPLv2+.
Bruno Haible [Sat, 22 Jun 2024 10:21:46 +0000 (12:21 +0200)]
c-vazsprintf: New module.
* lib/c-vasprintf.h: Change license to LGPLv2+.
Include <stddef.h>.
(c_azsprintf, c_vazsprintf): New declarations.
* lib/c-azsprintf.c: New file, based on lib/azsprintf.c.
* lib/c-vazsprintf.c: New file, based on lib/vazsprintf.c.
* modules/c-vazsprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:21:29 +0000 (12:21 +0200)]
c-zsnprintf: New module.
* lib/c-snprintf.h: Change license to LGPLv2+.
(c_zsnprintf): New declaration.
* lib/c-zsnprintf.c: New file, based on lib/zsnprintf.c.
* modules/c-zsnprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:21:11 +0000 (12:21 +0200)]
c-vzsnprintf: New module.
* lib/c-vsnprintf.h: Change license to LGPLv2+.
(c_vzsnprintf): New declaration.
* lib/c-vzsnprintf.c: New file, based on lib/vzsnprintf.c.
* modules/c-vzsnprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:17:51 +0000 (12:17 +0200)]
xvasprintf: Guarantee a non-NULL result.
* lib/xvasprintf.h: Clarify the programmer's responsibilities.
(xasprintf, xvasprintf): Declare as returning non-NULL.
* lib/xvasprintf.c: Include <stdlib.h>.
(xstrcat): Allow results longer than INT_MAX characters. Upon size
overflow, invoke xalloc_die.
(xvasprintf): Call vazsprintf instead of vasprintf. When some other
error occurs, emit an error message and abort.
* m4/strerrorname_np.m4 (gl_CHECK_STRERRORNAME_NP): New macro, extracted
from gl_FUNC_STRERRORNAME_NP.
(gl_FUNC_STRERRORNAME_NP): Invoke it.
(gl_OPTIONAL_STRERRORNAME_NP): New macro.
* m4/xvasprintf.m4 (gl_XVASPRINTF): Invoke gl_OPTIONAL_STRERRORNAME_NP.
* modules/xvasprintf (Files): Add m4/strerrorname_np.m4.
(Depends-on): Add extensions, vazsprintf. Remove vasprintf.
* NEWS: Mention the change.
Bruno Haible [Sat, 22 Jun 2024 10:17:10 +0000 (12:17 +0200)]
vasprintf: Make return convention consistent with other modules.
* lib/vasprintf.c: Include <stdint.h>.
(vasprintf): If the length is > PTRDIFF_MAX, fail with ENOMEM, not
EOVERFLOW.
* modules/vasprintf (Depends-on): Add stdint.
Bruno Haible [Sat, 22 Jun 2024 10:17:02 +0000 (12:17 +0200)]
vazsprintf: New module.
* lib/stdio.in.h (azsprintf, vazsprintf): New declarations.
* lib/vazsprintf.c: New file, based on lib/vasprintf.c.
* lib/azsprintf.c: New file, based on lib/asprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VAZSPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VAZSPRINTF.
* modules/vazsprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:16:24 +0000 (12:16 +0200)]
zsprintf: New module.
* lib/stdio.in.h (zsprintf): New declaration, based on
lib/sprintf.c.
* lib/zsprintf.c: New file, based on lib/sprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_ZSPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_ZSPRINTF.
* modules/zsprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:16:00 +0000 (12:16 +0200)]
vzsprintf: New module.
* lib/stdio.in.h (vzsprintf): New declaration, based on
lib/vsprintf.c.
* lib/vzsprintf.c: New file, based on lib/vsprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VZSPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VZSPRINTF.
* modules/vzsprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:15:32 +0000 (12:15 +0200)]
zsnprintf: New module.
* lib/stdio.in.h (zsnprintf): New declaration, based on
lib/snprintf.c.
* lib/zsnprintf.c: New file, based on lib/snprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_ZSNPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_ZSNPRINTF.
* modules/zsnprintf: New file.
Bruno Haible [Sat, 22 Jun 2024 10:14:41 +0000 (12:14 +0200)]
vzsnprintf: New module.
* lib/stdio.in.h (vzsnprintf): New declaration, based on
lib/vsnprintf.c.
* lib/vzsnprintf.c: New file, based on lib/vsnprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VZSNPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VZSNPRINTF.
* modules/vzsnprintf: New file.