Bruno Haible [Wed, 28 Aug 2024 12:16:08 +0000 (14:16 +0200)]
libgmp-mpz: New module, renamed from libgmp.
* modules/libgmp-mpz: Renamed from modules/libgmp.
* modules/libgmp: New file.
* modules/libgmp-mpz-tests: Renamed from modules/libgmp-tests.
* tests/test-libgmp-mpz.c: Renamed from tests/test-libgmp.c.
Paul Eggert [Tue, 27 Aug 2024 21:39:59 +0000 (14:39 -0700)]
savewd: port to native MS-Windows
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00187.html
* lib/savewd.c (fork) [_WIN32 && !__CYGWIN]: New macro.
(savewd_save): Don’t fork on MS-Windows, or if O_SEARCH != O_RDONLY.
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++.
Paul Eggert [Sun, 25 Aug 2024 22:18:45 +0000 (15:18 -0700)]
diffseq: don’t worry about clang
* lib/diffseq.h: Stop worrying about __clang__ for pragmas.
This basically reverts the previous change to this file.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00145.html
Bruno Haible [Sat, 24 Aug 2024 18:52:28 +0000 (20:52 +0200)]
copy-file: Add functions for copying non-confidential files.
Reported by Patrice Dumas <pertusus@free.fr> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00142.html>.
* lib/copy-file.h (copy_file_to, xcopy_file_to): New declarations.
* lib/copy-file.c (copy_file_internal): New function, extracted from
qcopy_file_preserving.
(qcopy_file_preserving): Invoke it.
(copy_file_to): New function.
(handle_error_code): New function, extracted from xcopy_file_preserving.
(xcopy_file_preserving): Invoke it.
(xcopy_file_to): New function.
Bruno Haible [Sat, 24 Aug 2024 15:59:26 +0000 (17:59 +0200)]
copy-file: First step towards more consistent function names.
* lib/copy-file.h (xcopy_file_preserving): New declaration.
(copy_file_preserving): Mark deprecated.
* lib/copy-file.c (xcopy_file_preserving): Renamed from
copy_file_preserving.
(copy_file_preserving): New function.
* tests/test-copy-file.c (main): Test xcopy_file_preserving instead of
copy_file_preserving.
Bruno Haible [Sat, 24 Aug 2024 15:58:48 +0000 (17:58 +0200)]
acl: First step towards more consistent function names.
* lib/acl.h (xset_acl): New declaration.
(set_acl): Mark deprecated.
(xcopy_acl): New declaration.
(copy_acl): Mark deprecated.
* lib/set-acl.c (xset_acl): Renamed from set_acl.
(set_acl): New function.
* lib/copy-acl.c (xcopy_acl): Renamed from copy_acl.
(copy_acl): New function.
* tests/test-set-mode-acl.c (main): Test xset_acl instead of set_acl.
* tests/test-copy-acl.c (main): Test xcopy_acl instead of copy_acl.
* 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.
Bruno Haible [Fri, 23 Aug 2024 17:01:55 +0000 (19:01 +0200)]
host-cpu-c-abi: Update comment, working around FreeBSD breakage.
* m4/host-cpu-c-abi.m4: For powerpc64, recommend to test
__BIG_ENDIAN__ or __LITTLE_ENDIAN__, not _BIG_ENDIAN or _LITTLE_ENDIAN,
as FreeBSD 14 breaks the latter.
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 [Mon, 19 Aug 2024 11:46:02 +0000 (13:46 +0200)]
mntent: New module.
* lib/mntent.in.h: New file.
* m4/mntent_h.m4: New file.
* modules/mntent: New file.
* doc/glibc-headers/mntent.texi: Mention the new module.
* top/maint.mk (gl_prefer_angle_bracket_headers_): Add mntent.h.
* doc/gnulib-tool.texi (Style of #include statements): Add mntent.h to
the list.
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.
Paul Eggert [Thu, 15 Aug 2024 03:04:42 +0000 (20:04 -0700)]
verror: allow library name-spacing of verror
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00085.html
* lib/error.c (verror, verror_at_line) [!_LIBC]: #undef only if
the corresponding GNULIB_defined_... macros are defined.
* lib/error.in.h (verror, verror_with_line):
Don't define as macros if they are already defined, or if
_GL_NO_INLINE_ERROR is defined. This may lose some niceties with GCC
warnings, but the code’s valid.
Paul Eggert [Thu, 15 Aug 2024 01:03:54 +0000 (18:03 -0700)]
error: merge from glibc and with verror
* lib/error.c: Merge changes since 2018 from glibc.
----- The following changes are taken from glibc:
(__error_internal, __error_at_line_internal): New functions,
with most of the old error and error_at_line_internal but
with va_list and with a new trailing mode_args,
for wide character mode.
(error_tail): Add trailing arg.
(error_tail, __error_internal, __error_at_line_internal):
Redo _LIBC implementation with respect to cancelation.
[_LIBC]: Include <libc-lock.h>, not <bits/libc-lock.h>.
----- The following changes are specific to Gnulib:
(__error_internal, __error_at_line_internal, error_tail) [!_LIBC]:
Use macros to define away the new trailing arg, and to name
the internal functions to verror and verror_at_line.
(verror, verror_at_line) [!_LIBC]: Undef so that we omit
the __gl_error_call business when defining these functions.
* lib/error.in.h: Include stdarg.h.
(verror, verror_at_line): New decls and macros.
* m4/error_h.m4 ([gl_ERROR_H]): Always compile error.c if
the verror module is also present.
* modules/verror (Files, lib_SOURCES):
Remove lib/verror.h, lib/verror.c.
(Depends-on): Remove stdio, xvasprintf.
(configure.ac-early): Define gl_HAVE_MODULE_VERROR so that
the error module compiles error.c. Not sure if this is the
standard way to do this, but it seems to work.
* modules/verror (Include), tests/test-verror.c:
Include error.h, not verror.h.
Paul Eggert [Wed, 14 Aug 2024 21:06:05 +0000 (14:06 -0700)]
error: it’s cold
This mimics what glibc is doing nowadays.
* lib/error.in.h (error, error_at_line):
* lib/verror.h (verror, verror_at_line):
Declare with _GL_ATTRIBUTE_CODE.
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.
Collin Funk [Tue, 13 Aug 2024 03:09:01 +0000 (20:09 -0700)]
termios: Define struct winsize on all platforms.
* doc/posix-headers/termios.texi (termios.h): Mention struct winsize is
defined in <sys/ioctl.h> on glibc.
* lib/termios.in.h (struct winsize): Define or include.
* m4/termios_h.m4 (gl_TERMIOS_H): Check for a definition of struct
winsize.
* modules/termios (Makefile.am): Replace AC_SUBST variables.
Bruno Haible [Mon, 12 Aug 2024 15:11:35 +0000 (17:11 +0200)]
errno: Ensure ESOCKTNOSUPPORT gets defined.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also whether ESOCKTNOSUPPORT
is defined.
* lib/errno.in.h (ESOCKTNOSUPPORT, GNULIB_defined_ESOCKTNOSUPPORT): New
macros.
* lib/strerror-override.h (strerror_override): Declare also if
GNULIB_defined_ESOCKTNOSUPPORT is defined.
* lib/strerror-override.c (strerror_override): Handle ESOCKTNOSUPPORT.
* lib/strerrorname_np.c (strerrorname_np): Move ESOCKTNOSUPPORT code to
the POSIX section.
* doc/posix-headers/errno.texi: Document the Haiku problem.
Collin Funk [Sun, 11 Aug 2024 20:53:48 +0000 (13:53 -0700)]
htonl: Fix link errors on Windows.
Reported by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00066.html>.
* lib/arpa_inet.in.h (htons, htonl, ntohs, ntohl): Only define when not
declared by the system.
* m4/arpa_inet_h.m4 (gl_ARPA_INET_H_DEFAULTS): Set default behavior for
htonl functions.
* m4/htonl.m4 (gl_FUNC_HTONL): Check if -lws2_32 is required. Only check
for declarations on POSIX systems.
* modules/arpa_inet (Makefile.am): Substitute new Makefile variables.
* modules/htonl (Files): Add m4/sys_socket_h.m4.
(Depends-on): Remove endian condition.
(Link): Add $(HOTNL_LIB).
* modules/htonl-tests: Link to @HTONL_LIB@.
Paul Eggert [Sun, 11 Aug 2024 04:47:07 +0000 (21:47 -0700)]
test-fdutimensat: fix newly-added test
Problem reported by Bruno Haible and Collin Funk in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00061.html
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00064.html
* tests/test-utimens.h (test_utimens): Fix typo in new test,
which causes the test to break on file systems that are not noatime.
Paul Eggert [Fri, 9 Aug 2024 21:33:31 +0000 (14:33 -0700)]
full-read, etc.: prefer signed types
* lib/full-read.h, lib/full-write.h, lib/safe-read.h, lib/safe-write.h:
Include idx.h.
* lib/full-write.c (full_read, full_write):
Now accept and returns idx_t.
* lib/safe-read.c (bufptr): New type, since apps are not
supposed to #define keywords like ‘const’.
(safe_read, safe_write): Now accept idx_t and return ptrdiff_t.
* lib/safe-read.h (SAFE_READ_ERROR):
* lib/safe-write.h (SAFE_WRITE_ERROR):
Now ptrdiff_t, not size_t.
* modules/full-read, modules/full-write, modules/safe-read:
* modules/safe-write (Depends-on): Add idx.
Bruno Haible [Fri, 9 Aug 2024 00:09:03 +0000 (02:09 +0200)]
doc: Update for other functions added in POSIX:2024.
* doc/posix-functions/be16toh.texi: New file.
* doc/posix-functions/be32toh.texi: New file.
* doc/posix-functions/be64toh.texi: New file.
* doc/posix-functions/dcgettext_l.texi: New file.
* doc/posix-functions/dcngettext_l.texi: New file.
* doc/posix-functions/dgettext_l.texi: New file.
* doc/posix-functions/dngettext_l.texi: New file.
* doc/posix-functions/getlocalename_l.texi: New file.
* doc/posix-functions/gettext_l.texi: New file.
* doc/posix-functions/htobe16.texi: New file.
* doc/posix-functions/htobe32.texi: New file.
* doc/posix-functions/htobe64.texi: New file.
* doc/posix-functions/htole16.texi: New file.
* doc/posix-functions/htole32.texi: New file.
* doc/posix-functions/htole64.texi: New file.
* doc/posix-functions/le16toh.texi: New file.
* doc/posix-functions/le32toh.texi: New file.
* doc/posix-functions/le64toh.texi: New file.
* doc/posix-functions/ngettext_l.texi: New file.
* doc/posix-functions/posix_close.texi: New file.
* doc/posix-functions/posix_devctl.texi: New file.
* doc/posix-functions/posix_getdents.texi: New file.
* doc/posix-functions/posix_spawn_file_actions_addchdir.texi: New file.
* doc/posix-functions/posix_spawn_file_actions_addfchdir.texi: New file.
* doc/posix-functions/sig2str.texi: New file.
* doc/posix-functions/str2sig.texi: New file.
* doc/posix-functions/tcgetwinsize.texi: New file.
* doc/posix-functions/tcsetwinsize.texi: New file.
* doc/posix-functions/wcslcat.texi: New file.
* doc/posix-functions/wcslcpy.texi: New file.
* doc/gnulib.texi (Functions in <devctl.h>, Functions in <endian.h>):
New sections.
(Functions in <dirent.h>, Functions in <libintl.h>,
Functions in <locale.h>, Functions in <signal.h>,
Functions in <spawn.h>, Functions in <termios.h>,
Functions in <unistd.h>, Functions in <wchar.h>): Include the other new
files.
* doc/posix-functions/strlcat.texi: Update.
* doc/posix-functions/strlcpy.texi: Update.
Bruno Haible [Thu, 8 Aug 2024 22:15:16 +0000 (00:15 +0200)]
doc: Update for ISO C functions added in POSIX:2024.
* doc/posix-headers/CMPLX*.texi: New files.
* doc/posix-headers/at_quick_exit.texi: New file.
* doc/posix-headers/atomic_*.texi: New files.
* doc/posix-headers/kill_dependency.texi: New file.
* doc/posix-headers/*.texi: Update.
* doc/gnulib.texi (Functions in <stdatomic.h>): New section.
(Functions in <complex.h>, Functions in <stdlib.h>): Include the other
new files.
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:41 +0000 (19:53 +0200)]
pthread-rwlock tests: Strengthen tests.
* tests/test-pthread-rwlock-waitqueue.c: New file.
* modules/pthread-rwlock-tests (Files): Add it.
(Depends-on): Add extensions, nanosleep, stdbool.
(Makefile.am): Arrange to test test-pthread-rwlock-waitqueue.
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.
Paul Eggert [Wed, 7 Aug 2024 14:23:51 +0000 (07:23 -0700)]
errno-tests: port to GNU/Hurd
Test for errno distinctness dynamically rather than statically,
since the static test blows up the compiler on Hurd.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00039.html
Also, test that errno values can all be used in #if,
and improve diagnostics.
* tests/test-errno.c: Include stdio.h, stdlib.h, string.h.
(USABLE_IN_IF): New macro. Use it to check errno values in #if.
(ERRTAB): New macro.
(struct nameval): New type.
(errtab): New global variable.
(errtab_cmp): New function.
(main): Test for errno distinctness dynamically not statically.
Diagnose lack of distinctness better.
Bruno Haible [Tue, 6 Aug 2024 13:43:16 +0000 (15:43 +0200)]
pthread-mutex tests: Strengthen tests.
* tests/test-pthread-mutex-type.c: New file.
* modules/pthread-mutex-tests (Files): Add it.
(Makefile.am): Arrange to test test-pthread-mutex-type.
* doc/posix-functions/pthread_mutex_lock.texi: Mention FreeBSD and
NetBSD problem.
* doc/posix-functions/pthread_mutex_trylock.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.
Bruno Haible [Mon, 5 Aug 2024 19:31:28 +0000 (21:31 +0200)]
xstrtol, xstrtoll tests: Fix test failures.
* tests/test-xstrtol.c (is_GNULIB_strtol): New macro.
(main): Use it in the expected test results.
* tests/test-xstrtoll.c (is_GNULIB_strtol): New macro.
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.