Bruno Haible [Wed, 4 Sep 2024 17:38:52 +0000 (19:38 +0200)]
Resolve conflicts for functions introduced in Android API level 35.
Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00024.html>.
* lib/time.in.h (timezone_t, tzalloc, tzfree): Don't require _GNU_SOURCE
to be defined. Define depending on HAVE_TZALLOC, not HAVE_TIMEZONE_T.
(localtime_rz, mktime_z): Likewise. Override if REPLACE_LOCALTIME_RZ or
REPLACE_MKTIME_Z is 1, respectively.
* lib/time_rz.c: If NEED_TIMEZONE_NULL_SUPPORT, define only localtime_rz
and mktime_z and only as wrappers around the system function.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* m4/time_rz.m4 (gl_TIME_RZ): Conditionally set HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Conditionally define
NEED_TIMEZONE_NULL_SUPPORT.
* modules/time-h (Makefile.am): Substitute HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* modules/time_rz (Depends-on, configure.ac): Consider HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Ignore HAVE_TIMEZONE_T.
Bruno Haible [Wed, 4 Sep 2024 08:34:04 +0000 (10:34 +0200)]
Resolve conflicts for functions introduced in Android API level 35.
* m4/strerrorname_np.m4 (gl_FUNC_COPY_FILE_RANGE): Conditionally set
REPLACE_STRERRORNAME_NP.
(gl_CHECK_STRERRORNAME_NP): Test for strerrorname_np using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
Bruno Haible [Sun, 1 Sep 2024 11:09:59 +0000 (13:09 +0200)]
Fix mbscasestr test failure on native Windows with MSVC.
* lib/c32to-impl.h (FUNC): On native Windows, ignore the system's
towlower/towupper function entirely.
* tests/test-c32tolower.c (main): On native Windows, reenable test that
previously failed.
* tests/test-c32toupper.c (main): Likewise. Disable two other tests on
native Windows.
* doc/posix-functions/towlower.texi: Mention bug in the native Windows
UTF-8 locale.
* doc/posix-functions/towupper.texi: Likewise.
Bruno Haible [Tue, 27 Aug 2024 20:50:05 +0000 (22:50 +0200)]
write-any-file: Don't reference an undefined function on native Windows.
* m4/write-any-file.m4 (gl_WRITE_ANY_FILE): Remove test for <priv.h>,
obsolete since 2009-05-03. Test for geteuid.
* lib/write-any-file.c (geteuid): Define a fallback.
Bruno Haible [Tue, 27 Aug 2024 20:28:36 +0000 (22:28 +0200)]
mkdir-p: Don't reference an undefined function on native Windows.
* m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Test whether fchown exists.
* lib/dirchownmod.c (fchown): Define to a fallback if the system does
not have fchown.
(dirchownmod): Test HAVE_FCHOWN.
Bruno Haible [Mon, 26 Aug 2024 19:13:50 +0000 (21:13 +0200)]
Fix compilation errors with clang that masquerades as gcc 13.
Reported by Sam James and Paul Eggert.
* m4/gnulib-common.m4 (gl_COMMON_BODY): For _GL_GNUC_PREREQ, ignore the
values of __GNUC__ and __GNUC_MINOR__ defined by clang.
* lib/warn-on-use.h (_GL_WARN_ON_USE, _GL_WARN_ON_USE_CXX): Don't treat
clang like GCC.
* lib/wchar.in.h (wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr): Disable
the _GL_CXXALIASWARN1 and _GL_CXXALIASWARN invocations for masquerading
clang++.
* build-aux/config.libpath: Accept a second argument. Use it on
FreeBSD/powerpc64.
(func_usage): Document it.
* m4/relocatable.m4 (AC_LIB_LIBPATH): Require gl_HOST_CPU_C_ABI_32BIT.
Pass HOST_CPU_C_ABI_32BIT to the config.libpath script.
* modules/relocatable-prog (Files): Add m4/host-cpu-c-abi.m4.
Paul Eggert [Fri, 23 Aug 2024 20:50:32 +0000 (13:50 -0700)]
diffseq: port to GCC 14.2.1 in ‘patch’
* lib/diffseq.h: Also suppress -Wanalyzer-use-of-uninitialized-value.
This fixes an unwanted diagnostic when compiling GNU ‘patch’
with gcc (GCC) 14.2.1 20240801 (Red Hat 14.2.1-1) x86-64.
Paul Eggert [Thu, 22 Aug 2024 06:00:38 +0000 (23:00 -0700)]
mcel: port to uClibc-ng
Problem reported by Waldemar Brodkorb in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00130.html
* lib/mcel.h (mcel_scan): Don’t treat uClibc-ng like glibc.
Bruno Haible [Fri, 16 Aug 2024 20:07:19 +0000 (22:07 +0200)]
gitsub.sh: For a submodule, merge from the right remote branch.
Reported by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> at
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00101.html>.
* top/gitsub.sh (func_upgrade): For a submodule, use 'git branch' to
determine the branch to merge from, instead of assuming that it is
always the 'master' branch.
Bruno Haible [Fri, 16 Aug 2024 15:57:02 +0000 (17:57 +0200)]
gnulib-tool.py: Don't treat 'valgrind-tests' as a tests module.
Reported by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00093.html>.
* pygnulib/GLModuleSystem.py (_isTestsModuleName): New function.
(GLModuleSystem.list, GLModule.isNonTests, GLModule.getApplicability,
GLModule.getDependencies, GLModule.getAutomakeSnippet_Unconditional,
GLModule.getLicense): Use it.
Bruno Haible [Wed, 14 Aug 2024 14:14:27 +0000 (16:14 +0200)]
tests: Fix link errors (regression 2024-08-12).
* modules/chown-tests (Makefile.am): Link test-chown with LIBINTL.
* modules/lchown-tests (Makefile.am): Link test-lchown with LIBINTL.
* modules/stat-time-tests (Makefile.am): Link test-stat-time with
LIBINTL.
Bruno Haible [Wed, 7 Aug 2024 22:54:03 +0000 (00:54 +0200)]
Avoid compiler warnings in some configure tests.
* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Allocate more room for local
array 'name'.
* m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Don't
pass a NULL pointer to pthread_mutex_timedlock.
Bruno Haible [Wed, 7 Aug 2024 17:53:37 +0000 (19:53 +0200)]
pthread-rwlock: Fix default wait queue behaviour on glibc/Linux.
* lib/pthread.in.h: If REPLACE_PTHREAD_RWLOCK_INIT is 1 but
REPLACE_PTHREAD_RWLOCK_DESTROY is 0, override
PTHREAD_RWLOCK_INITIALIZER.
* lib/pthread-rwlock.c
(pthread_rwlockattr_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function.
(pthread_rwlock_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function.
* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Check for reasonable
pthread_rwlock wait queue handling. Set REPLACE_PTHREAD_RWLOCK_INIT and
REPLACE_PTHREAD_RWLOCKATTR_INIT and define PTHREAD_RWLOCK_BAD_WAITQUEUE
if not.
* modules/pthread-rwlock (configure.ac): Update
GL_COND_OBJ_PTHREAD_RWLOCK condition.
* doc/posix-functions/pthread_rwlock_rdlock.texi: Mark the glibc problem
as fixed.
* doc/posix-functions/pthread_rwlock_tryrdlock.texi: Likewise.
* doc/posix-functions/pthread_rwlock_timedrdlock.texi: Likewise.
* 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.