* lib/windows-mutex.h (glwthread_mutex_t): Add 'owner' field.
* lib/windows-mutex.c: Include <stdlib.h>.
(glwthread_mutex_lock): Set the 'owner' field after entering the
critical section.
(glwthread_mutex_trylock): Detect whether the lock was previously locked
by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_mutex_unlock): Clear the 'owner' field before leaving the
critical section.
* lib/windows-timedmutex.h (glwthread_timedmutex_t): Add 'owner' field.
* lib/windows-timedmutex.c: (glwthread_timedmutex_lock): Set the 'owner'
field after entering the critical section.
(glwthread_timedmutex_trylock): Detect whether the lock was previously
locked by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_timedmutex_unlock): Clear the 'owner' field before leaving
the critical section.
In the shell test framework, an error is either flagged by setting
the shell variable fail=1, or by invoking the fail_ function with an
error diagnostic.
* tests/init.sh (returns_): Change example code in the comment to
use '|| fail=1' properly.
Bruno Haible [Sun, 28 Jul 2024 21:38:45 +0000 (23:38 +0200)]
gnulib-tool.py: Fix an exception message.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Raise error 23,
not 3.
* pygnulib/GLError.py: Provide an error message for error 23.
* pygnulib/main.py: Likewise.
* modules/select (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_select.in.h (select): Don't define to
select_used_without_requesting_gnulib_module_select if the gnulib module
'select' is in use under the same configure.ac.
* modules/shutdown (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (shutdown): Don't define to
shutdown_used_without_requesting_gnulib_module_shutdown if the gnulib
module 'shutdown' is in use under the same configure.ac.
* modules/setsockopt (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (setsockopt): Don't define to
setsockopt_used_without_requesting_gnulib_module_setsockopt if the
gnulib module 'setsockopt' is in use under the same configure.ac.
* modules/sendto (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (sendto): Don't define to
sendto_used_without_requesting_gnulib_module_sendto if the gnulib module
'sendto' is in use under the same configure.ac.
* modules/recvfrom (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (recvfrom): Don't define to
recvfrom_used_without_requesting_gnulib_module_recvfrom if the gnulib
module 'recvfrom' is in use under the same configure.ac.
* modules/send (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (send): Don't define to
send_used_without_requesting_gnulib_module_send if the gnulib module
'send' is in use under the same configure.ac.
* modules/recv (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (recv): Don't define to
recv_used_without_requesting_gnulib_module_recv if the gnulib module
'recv' is in use under the same configure.ac.
* modules/listen (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (listen): Don't define to
listen_used_without_requesting_gnulib_module_listen if the gnulib module
'listen' is in use under the same configure.ac.
* modules/getsockopt (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getsockopt): Don't define to
getsockopt_used_without_requesting_gnulib_module_getsockopt if the
gnulib module 'getsockopt' is in use under the same configure.ac.
* modules/getsockname (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getsockname): Don't define to
getsockname_used_without_requesting_gnulib_module_getsockname if the
gnulib module 'getsockname' is in use under the same configure.ac.
* modules/getpeername (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getpeername): Don't define to
getpeername_used_without_requesting_gnulib_module_getpeername if the
gnulib module 'getpeername' is in use under the same configure.ac.
* modules/bind (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (bind): Don't define to
bind_used_without_requesting_gnulib_module_bind if the gnulib module
'bind' is in use under the same configure.ac.
* modules/accept (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (accept): Don't define to
accept_used_without_requesting_gnulib_module_accept if the gnulib module
'accept' is in use under the same configure.ac.
* modules/connect (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (connect): Don't define to
socket_used_without_requesting_gnulib_module_connect if the gnulib
module 'connect' is in use under the same configure.ac. Fix typo.
* modules/socket (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (socket): Don't define to
socket_used_without_requesting_gnulib_module_socket if the gnulib module
'socket' is in use under the same configure.ac.
* modules/lstat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (lstat): Don't define to
lstat_used_without_requesting_gnulib_module_lstat if the gnulib module
'lstat' is in use under the same configure.ac.
* modules/fstatat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (fstatat): Don't define to
fstatat_used_without_requesting_gnulib_module_fstatat if the gnulib
module 'fstatat' is in use under the same configure.ac.
* modules/fstat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (fstat): Don't define to
fstat_used_without_requesting_gnulib_module_fstat if the gnulib module
'fstat' is in use under the same configure.ac.
* modules/stat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (stat): Don't define to
stat_used_without_requesting_gnulib_module_stat if the gnulib module
'stat' is in use under the same configure.ac.
* modules/ioctl (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_ioctl.in.h (ioctl): Don't define to
ioctl_used_without_requesting_gnulib_module_ioctl if the gnulib module
'ioctl' is in use under the same configure.ac.
* modules/localeconv (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/locale.in.h (localeconv): Don't define to
localeconv_used_without_requesting_gnulib_module_localeconv if the
gnulib module 'localeconv' is in use under the same configure.ac.
* modules/gethostname (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/unistd.in.h (gethostname): Don't define to
gethostname_used_without_requesting_gnulib_module_gethostname if the
gnulib module 'gethostname' is in use under the same configure.ac.
Reported by Frédéric at <https://savannah.gnu.org/bugs/?65958>.
* modules/close (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/unistd.in.h (close): Don't define to
close_used_without_requesting_gnulib_module_close if the gnulib module
'close' is in use under the same configure.ac.
Bruno Haible [Tue, 23 Jul 2024 10:40:37 +0000 (12:40 +0200)]
strtod: Revisit underflow behaviour.
* doc/posix-functions/strtod.texi: Mention the macOS bug. Mention that
gradual underflow does not count as an error on Cygwin 2.9 and MSVC.
* m4/strtod.m4 (gl_FUNC_STRTOD): Update comment.
* tests/test-strtod.h (test_function): Add a gradual underflow test.
Check the sign in case of flush-to-zero underflow.
Bruno Haible [Tue, 23 Jul 2024 10:40:33 +0000 (12:40 +0200)]
strtof: Revisit underflow behaviour.
* doc/posix-functions/strtof.texi: Mention the macOS bug. Mention the
mingw overflow bug. Mention the underflow bugs on Cygwin 2.9 and mingw.
Mention that gradual underflow does not count as an error on Cygwin 2.9,
mingw, MSVC.
* m4/strtof.m4 (gl_FUNC_STRTOF): Test against the mingw overflow bug.
* tests/test-strtof.h (test_function): Add a gradual underflow test.
Check the sign in case of flush-to-zero underflow.
Bruno Haible [Tue, 23 Jul 2024 10:40:19 +0000 (12:40 +0200)]
strtof, strtod, strtold: Fix underflow behaviour of system function.
* m4/strtof.m4 (gl_FUNC_STRTOF): Test for strtof's behaviour upon
underflow. Conditionally define STRTOF_HAS_UNDERFLOW_BUG,
STRTOF_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* m4/strtod.m4 (gl_FUNC_STRTOD): Test for strtod's behaviour upon
underflow. Conditionally define STRTOD_HAS_UNDERFLOW_BUG,
STRTOD_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* m4/strtold.m4 (gl_FUNC_STRTOLD): Test for strtold's behaviour upon
gradual underflow. Conditionally define
STRTOLD_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* lib/strtod.c (HAVE_UNDERLYING_STRTOD): Test STRTOF_HAS_UNDERFLOW_BUG,
STRTOD_HAS_UNDERFLOW_BUG.
(HAS_GRADUAL_UNDERFLOW_PROBLEM): New macro.
(SET_ERRNO_UPON_GRADUAL_UNDERFLOW): New macro.
(STRTOD): Use it.
Bruno Haible [Sun, 21 Jul 2024 12:02:58 +0000 (14:02 +0200)]
bootstrap: Avoid failure when gnulib-tool removed gettext.m4.
* top/bootstrap-funclib.sh (autogen): When gnulib-tool has removed
gettext.m4 but the package needs gettext.m4, repeat the autopoint and
gnulib-tool invocations.
* build-aux/bootstrap: Regenerated.
Paul Eggert [Mon, 15 Jul 2024 21:14:55 +0000 (14:14 -0700)]
strnlen: port to Android 5.0 (API 21)
This is needed for GNU Emacs, which attempts to port to these
old Android versions.
* m4/strnlen.m4 (AC_FUNC_STRNLEN): Replace if Autoconf 2.72 or
earlier, with code that detects the Android problem with strnlen.
This version works around some further bugs in the test, notably,
misplaced 'volatile' and need for volatile in the AIX 4.3 bug
check too.
Bruno Haible [Mon, 15 Jul 2024 12:48:41 +0000 (14:48 +0200)]
qcopy-acl: Fix copying of ACLs on CentOS 7 (regression 2023-01-12).
* lib/qcopy-acl.c: Include <string.h>, <linux/xattr.h>.
(XATTR_NAME_NFSV4_ACL, XATTR_NAME_POSIX_ACL_ACCESS,
XATTR_NAME_POSIX_ACL_DEFAULT): New macros, from file-has-acl.c.
(is_attr_permissions): Test for these names explicitly.
* m4/acl.m4 (gl_QCOPY_ACL): New macro.
* modules/qcopy-acl (Files): Add m4/acl.m4.
(configure.ac): Invoke gl_QCOPY_ACL.
Bruno Haible [Sun, 14 Jul 2024 16:38:16 +0000 (18:38 +0200)]
strtold: Work around major mingw bugs.
* lib/strtod.c (HAVE_UNDERLYING_STRTOD) [USE_LONG_DOUBLE]: Set to 0 on
mingw versions before 10.0.
* doc/posix-functions/strtold.texi: Mention the mingw bugs.
Bruno Haible [Sun, 30 Jun 2024 21:10:41 +0000 (23:10 +0200)]
zprintf-gnu: Add tests.
* tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
* tests/test-zprintf-gnu.sh: New file, based on
tests/test-printf-gnu.sh.
* modules/zprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 21:04:37 +0000 (23:04 +0200)]
vzprintf-gnu: Add tests.
* tests/test-printf-gnu.h (test_function): Use RETTYPE instead of 'int'.
* tests/test-printf-gnu.c (RETTYPE): New macro.
* tests/test-vprintf-gnu.c (RETTYPE): New macro.
* tests/test-vzprintf-gnu.c: New file, based on
tests/test-vprintf-gnu.c.
* tests/test-vzprintf-gnu.sh: New file, based on
tests/test-vprintf-gnu.sh.
* modules/vzprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 20:56:15 +0000 (22:56 +0200)]
fzprintf-gnu: Add tests.
* tests/test-fzprintf-gnu.c: New file, based on
tests/test-fprintf-gnu.c.
* tests/test-fzprintf-gnu.sh: New file, based on
tests/test-fprintf-gnu.sh.
* modules/fzprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 20:42:20 +0000 (22:42 +0200)]
vfzprintf-gnu: Add tests.
* tests/test-vfzprintf-gnu.c: New file, based on
tests/test-vfprintf-gnu.c.
* tests/test-vfzprintf-gnu.sh: New file, based on
tests/test-vfprintf-gnu.sh.
* tests/test-fprintf-gnu.h: Update title.
* modules/vfzprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 20:23:45 +0000 (22:23 +0200)]
zprintf-posix: Add tests.
* tests/test-zprintf-posix.c: New file, based on
tests/test-printf-posix.c.
* tests/test-zprintf-posix.sh: New file, based on
tests/test-printf-posix.sh.
* modules/zprintf-posix-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 20:12:41 +0000 (22:12 +0200)]
vzprintf-posix: Add tests.
* tests/test-printf-posix.h (test_function): Use RETTYPE instead of
'int'.
* tests/test-printf-posix.c (RETTYPE): New macro.
* tests/test-vprintf-posix.c (RETTYPE): New macro.
* tests/test-xprintf-posix.c (RETTYPE): New macro.
* tests/test-vzprintf-posix.c: New file, based on
tests/test-vprintf-posix.c.
* tests/test-vzprintf-posix.sh: New file, based on
tests/test-vprintf-posix.sh.
* modules/vzprintf-posix-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 19:55:13 +0000 (21:55 +0200)]
fzprintf-posix: Add tests.
* tests/test-fzprintf-posix.c: New file, based on
tests/test-fprintf-posix.c.
* tests/test-fzprintf-posix.sh: New file, based on
tests/test-fprintf-posix.sh.
* modules/fzprintf-posix-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 19:17:03 +0000 (21:17 +0200)]
vfzprintf-posix: Add tests.
* tests/test-vfzprintf-posix.c: New file, based on
tests/test-vfprintf-posix.c.
* tests/test-vfzprintf-posix.sh: New file, based on
tests/test-vfprintf-posix.sh.
* tests/test-fprintf-posix.h: Update title.
* modules/vfzprintf-posix-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 16:31:56 +0000 (18:31 +0200)]
vfzprintf: New module.
* lib/stdio.in.h (vfzprintf): New declaration.
* lib/vfzprintf.c: New file, based on lib/vfprintf.c and
lib/vdzprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VFZPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VFZPRINTF.
* modules/vfzprintf: New file.
Bruno Haible [Sun, 30 Jun 2024 15:43:45 +0000 (17:43 +0200)]
dzprintf-gnu: Add tests.
* tests/test-dprintf-gnu.h: New file, extracted from
tests/test-dprintf-gnu.c.
* tests/test-dprintf-gnu.c: Include it.
(test_function): Remove function.
* modules/dprintf-gnu-tests (Files): Add it.
* tests/test-dzprintf-gnu.c: New file, based on
tests/test-dprintf-gnu.c.
* tests/test-dzprintf-gnu.sh: New file, based on
tests/test-dprintf-gnu.sh.
* modules/dzprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 15:29:44 +0000 (17:29 +0200)]
vdzprintf-gnu: Add tests.
* tests/test-fprintf-gnu.h (test_function): Use RETTYPE instead of
'int'.
* tests/test-fprintf-gnu.c (RETTYPE): New macro.
* tests/test-vdprintf-gnu.c (RETTYPE): New macro.
* tests/test-vfprintf-gnu.c (RETTYPE): New macro.
* tests/test-vdzprintf-gnu.c: New file, based on
tests/test-vdzprintf-posix.c.
* tests/test-vdzprintf-gnu.sh: New file, based on
tests/test-vdzprintf-posix.sh.
* modules/vdzprintf-gnu-tests: New file.
Bruno Haible [Sun, 30 Jun 2024 15:25:46 +0000 (17:25 +0200)]
dzprintf-posix: Add tests.
* tests/test-dprintf-posix.h: New file, extracted from
tests/test-dprintf-posix.c.
* tests/test-dprintf-posix.c: Include it. Don't include infinity.h.
(test_function): Remove function.
* modules/dprintf-posix-tests (Files): Add it.
* tests/test-dzprintf-posix.c: New file, based on
tests/test-dprintf-posix.c.
* tests/test-dzprintf-posix.sh: New file, based on
tests/test-dprintf-posix.sh.
* modules/dzprintf-posix-tests: New file.
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.