]> Savannah Git Hosting - gnulib.git/log
gnulib.git
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.

7 months agomktime: refactor to get closer to glibc
Paul Eggert [Fri, 4 Oct 2024 21:04:22 +0000 (14:04 -0700)]
mktime: refactor to get closer to glibc

* lib/mktime.c (convert_time): Reorder args.
(__tz_convert): New macro.  All convert_time callers changed to use it.

7 months agoiconv_open: Fix undefined behaviour.
Bruno Haible [Sat, 5 Oct 2024 00:45:49 +0000 (02:45 +0200)]
iconv_open: Fix undefined behaviour.

Reported by Tim Sweet <tsweet64@protonmail.com>
at <https://savannah.gnu.org/bugs/?66289>.

* lib/iconv.c (utf32be_mbtowc, utf32le_mbtowc): Cast 'unsigned char'
values to ucs4_t before shifting them to the left.

7 months agobcp47: Refactor.
Bruno Haible [Fri, 4 Oct 2024 21:52:13 +0000 (23:52 +0200)]
bcp47: Refactor.

* lib/bcp47.c (SCRIPT_*): New macros.
(default_script_in_territory, default_script_for_language2,
default_script_for_language3): New functions.
(xpg_to_bcp47, bcp47_to_xpg): Use them.

7 months agotimegm: ignore incoming tm_isdst
Paul Eggert [Fri, 4 Oct 2024 16:12:42 +0000 (09:12 -0700)]
timegm: ignore incoming tm_isdst

Problem reported by Florian Weimer via a proposed glibc patch in:
https://sourceware.org/pipermail/libc-alpha/2024-October/160310.html
* lib/mktime.c (__mktime_internal): Ignore any tm_isdst request
if the timezone never observes DST, as is the case for timegm.
* m4/mktime.m4 (gl_PREREQ_MKTIME): Define new C macro __daylight
if needed.

7 months agotimegm: desync from glibc for now
Paul Eggert [Fri, 4 Oct 2024 16:10:21 +0000 (09:10 -0700)]
timegm: desync from glibc for now

* config/srclist.txt: Omit time/timegm.c and time/mktime-internal.h
for now, until we can sync glibc from Gnulib.
* lib/mktime-internal.h, lib/timegm.c: Revert autoupdate, going
back to the recent Gnulib-specific version.

7 months agoautoupdate
Karl Berry [Fri, 4 Oct 2024 14:58:08 +0000 (07:58 -0700)]
autoupdate

7 months agomktime: prefer static_assert to verify
Paul Eggert [Fri, 4 Oct 2024 05:06:33 +0000 (22:06 -0700)]
mktime: prefer static_assert to verify

This should work better with glibc.
* lib/mktime.c: Do not include verify.h.
Use static_assert instead of verify.
* modules/mktime (Depends-on): Depend on assert-h, not verify.

7 months agomktime: fix "#" indenting
Paul Eggert [Fri, 4 Oct 2024 03:57:02 +0000 (20:57 -0700)]
mktime: fix "#" indenting

7 months agomktime: refactor convert_time
Paul Eggert [Fri, 4 Oct 2024 01:29:43 +0000 (18:29 -0700)]
mktime: refactor convert_time

This is to better merge with a future version of glibc.
This merges a glibc patch by Florian Weimer in:
https://sourceware.org/pipermail/libc-alpha/2024-October/160308.html
* lib/mktime.c (convert_time): Accept a boolean flag instead
of a function pointer.  All callers changed.

7 months agomktime: improve comment wording
Paul Eggert [Fri, 4 Oct 2024 01:14:30 +0000 (18:14 -0700)]
mktime: improve comment wording

* src/mktime.c: Improve comment wording.  glibc has
changed the comment wording, and this improves on
the glibc changes with the result scheduled to be
copied back to glibc.

7 months agoMention WG14 N3322 in manual
Paul Eggert [Thu, 3 Oct 2024 23:03:26 +0000 (16:03 -0700)]
Mention WG14 N3322 in manual

7 months agobcp47: Add tests.
Bruno Haible [Thu, 3 Oct 2024 18:45:59 +0000 (20:45 +0200)]
bcp47: Add tests.

* tests/test-bcp47.c: New file.
* modules/bcp47-tests: New file.

7 months agobcp47: New module.
Bruno Haible [Thu, 3 Oct 2024 18:45:08 +0000 (20:45 +0200)]
bcp47: New module.

* lib/bcp47.h: New file.
* lib/bcp47.c: New file.
* modules/bcp47: New file.

7 months agoerror, verror: Don't call va_end twice.
Collin Funk [Thu, 3 Oct 2024 02:55:26 +0000 (19:55 -0700)]
error, verror: Don't call va_end twice.

* lib/error.c (error_tail): Remove va_end call.

7 months agofile-has-acl: no need for struct stat
Paul Eggert [Thu, 3 Oct 2024 00:40:34 +0000 (17:40 -0700)]
file-has-acl: no need for struct stat

Change the API of the new file_has_aclinfo function so that it no
longer needs a struct stat *.  In some cases this can help GNU ls
avoid an unnecessary ‘stat’ call for each file it lists, which
can be a significant win.
* lib/acl.h (ACL_SYMLINK_NOFOLLOW): Change from 1 to UCHAR_MAX+1
so that it can be ORed with any d_type value.
* lib/file-has-acl.c: Include dirent.h, for the DT_* macros.
Check that ACL_SYMLINK_NOFOLLOW is outside unsigned char range.
(file_has_aclinfo): Change API so that struct stat is no longer
needed.  Instead, the file type (if known) is passed as part of
the flags.  All callers changed.  Simplify NFSv4 code.
* modules/file-has-acl (Depends-on): Add assert-h for static_assert,
and dirent for DT_* macros.
* tests/test-file-has-acl.c: Include dirent.h.
(main): Adjust to file_has_aclinfo API change.
Briefly test ACL_SYMLINK_FOLLOW.

7 months agodirent: define DT_* macros on all platforms
Paul Eggert [Wed, 2 Oct 2024 22:50:10 +0000 (15:50 -0700)]
dirent: define DT_* macros on all platforms

* lib/dirent.in.h (DT_UNKNOWN, DT_FIFO, DT_CHR, DT_DIR, DT_BLK)
(DT_REG, DT_LNK, DT_SOCK, DT_WHT): Define these on all platforms,
if the system does not already define them.  Check that they
have distinct values.
(_GL_DIRENT_S_ISWHT, _GL_DIRENT_S_IFWHT) [!(IFTODT && DTTOIF)]:
New macros.
(IFTODT, DTTOIF): Define if not already defined.
* modules/dirent (Depends-on): Add assert-h, extensions.

7 months agoSilence -Wunused-const-variable warnings in Gnulib code.
Bruno Haible [Wed, 2 Oct 2024 12:41:49 +0000 (14:41 +0200)]
Silence -Wunused-const-variable warnings in Gnulib code.

Reported by Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
via Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00007.html>.

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Add
-Wno-unused-const-variable whenever it is supported.

7 months agofile-has-acl-tests: omit string.h include
Paul Eggert [Wed, 2 Oct 2024 02:56:18 +0000 (19:56 -0700)]
file-has-acl-tests: omit string.h include

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00001.html
* tests/test-file-has-acl.c: Don’t include string.h.

7 months agofile-has-acl.c: port back to macOS
Paul Eggert [Wed, 2 Oct 2024 02:51:50 +0000 (19:51 -0700)]
file-has-acl.c: port back to macOS

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00000.html
* lib/file-has-acl.c (file_has_aclinfo): Don’t attempt to link to
acl_extended_file if !HAVE_ACL_EXTENDED_FILE.  Most of this patch
consists of indenting changes; the real change is to use ‘#if’
rather than ‘if’.

7 months agolocalename-unsafe: Modernize locale name mapping.
Bruno Haible [Wed, 2 Oct 2024 00:23:57 +0000 (02:23 +0200)]
localename-unsafe: Modernize locale name mapping.

* lib/localename-unsafe.c (gl_locale_name_from_win32_LANGID): Return
"az" instead of "az@latin", "az_AZ" instead of "az_AZ@latin",
"ber_MA" instead of "ber_MA@arabic", "ber_DZ" instead of "ber_DZ@latin".

7 months agofile-has-acl: improve performance on Linux symlinks
Paul Eggert [Mon, 30 Sep 2024 17:46:57 +0000 (10:46 -0700)]
file-has-acl: improve performance on Linux symlinks

* lib/file-has-acl.c (USE_LINUX_XATTR): Now can be used outside #if.
(file_has_aclinfo): As an optimization on Linux, do not attempt to
get extended attributes on symlinks, as this will always fail.
Also, use lgetxattr (not getxattr) and acl_extended_file_nofollow
(not acl_extended_file) when not following symlinks, to avoid some
races.

7 months agofile-has-acl: improve acl.h comment
Paul Eggert [Mon, 30 Sep 2024 16:24:09 +0000 (09:24 -0700)]
file-has-acl: improve acl.h comment

* lib/acl.h: Improve comment about ‘152’.

7 months agoselinux-h: Fix two syntax errors.
Bruno Haible [Mon, 30 Sep 2024 12:26:53 +0000 (14:26 +0200)]
selinux-h: Fix two syntax errors.

* m4/selinux-selinux-h.m4 (gl_CHECK_HEADER_SELINUX_SELINUX_H):
Terminate each 'case' clause with ';;'. Remove extraneous closing brace.

7 months agofile-has-acl: Fix compilation error (regression yesterday).
Bruno Haible [Mon, 30 Sep 2024 12:16:28 +0000 (14:16 +0200)]
file-has-acl: Fix compilation error (regression yesterday).

* m4/acl.m4 (gl_FILE_HAS_ACL): Require, not invoke,
gl_CHECK_HEADER_SELINUX_SELINUX_H.

7 months agofile-has-acl: new function file_has_aclinfo
Paul Eggert [Sun, 29 Sep 2024 23:13:53 +0000 (16:13 -0700)]
file-has-acl: new function file_has_aclinfo

This is for GNU coreutils, whose ‘ls’ can be made faster with the
new function because it means (for example) that ‘ls’ needn’t call
both listxattr and lgetxattr in the common case where the file has
no extended attributes.
* lib/acl.h (ACL_SYMLINK_FOLLOW): New constant.
(struct aclinfo): New type.
* lib/file-has-acl.c (UNKNOWN_SECURITY_CONTEXT): New constant.
(USE_LINUX_XATTR): New macro.  When set:
Include stdint.h (for uint32_t).  If also USE_SELINUX_SELINUX_H,
include selinux/selinux.h (for getfilecon).
If HAVE_SMACK, include <sys/smack.h>, otherwise provide substitutes
for smack_smackfs_path and smack_new_label_from_path.
(is_smack_enabled): New function.
(aclinfo_has_xattr): Rename from have_xattr and make it extern.
Use struct aclinfo const * arg instead of char const * and ssize_t.
Work even if ai->size < 0.  Supply a no-op macro on platforms
lacking xattr.
(get_aclinfo): New static function, much of it taken from
coreutils/src/ls.c.
(file_has_aclinfo): New function, which generalizes file_has_acl
to provide more info.  Its body is taken from the old file_has_acl
with new stuff from ls.c.
(file_has_acl): Use it.
(aclinfo_scontext_free, aclinfo_free): Nwew functions, if not
already no-op macros.
* m4/acl.m4 (gl_FUNC_ACL_ARG): Add --without-libsmack option.
(gl_FILE_HAS_ACL): Check for libsmack, selinux.
* m4/selinux-selinux-h.m4 (gl_CHECK_HEADER_SELINUX_SELINUX_H):
New macro, for use by file-has-acl.  Rename HAVE_SELINUX_SELINUX_H
to USE_SELINUX_SELINUX_H to avoid confusion as to whether we have
<selinux/selinux.h>; all uses changed.
(gl_HEADERS_SELINUX_SELINUX_H): Use the new macro.
* modules/file-has-acl (Files): Add m4/selinux-selinux-h.m4.
(Depends-on): Add errno, ssize_t.
* tests/test-file-has-acl.c (main): Add a little test for
file_has_aclinfo.

7 months agoautoupdate
Karl Berry [Sun, 29 Sep 2024 14:57:16 +0000 (07:57 -0700)]
autoupdate

7 months agostring-buffer tests: Avoid test failure on native Windows.
Bruno Haible [Thu, 26 Sep 2024 15:01:36 +0000 (17:01 +0200)]
string-buffer tests: Avoid test failure on native Windows.

Reported by Michele Locati <mlocati@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00135.html>.

* tests/test-string-buffer.c (main): Skip a wchar_t test on native
Windows.

7 months agomanywarnings: Enable -Wthread-safety for clang.
Bruno Haible [Thu, 26 Sep 2024 01:48:11 +0000 (03:48 +0200)]
manywarnings: Enable -Wthread-safety for clang.

* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)): Enable -Wthread-safety
if supported.

7 months agobuild-to-host.m4: Add one more convenience macro.
Bruno Haible [Thu, 26 Sep 2024 00:42:45 +0000 (02:42 +0200)]
build-to-host.m4: Add one more convenience macro.

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

7 months agorelocatable-lib-lgpl: Add support for mingw builds on Cygwin hosts.
Bruno Haible [Thu, 26 Sep 2024 00:02:56 +0000 (02:02 +0200)]
relocatable-lib-lgpl: Add support for mingw builds on Cygwin hosts.

Reported by Michele Locati <michele@locati.it> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-09/msg00033.html>.

* m4/relocatable-lib.m4 (gl_RELOCATABLE_LIBRARY_BODY): Use
gl_BUILD_TO_HOST on the value of INSTALLPREFIX.
* modules/relocatable-lib (Files): Add m4/build-to-host.m4.
* modules/relocatable-lib-lgpl (Files): Likewise.
* modules/relocatable-prog-wrapper (Files): Likewise.

7 months agobuild-to-host.m4: Add some convenience macros.
Bruno Haible [Wed, 25 Sep 2024 23:33:45 +0000 (01:33 +0200)]
build-to-host.m4: Add some convenience macros.

Reported by Michele Locati <michele@locati.it> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-09/msg00033.html>.

* m4/build-to-host.m4 (gl_BUILD_TO_HOST_BINDIR, gl_BUILD_TO_HOST_LIBDIR,
gl_BUILD_TO_HOST_LIBEXECDIR, gl_BUILD_TO_HOST_LOCALEDIR,
gl_BUILD_TO_HOST_PKGDATADIR, gl_BUILD_TO_HOST_PKGLIBDIR): New macros.
* m4/gettext.m4 (AM_GNU_GETTEXT): Invoke gl_BUILD_TO_HOST_LOCALEDIR.
* doc/relocatable-maint.texi (Supporting Relocation): Suggest to use the
*dir_c_make variables and explain how to get them.

7 months agoxstring-buffer: New module.
Bruno Haible [Wed, 25 Sep 2024 16:26:18 +0000 (18:26 +0200)]
xstring-buffer: New module.

* lib/string-buffer.h (sb_xappend1, sb_xappend_desc, sb_xappend_c,
sb_xappendvf, sb_xappendf, sb_xcontents_c, sb_xdupfree, sb_xdupfree_c):
New declarations.
* lib/xstring-buffer.c: New file.
* lib/xstring-buffer-printf.c: New file.
* modules/xstring-buffer: New file.

7 months agostring-buffer: Add more API.
Bruno Haible [Wed, 25 Sep 2024 15:19:41 +0000 (17:19 +0200)]
string-buffer: Add more API.

* lib/string-buffer.h: Include string-desc.h.
(sb_append1, sb_append_desc): New declarations.
(sb_append_c): Renamed from sb_append.
(sb_contents, sb_contents_c, sb_dupfree): New declarations.
(sb_dupfree_c): Renamed from sb_dupfree.
* lib/string-buffer.c (sb_append1, sb_append_desc): New functions.
(sb_append_c): Renamed from sb_append.
(sb_contents, sb_contents_c, sb_dupfree): New functions.
(sb_dupfree_c): Renamed from sb_dupfree. Optimize.
* modules/string-buffer (Depends-on): Add string-desc.
* tests/test-string-buffer.c (main): Use sb_append_c instead of
sb_append. Use sb_dupfree_c instead of sb_dupfree. Test also sb_append1,
sb_append_desc, sb_contents.
* NEWS: Mention the changes.

7 months agostring-buffer: Enable resource leak warnings from clang.
Bruno Haible [Wed, 25 Sep 2024 14:21:12 +0000 (16:21 +0200)]
string-buffer: Enable resource leak warnings from clang.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macros
_GL_ATTRIBUTE_CAPABILITY_TYPE, _GL_ATTRIBUTE_ACQUIRE_CAPABILITY,
_GL_ATTRIBUTE_RELEASE_CAPABILITY.
* lib/string-buffer.h (sb_heap_allocated_pointer_t): New type.
(struct string_buffer): Use it.
(sb_init): Mark with _GL_ATTRIBUTE_ACQUIRE_CAPABILITY.
(sb_free, sb_dupfree): Mark with _GL_ATTRIBUTE_RELEASE_CAPABILITY.
* lib/string-buffer.c: Silence the -Wthread-safety warnings in this
compilation unit.

7 months agostring-buffer: Remove INT_MAX limitation.
Bruno Haible [Tue, 24 Sep 2024 16:31:49 +0000 (18:31 +0200)]
string-buffer: Remove INT_MAX limitation.

* lib/string-buffer.h (sb_appendvf, sb_appendf): Document that errno is
set upon failure.
* lib/string-buffer-printf.c: Include <errno.h>.
(sb_appendvf): Call vsnzprintf instead of vsnprintf. Ensure errno is
set upon failure.
(sb_appendf): Likewise.
* modules/string-buffer (Depends-on): Add vsnzprintf-posix. Remove
vsnprintf-posix.
* tests/test-string-buffer.c (main): Test error code from sb_appendf.

7 months agostring-buffer: Link to vasnprintf implementation only when needed.
Bruno Haible [Tue, 24 Sep 2024 15:28:07 +0000 (17:28 +0200)]
string-buffer: Link to vasnprintf implementation only when needed.

* lib/string-buffer-printf.c: New file, extracted from
lib/string-buffer.c.
* lib/string-buffer.c: Don't include <stdarg.h>.
(sb_ensure_more_bytes): Declare. Make non-static.
(sb_appendvf, sb_appendf): Moved to lib/string-buffer-printf.c.
* modules/string-buffer (Files): Add lib/string-buffer-printf.c.
(Makefile.am): Arrange to compile string-buffer-printf.c.

7 months agosfl-istream: Add tests.
Bruno Haible [Tue, 24 Sep 2024 10:31:07 +0000 (12:31 +0200)]
sfl-istream: Add tests.

* tests/test-sfl-istream.c: New file, based on tests/test-sf-istream.c.
* modules/sfl-istream-tests: New file.

7 months agosfl-istream: New module.
Bruno Haible [Tue, 24 Sep 2024 10:31:03 +0000 (12:31 +0200)]
sfl-istream: New module.

* lib/sfl-istream.h: New file.
* lib/sfl-istream.c: New file.
* modules/sfl-istream: New file.

7 months agosf-istream: Add tests.
Bruno Haible [Tue, 24 Sep 2024 10:30:58 +0000 (12:30 +0200)]
sf-istream: Add tests.

* tests/test-sf-istream.c: New file.
* modules/sf-istream-tests: New file.

7 months agosf-istream: New module.
Bruno Haible [Tue, 24 Sep 2024 10:30:54 +0000 (12:30 +0200)]
sf-istream: New module.

* lib/sf-istream.h: New file.
* lib/sf-istream.c: New file.
* modules/sf-istream: New file.
* doc/posix-functions/fmemopen.texi: Mention the new module.

7 months agogetopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).
Bruno Haible [Mon, 23 Sep 2024 15:52:43 +0000 (17:52 +0200)]
getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).

* lib/getopt-pfx-core.h: On AIX, HP-UX, Solaris, QNX, include <stdio.h>
first.

7 months agojit/cache tests: Fix link error (regression 2024-09-20).
Bruno Haible [Mon, 23 Sep 2024 14:59:14 +0000 (16:59 +0200)]
jit/cache tests: Fix link error (regression 2024-09-20).

* m4/libdl.m4: New file.
* modules/jit/cache-tests (Files): Add it.
(configure.ac): Invoke gl_LIBDL.
(Makefile.am): Link test-cache with $(LIBDL).

7 months agoutimens: Fix test failure on NetBSD 10 (regression 2024-09-16).
Bruno Haible [Mon, 23 Sep 2024 14:03:07 +0000 (16:03 +0200)]
utimens: Fix test failure on NetBSD 10 (regression 2024-09-16).

* lib/utimens.h (utimens): Declare as an override if utimens exists in
libc.
(lutimens): Declare as an override if lutimens exists in libc.
* lib/utimens.c (is_valid_timespec, is_valid_timespecs): New functions,
extracted from validate_timespec.
(validate_timespec): Call is_valid_timespecs.
(utimens, lutimens): On NetBSD, validate the argument before calling
NetBSD's libc function.
* tests/test-utimens-common.h (check_ctime): Set to -1 on NetBSD.

7 months agogetopt-posix, crypto/md5-buffer: Fix __GNUC_PREREQ re clang.
Bruno Haible [Sat, 21 Sep 2024 21:10:34 +0000 (23:10 +0200)]
getopt-posix, crypto/md5-buffer: Fix __GNUC_PREREQ re clang.

* lib/getopt-cdefs.in.h (__GNUC_PREREQ): Copy definition from
lib/libc-config.h.
* lib/md5.h (__GNUC_PREREQ): Likewise.

7 months agogetopt-posix: Improve definition of __GNUC_PREREQ.
Henrik Lindström [Sat, 21 Sep 2024 20:46:24 +0000 (22:46 +0200)]
getopt-posix: Improve definition of __GNUC_PREREQ.

* lib/getopt-cdefs.in.h (__GNUC_PREREQ): Test __GNUC_MINOR__, not
__GNUC_VERSION__.

Copyright-paperwork-exempt: Yes

7 months agosigsegv-tests: port to GCC 14
Paul Eggert [Sat, 21 Sep 2024 02:24:39 +0000 (19:24 -0700)]
sigsegv-tests: port to GCC 14

GCC 14 on x86-64 with -O2 apparently outsmarts our test for null
pointer dereference, and this is something the C standard allows.
Fix the test by putting ‘volatile’ at the right place.
* tests/test-sigsegv-catch-stackoverflow2.c (null_pointer):
Make it a volatile pointer, not a pointer to volatile.
Also, rename from null_pointer_to_volatile_int; use changed.

7 months agojit/cache tests: Fix crash with clang's UBSAN + ASAN.
Bruno Haible [Fri, 20 Sep 2024 15:17:36 +0000 (17:17 +0200)]
jit/cache tests: Fix crash with clang's UBSAN + ASAN.

* tests/jit/test-cache.c (clang_ubsan_workaround): New variable.
(CODE, SET_CODE): Use it.
(main): Initialize it.

7 months agounictype/scripts: Fix integer overflow in generated table.
Bruno Haible [Fri, 20 Sep 2024 10:43:57 +0000 (12:43 +0200)]
unictype/scripts: Fix integer overflow in generated table.

Reported by clang through a -Wconstant-conversion warning.

* lib/gen-uni-tables.c (output_scripts): Generate a level2 array of
'unsigned short', not 'short', values.
* lib/unictype/scripts.h: Regenerated.
* lib/unictype/scripts.c (uc_script): Update accordingly.

7 months agowait-process: Use waitpid() of LIBCx on OS/2 kLIBC if available.
KO Myung-Hun [Thu, 19 Sep 2024 13:45:04 +0000 (22:45 +0900)]
wait-process: Use waitpid() of LIBCx on OS/2 kLIBC if available.

* lib/wait-process.c (klibc_waitpid) [kLIBC]: New function.
(waitpid) [kLIBC]: Define it to klibc_waitpid.

7 months agoautoupdate
Karl Berry [Thu, 19 Sep 2024 21:28:57 +0000 (14:28 -0700)]
autoupdate

7 months agospawn-pipe: Simplify.
Bruno Haible [Thu, 19 Sep 2024 14:32:43 +0000 (16:32 +0200)]
spawn-pipe: Simplify.

* m4/spawn-pipe.m4 (gl_SPAWN_PIPE): Don't define HAVE_LIBCX_SPAWN2_H as
an AC_SUBSTed variable. Don't test for it on platforms other than OS/2.

7 months agospawn-pipe: Support a directory argument of create_pipe() on OS/2 kLIBC.
KO Myung-Hun [Thu, 19 Sep 2024 13:58:01 +0000 (22:58 +0900)]
spawn-pipe: Support a directory argument of create_pipe() on OS/2 kLIBC.

* lib/os2-spawn.h (spawnpvech): New declaration.
* lib/os2-spawn.c (spawnpvech): New function.
* lib/spawn-pipe.c (create_pipe) [kLIBC]: Reimplement with spawnpvech().
* m4/spawn-pipe.m4 (gl_SPAWN_PIPE) [HAVE_LIBCX_SPAWN2_H]: Check if
libcx/spawn2.h is available.

7 months agoutimens: port to NetBSD-10.99.12/amd64
Paul Eggert [Tue, 17 Sep 2024 06:55:37 +0000 (23:55 -0700)]
utimens: port to NetBSD-10.99.12/amd64

On this platform, <sys/time.h> declares utimens and lutimens and the
C library defines them, so we needn’t (and shouldn’t).
Problem reported privately by Thomas Klausner.
* lib/utimens.c (utimens) [HAVE_UTIMENS]: Don’t define.
(lutimens) [HAVE_LUTIMENS]: Don’t define.
* lib/utimens.h [HAVE_UTIMENS || HAVE_LUTIMENS]:
Include <sys/time.h>, for NetBSD’s declaration of utimens and lutimens.
(utimens) [HAVE_UTIMENS]: Don’t declare.
(lutimens) [HAVE_LUTIMENS]: Don’t declare.
* m4/utimens.m4 (gl_UTIMENS): Check for utimens, lutimens.

7 months agostdlib: Fix compilation error with Sun C++.
Bruno Haible [Tue, 17 Sep 2024 01:56:55 +0000 (03:56 +0200)]
stdlib: Fix compilation error with Sun C++.

* lib/stdlib.in.h: Don't obey the special invocation convention when
Sun C++ is used.

7 months agostdc_count_ones: Fix compilation error with g++ < 4.4.
Bruno Haible [Mon, 16 Sep 2024 23:44:51 +0000 (01:44 +0200)]
stdc_count_ones: Fix compilation error with g++ < 4.4.

* lib/stdbit.in.h (__gl_stdbit_popcount_wide): Suffix 64-bit integer
constant with LL.

7 months agofaccessat: Correct errno value on AIX.
Bruno Haible [Mon, 16 Sep 2024 22:52:28 +0000 (00:52 +0200)]
faccessat: Correct errno value on AIX.

* lib/faccessat.c (rpl_faccessat): Do the trailing-slash workaround also
if the original faccessat invocation failed.

7 months agofflush: NetBSD, OpenBSD can’t fflush input
Paul Eggert [Mon, 16 Sep 2024 22:32:17 +0000 (15:32 -0700)]
fflush: NetBSD, OpenBSD can’t fflush input

* m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Guess no on NetBSD and
OpenBSD; they document fflush to fail unless the stream is open
for writing.

7 months agounictype/category-of: Fix integer overflow in generated table.
Bruno Haible [Mon, 16 Sep 2024 21:37:44 +0000 (23:37 +0200)]
unictype/category-of: Fix integer overflow in generated table.

Reported by clang through -Wconstant-conversion warnings.

* lib/gen-uni-tables.c (output_category): Generate a level2 array of
'unsigned short', not 'short', values.
* lib/unictype/categ_of.h: Regenerated.
* lib/unictype/categ_of.c (lookup_withtable): Update accordingly.

7 months agounilbrk tests: Avoid two gcc -Wparentheses warnings.
Bruno Haible [Mon, 16 Sep 2024 20:40:40 +0000 (22:40 +0200)]
unilbrk tests: Avoid two gcc -Wparentheses warnings.

* tests/unilbrk/test-uc-possible-linebreaks.c (main): Add redundant
parentheses.

7 months agoFix typo in previous patch
Paul Eggert [Mon, 16 Sep 2024 18:19:17 +0000 (11:19 -0700)]
Fix typo in previous patch

7 months agoparse-datetime no longer depends on nstrftime
Paul Eggert [Mon, 16 Sep 2024 18:12:24 +0000 (11:12 -0700)]
parse-datetime no longer depends on nstrftime

I discovered this unnecessary dependency when debugging
GNU Patch.
* lib/parse-datetime.y:
(populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
(debug_strfdatetime): Use strftime not nstrftime,
as we don’t need nstrftime’s extensions or bug fixes.
* modules/parse-datetime (Depends-on): Remove nstrftime.
Also remove setenv, unsetenv, timegm, as this module
no longer depends on them directly.

7 months agoDocument use of empty macro args.
Paul Eggert [Mon, 16 Sep 2024 16:54:08 +0000 (09:54 -0700)]
Document use of empty macro args.

7 months agoDon’t port July [[...]] changes to C89
Paul Eggert [Mon, 16 Sep 2024 16:45:36 +0000 (09:45 -0700)]
Don’t port July [[...]] changes to C89

Yesterday’s changes to port to C17 and earlier were intrusive,
since they twice replaced one macro with two.  Revert the macro
definitions to what they were before yesterday, and instead change
callers so that they always have four arguments even if the last
one is empty.  Although this change requires C99 or later, that’s
safe nowadays.  Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-09/msg00079.html
* lib/c++defs.h (_GL_FUNCDECL_RPL, _GL_FUNCDECL_SYS):
Revert yesterday’s changes.  All callers changed.
Add comments explaining the required comma before missing attrs.

7 months agowchar: Fix compilation error (regression yesterday).
Bruno Haible [Mon, 16 Sep 2024 11:24:48 +0000 (13:24 +0200)]
wchar: Fix compilation error (regression yesterday).

* lib/wchar.in.h (wctob): Use _GL_FUNCATTR_RPL, _GL_FUNCATTR_SYS here
as well.

7 months agowchar: Fix compilation error (regression yesterday).
Bruno Haible [Mon, 16 Sep 2024 09:22:36 +0000 (11:22 +0200)]
wchar: Fix compilation error (regression yesterday).

* lib/wchar.in.h (btowc): Use _GL_FUNCATTR_RPL, _GL_FUNCATTR_SYS here
as well.

7 months agoPort July changes for [[...]] to C17
Paul Eggert [Mon, 16 Sep 2024 04:20:15 +0000 (21:20 -0700)]
Port July changes for [[...]] to C17

The July 30 changes to _GL_FUNCDECL_RPL etc. to support use of
attributes in bracket syntax used a C23 preprocessor feature that is
a common extension to C17 and earlier, but which doesn’t work when
compiled with stricter C17-and-earlier compilers.  The feature is
using ‘#define f(a, ...) b’ and calling ‘f’ with only one arg.
Port back to C17 and earlier.  Problem discovered with
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) on cfarm111.
* lib/c++defs.h (_GL_FUNCDECL_RPL): Turn this into two macros
_GL_FUNCDECL_RPL and _GL_FUNCATTR_RPL.  The first macro is for
functions without attributes, the second one for functions with
attributes.  All uses changed.
(_GL_FUNCDECL_SYS): Likewise, turn this into _GL_FUNCDECL_SYS
and _GL_FUNCATTR_SYS.

7 months agounilbrk: Some more tweaks.
Bruno Haible [Sun, 15 Sep 2024 23:05:00 +0000 (01:05 +0200)]
unilbrk: Some more tweaks.

* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Assign to preceding_prop at each loop round. Assign to prev2_ea,
prev_ea, prev_nus also when a line break was seen.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

7 months agounilbrk: Strengthen tests.
Bruno Haible [Sun, 15 Sep 2024 13:27:34 +0000 (15:27 +0200)]
unilbrk: Strengthen tests.

* lib/gen-uni-tables.c: Add shell commands for creating
tests/unilbrk/LineBreakTest.txt.
* tests/unilbrk/LineBreakTest.txt: New file, from unicode.org.
* tests/unilbrk/test-uc-possible-linebreaks.c: New file, based on
tests/uniwbrk/test-uc-wordbreaks.c.
* tests/unilbrk/test-uc-possible-linebreaks.sh: New file, based on
tests/uniwbrk/test-uc-wordbreaks.sh.
* modules/unilbrk/u32-possible-linebreaks-tests (Files): Add them.
(Makefile.am): Arrange to compile test-uc-possible-linebreaks.c and test
test-uc-possible-linebreaks.sh.

7 months agouniwbrk tests: Modernize code.
Bruno Haible [Sun, 15 Sep 2024 13:20:08 +0000 (15:20 +0200)]
uniwbrk tests: Modernize code.

* tests/uniwbrk/test-uc-wordbreaks.c (main): Reduce the scope of local
variables. Remove memset() calls. Align expected and actial output
lines. Add comments.

7 months agounigbrk tests: Modernize code.
Bruno Haible [Sun, 15 Sep 2024 13:16:52 +0000 (15:16 +0200)]
unigbrk tests: Modernize code.

* tests/unigbrk/test-uc-grapheme-breaks.c (main): Reduce the scope of
local variables. Add comments.
* tests/unigbrk/test-uc-is-grapheme-break.c (main): Likewise.

7 months agounilbrk: Fix conflicts between rules.
Bruno Haible [Sun, 15 Sep 2024 13:06:01 +0000 (15:06 +0200)]
unilbrk: Fix conflicts between rules.

* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Avoid side effect of (LB18) on (LB14) and (LB15a). Avoid side effect
of (LB19a) on (LB18).
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

7 months agounilbrk: Enable most cases of Unicode rule (LB29).
Bruno Haible [Sun, 15 Sep 2024 13:00:30 +0000 (15:00 +0200)]
unilbrk: Enable most cases of Unicode rule (LB29).

* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Enable rule LB29.
* lib/unilbrk/lbrktables.c: Regenerated.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Allow a break between a character with property IS and '<'.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

7 months agounilbrk: Fully implement Unicode rule (LB9).
Bruno Haible [Sun, 15 Sep 2024 11:23:04 +0000 (13:23 +0200)]
unilbrk: Fully implement Unicode rule (LB9).

* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
New variable preceding_prop. Don't copy prop to prev_prop and ea to
prev_ea if the conditions of rule (LB9) apply.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

7 months agounilbrk: Fix bugs in implementation of Unicode rules (LB15a), (LB15b).
Bruno Haible [Sun, 15 Sep 2024 10:59:46 +0000 (12:59 +0200)]
unilbrk: Fix bugs in implementation of Unicode rules (LB15a), (LB15b).

* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Fix typo in
comment.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Do the LBP_QU2 to LBP_QU1 mapping for (LB15a) after the table lookup but
before the assignment to last_prop. Do the LBP_QU3 to LBP_QU1 mapping
for (LB15b) in a way that does not influence prev_prop or last_prop.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

7 months agounilbrk: Fix bug in implementation of Unicode rule (LB16).
Bruno Haible [Sat, 14 Sep 2024 23:29:27 +0000 (01:29 +0200)]
unilbrk: Fix bug in implementation of Unicode rule (LB16).

* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Fix typo.
* lib/unilbrk/lbrktables.c: Regenerated.

7 months agounilbrk: Fix handling of unassigned code points (regression yesterday).
Bruno Haible [Sat, 14 Sep 2024 19:13:20 +0000 (21:13 +0200)]
unilbrk: Fix handling of unassigned code points (regression yesterday).

* lib/unilbrk/lbrktables.h (unilbrkprop_lookup): Correct the default
return value.

7 months agounilbrk/tables: Fix table (regression yesterday).
Bruno Haible [Sat, 14 Sep 2024 09:56:38 +0000 (11:56 +0200)]
unilbrk/tables: Fix table (regression yesterday).

Reported by Collin Funk <collin.funk1@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00061.html>.

* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Use LBP_AL1 as
array index instead of LBP_AL. Update comments.
* lib/unilbrk/lbrktables.c: Regenerated.

7 months agoImplement a new property, added by Unicode 16.0.0.
Bruno Haible [Fri, 13 Sep 2024 13:25:05 +0000 (15:25 +0200)]
Implement a new property, added by Unicode 16.0.0.

* lib/gen-uni-tables.c (is_property_modifier_combining_mark): New
function.
(output_properties): Output also the property modifier_combining_mark.
* lib/unictype.in.h (UC_PROPERTY_MODIFIER_COMBINING_MARK,
uc_is_property_modifier_combining_mark): New declarations.
* m4/unictype_h.m4 (gl_UNICTYPE_H_REQUIRE_DEFAULTS): Initialize
GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK.
* modules/unictype/base (Makefile.am): Substitute
GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK.
* lib/unictype/pr_modifier_combining_mark.c: New file.
* lib/unictype/pr_modifier_combining_mark.h: New generated file.
* modules/unictype/property-modifier-combining-mark: New file.
* tests/unictype/test-pr_modifier_combining_mark.c: New generated file.
* modules/unictype/property-modifier-combining-mark-tests: New file.
* lib/unictype/pr_byname.gperf: Add modifier_combining_mark.
* lib/unictype/pr_byname.c
(UC_PROPERTY_INDEX_MODIFIER_COMBINING_MARK): New enum item.
(uc_property_byname): Handle it.
* modules/unictype/property-byname (Depends-on): Add
unictype/property-modifier-combining-mark.
* modules/unictype/property-all (Depends-on): Likewise.
* MODULES.html.sh (func_all_modules): Add
unictype/property-modifier-combining-mark.

7 months agoUpdate to Unicode 16.0.0.
Bruno Haible [Fri, 13 Sep 2024 13:17:49 +0000 (15:17 +0200)]
Update to Unicode 16.0.0.

* lib/gen-uni-tables.c (PROP_MODIFIER_COMBINING_MARK): New enum item.
(fill_properties): Recognize property Modifier_Combining_Mark.
(UC_JOINING_GROUP_KASHMIRI_YEH): New enum item.
(fill_arabicshaping, joining_group_as_c_identifier): Handle
UC_JOINING_GROUP_KASHMIRI_YEH.
(LBP_*): Split LBP_AL into LBP_AL1 and LBP_AL2.
(LBP_AL): New enum item.
(get_lbea): New function.
(get_lbp): Use it. Update such that unilbrk/lbrkprop.txt comes out as
expected. Map U+25CC to LBP_AL2.
(PROP_EA, PROP, EA): New macros.
(debug_output_lbp): Print either LBP_AL1, LBP_AL2 as LBP_AL.
(lbp_value_to_string): Handle LBP_AL1, LBP_AL2 instead of LBP_AL.
(struct lbpea_table): Renamed from struct lbp_table.
(output_lbpea): Renamed from output_lbp. Store both the line break
property and the line break EastAsian bit in the same table entry.
(output_lbrk_tables): Update.
(output_lbrk_rules_as_tables): Update for LBP_AL change. Implement rules
LB28a, LB25, LB19, LB15d, LB13 as specified by
https://www.unicode.org/reports/tr14/tr14-53.html.
(get_wbp): Update such that uniwbrk/wbrkprop.txt comes out as expected.

* lib/unictype.in.h (UC_JOINING_GROUP_KASHMIRI_YEH): New enum item.
* lib/unictype/joininggroup_byname.gperf: Handle it.
* lib/unictype/joininggroup_name.h: Likewise.

* lib/unilbrk/lbrktables.h: Split LBP_AL into LBP_AL1 and LBP_AL2.
(LBP_AKLS_VI): New enum item, for rule LB28a.
(PROP, EA, PROP_EA): New macros.
(unilbrk_table): Update bounds.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Use LBP_AL1 instead of LBP_AL. Use 2 characters of lookahead, for rules
LB15c, LB19a, LB25, LB28a. New variables prev_ea, prev2_ea, for rule
LB19a. New variable prev_initial_hyphen, for rule LB20a. New variable
prev_nus, for rule LB25. Implement rules LB15c, LB19a, LB20a, LB21a,
LB25, LB28a,  as specified by
https://www.unicode.org/reports/tr14/tr14-53.html.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
* modules/unilbrk/base (Depends-on): Add stdbool.

* tests/uninorm/test-u32-normalize-big.h
(struct normalization_test_file): Now 6 parts.
* tests/uninorm/test-u32-normalize-big.c (read_normalization_test_file):
Fill in 6 parts.
(test_specific, free_normalization_test_file): Now handle 6 parts.

* tests/uniwidth/test-uc_width2.sh: Update expected test result.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.

7 months agouninorm/composition: Fix mistake in last commit (regression yesterday).
Bruno Haible [Fri, 13 Sep 2024 07:50:15 +0000 (09:50 +0200)]
uninorm/composition: Fix mistake in last commit (regression yesterday).

* modules/uninorm/composition (Files): Add
lib/uninorm/composition-table-bounds.h.

7 months agouninorm/composition: Make more maintainable.
Bruno Haible [Fri, 13 Sep 2024 00:45:37 +0000 (02:45 +0200)]
uninorm/composition: Make more maintainable.

* lib/gen-uni-tables.c (output_composition_tables): Add a filename2
parameter. Emit definitions of UNINORM_COMPOSE_MAX_ARG1 and
UNINORM_COMPOSE_MAX_ARG2 to this file.
(main): Invoke it with additional file name
uninorm/composition-table-bounds.h.
* uninorm/composition-table-bounds.h: New generated file.
* lib/uninorm/composition.c: Include it.
(uc_composition): Use UNINORM_COMPOSE_MAX_ARG1 and
UNINORM_COMPOSE_MAX_ARG2 instead of hardcoded bounds.

7 months agombrtoc16: Fix undefined behaviour.
Bruno Haible [Tue, 10 Sep 2024 11:56:03 +0000 (13:56 +0200)]
mbrtoc16: Fix undefined behaviour.

* lib/mbrtoc16.c (SET_EXTRA_STATE): Cast to 'unsigned int' before
shifting the bits to the positions 31..16.

7 months agostring-desc: Fix undefined behaviour.
Bruno Haible [Tue, 10 Sep 2024 00:07:57 +0000 (02:07 +0200)]
string-desc: Fix undefined behaviour.

* lib/string-desc-contains.c (string_desc_contains): Handle the case of
an empty haystack before invoking 'memmem'.

7 months agostriconv, striconveh, unicodeio: Drop workaround for glibc 2.1.
Bruno Haible [Mon, 9 Sep 2024 14:05:41 +0000 (16:05 +0200)]
striconv, striconveh, unicodeio: Drop workaround for glibc 2.1.

* lib/striconv.c (mem_cd_iconv, str_iconv): Remove glibc-2.1 and
Solaris 9 bug workarounds.
* lib/striconveh.c (mem_cd_iconveh_internal): Likewise.
* lib/unicodeio.c (unicode_to_mb): Likewise.

7 months agostriconv, striconveh: Drop workaround for glibc 2.1.
Bruno Haible [Mon, 9 Sep 2024 13:46:44 +0000 (15:46 +0200)]
striconv, striconveh: Drop workaround for glibc 2.1.

* lib/striconv.c (str_iconv): Remove glibc-2.1 bug workaround.
* lib/striconveh.c (iconveh_open): Likewise.

7 months agocrc.h: declare each function with _GL_ATTRIBUTE_PURE
Jim Meyering [Mon, 9 Sep 2024 06:54:30 +0000 (23:54 -0700)]
crc.h: declare each function with _GL_ATTRIBUTE_PURE

* lib/crc.h (crc32, crc32_update, crc32_no_xor)
(crc32_update_no_xor): Declare with _GL_ATTRIBUTE_PURE.

7 months agoFix COPYING.EXCEPTION license notices
Paul Eggert [Fri, 6 Sep 2024 01:31:29 +0000 (18:31 -0700)]
Fix COPYING.EXCEPTION license notices

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00227.html
* m4/std-gnu11.m4: Fix license notice to use COPYING.EXCEPTION
correctly.
* m4/std-gnu23.m4: Likewise.  Also document the commit ID,
since Autoconf was updated likewise and we’re copying from there.

8 months agoResolve conflicts for functions introduced in Android API level 35.
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.

8 months agoResolve conflicts for functions introduced in Android API level 35.
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.

8 months agoDoc regarding functions introduced in Android API level 35.
Bruno Haible [Wed, 4 Sep 2024 08:21:31 +0000 (10:21 +0200)]
Doc regarding functions introduced in Android API level 35.

* doc/posix-functions/_Fork.texi: Mention the Android API levels.
* doc/glibc-functions/epoll_pwait2.texi: Likewise.
* doc/glibc-functions/strerrorname_np.texi: Likewise.

8 months agotests: Strenghten tests with invalid file descriptor.
Bruno Haible [Tue, 3 Sep 2024 21:00:28 +0000 (23:00 +0200)]
tests: Strenghten tests with invalid file descriptor.

* tests/test-close.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-dup.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-unlockpt.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-fchdir.c (main): Likewise.
* tests/test-fdatasync.c (main): Likewise.
* tests/test-fdopendir.c (main): Likewise.
* tests/test-fsync.c (main): Likewise.
* tests/test-isatty.c (main): Likewise.

8 months agodoc: More details about pthread_setname_np.
Bruno Haible [Tue, 3 Sep 2024 20:25:29 +0000 (22:25 +0200)]
doc: More details about pthread_setname_np.

Reported by Eric Gallager <egall@gwmail.gwu.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00017.html>.

* doc/glibc-functions/pthread_setname_np.texi: Mention the different
signature on macOS.

8 months agosyntax-check: Catch all FSF postal addresses.
Simon Josefsson [Tue, 3 Sep 2024 18:40:51 +0000 (20:40 +0200)]
syntax-check: Catch all FSF postal addresses.

* top/maint.mk (sc_franklin_street): Rename to sc_fsf_postal,
improve regexp.

8 months agounlockpt tests: Avoid test failure on Haiku.
Bruno Haible [Tue, 3 Sep 2024 11:32:40 +0000 (13:32 +0200)]
unlockpt tests: Avoid test failure on Haiku.

* tests/test-unlockpt.c (main): Skip the test on Haiku.
* doc/posix-functions/unlockpt.texi: Update platforms list.

8 months agodoc: Mention a gmtime_r problem.
Bruno Haible [Tue, 3 Sep 2024 09:34:11 +0000 (11:34 +0200)]
doc: Mention a gmtime_r problem.

* doc/posix-functions/gmtime_r.texi: Mention "UTC" vs. "GMT".

8 months agovma-prot tests: Strengthen test.
Bruno Haible [Mon, 2 Sep 2024 11:49:05 +0000 (13:49 +0200)]
vma-prot tests: Strengthen test.

Found by Coverity.

* tests/test-vma-prot.c (main): Fix typo.

8 months agosyntax-check: Catch obsolete Franklin Street usages.
Simon Josefsson [Mon, 2 Sep 2024 10:46:38 +0000 (12:46 +0200)]
syntax-check: Catch obsolete Franklin Street usages.

* top/maint.mk (sc_franklin_street): New function.

8 months agoerror, getprogname: Stricter dependency conditions.
Bruno Haible [Mon, 2 Sep 2024 08:42:53 +0000 (10:42 +0200)]
error, getprogname: Stricter dependency conditions.

* modules/error (Depends-on): Add dependency condition.
* modules/getprogname (Depends-on): Make dependency condition stricter.
(configure.ac): Require AC_CANONICAL_HOST.