Bruno Haible [Tue, 3 Mar 2026 10:33:11 +0000 (11:33 +0100)]
Don't use 'typeof' built-in with -std=c99 or -std=c11.
Reported by Alexander Sosedkin <asosedkin@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-03/msg00019.html>.
* lib/stdcountof.in.h (_gl_verify_is_array): Don't use the definition
with typeof in strict C99 or C11 modes.
* lib/string-desc.h (HAVE_TYPEOF): Don't define in strict C99 or C11
modes.
Paul Eggert [Sun, 1 Mar 2026 18:13:48 +0000 (10:13 -0800)]
strftime: pacify clang -Wstring-plus-int
This pacifies a warning from default clang 21, and saves a byte.
Problem reported by Badli Al Rashid <https://bugs.gnu.org/80514>.
* lib/strftime.c (c_ampm_letters): New static constant, if
!defined _NL_CURRENT && (HAVE_ONLY_C_LOCALE || (USE_C_LOCALE &&
!HAVE_STRFTIME_L)).
(ampm): Use it if needed.
Bruno Haible [Sat, 28 Feb 2026 21:13:14 +0000 (22:13 +0100)]
filesystem-remote: New module.
* lib/filesystem-remote.h: New file, based on lib/file-remote.h.
* lib/filesystem-remote.c: New file, based on lib/file-remote.c.
* lib/file-remote.h (is_remote_fs_type_name): Remove declaration.
* lib/file-remote.c (is_remote_fs_type_name): Remove function.
* modules/filesystem-remote: New file.
* lib/mountlist.c: Include filesystem-remote.h instead of file-remote.h.
* modules/mountlist (Depends-on): Add filesystem-remote. Remove
file-remote.
Collin Funk [Sat, 28 Feb 2026 20:59:50 +0000 (12:59 -0800)]
cygpath: Use _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE.
* lib/cygpath.h: Include stdlib.h for free declaration.
(cygpath_w): Mark function with _GL_ATTRIBUTE_MALLOC and
_GL_ATTRIBUTE_DEALLOC_FREE since it will always return a malloc'ed
pointer or NULL.
Bruno Haible [Sat, 28 Feb 2026 15:36:24 +0000 (16:36 +0100)]
streq, memeq: New modules.
* lib/string.in.h (_GL_STRING_INLINE): Remove macro.
(_GL_MEMEQ_INLINE): New macro.
(memeq): Use it instead of _GL_STRING_INLINE. Test GNULIB_MEMEQ.
(_GL_STREQ_INLINE): New macro.
(streq): Use it instead of _GL_STRING_INLINE. Test GNULIB_STREQ.
* lib/memeq.c: New file.
* lib/streq.c: New file.
* lib/string.c: Remove file.
* m4/memeq.m4: New file, based on m4/stringeq.m4.
* m4/streq.m4: New file, based on m4/stringeq.m4.
* m4/stringeq.m4: Remove file.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_MEMEQ, GNULIB_STREQ. Don't initialize GNULIB_STRINGEQ.
* modules/string-h (Makefile.am): Substitute GNULIB_MEMEQ, GNULIB_STREQ.
Don't substitute GNULIB_STRINGEQ.
* modules/memeq: New file.
* modules/streq: New file.
* modules/stringeq: Change to just be the union of streq and memeq.
* MODULES.html.sh (func_all_modules): Add memeq, streq.
Pádraig Brady [Mon, 23 Feb 2026 14:22:51 +0000 (14:22 +0000)]
mountlist: use file-remote module to determine remoteness
* lib/file-remote.c (is_remote_fs_type_name): A new function
that matches file system _names_ as being remote. The list is
an amalgamation of those names already referenced in file-remote,
names referenced in ME_REMOTE, and IDs referenced in file-remote.
* lib/file-remote.h: Declare new function.
* lib/mountlist.c (ME_REMOTE): Use is_remote_fs_type_name()
to determine if the name is remote.
* modules/mountlist: Depend on file-remote.
Bruno Haible [Fri, 27 Feb 2026 10:47:19 +0000 (11:47 +0100)]
wctype-h: Try to fix error regarding mbstate_t on very old mingw.
Reported by Eli Zaretskii, see
<https://lists.gnu.org/archive/html/bug-gnulib/2026-01/msg00206.html>.
Based on proposed patch at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00043.html>.
* lib/wctype.in.h: Don't include <wchar.h> on mingw when it has already
been at least partially processed.
Bruno Haible [Fri, 27 Feb 2026 05:41:31 +0000 (06:41 +0100)]
mbs_startswith: Add tests.
* tests/test-mbs_startswith1.c: New file, based on
tests/test-mbs_endswith1.c.
* tests/test-mbs_startswith2.c: New file, based on
tests/test-mbs_endswith2.c.
* tests/test-mbs_startswith2.sh: New file, based on
tests/test-mbs_endswith2.sh.
* tests/test-mbs_startswith3.c: New file, based on
tests/test-mbs_endswith3.c.
* tests/test-mbs_startswith3.sh: New file, based on
tests/test-mbs_endswith3.sh.
* modules/mbs_startswith-tests: New file.
Bruno Haible [Tue, 24 Feb 2026 00:13:43 +0000 (01:13 +0100)]
strnul: Respect GNULIB_NAMESPACE.
* lib/string.in.h (strnul): Use _GL_BEGIN_NAMESPACE, _GL_END_NAMESPACE.
* tests/test-strnul-c++2.cc: New file, based on tests/test-strnul.c.
* modules/strnul-c++-tests (Files): Add it.
(Makefile.am): Arrange to compile and run test-strnul-c++2.
Bruno Haible [Mon, 23 Feb 2026 08:40:09 +0000 (09:40 +0100)]
fts: Relicense some of its source code under LGPLv2+.
Jim Meyering's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00109.html>.
Paul Eggert's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00106.html>.
Bruno Haible's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00111.html>.
Pádraig Brady's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00113.html>.
Kamil Dudka's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00199.html>.
Paul Eggert [Mon, 23 Feb 2026 01:13:58 +0000 (17:13 -0800)]
crypto: don’t add 72 to malloc size
The ‘BLOCKSIZE + 72’ business apparently dates back to 30 years
ago when the buffer was local (not heap allocated) and was multi-use.
That code died long ago, so stop allocating the cargo-cult bytes.
* lib/md2-stream.c (md2_stream):
* lib/md4-stream.c (md4_stream):
* lib/md5-stream.c (md5_stream):
* lib/sha1-stream.c (sha1_stream):
* lib/sha256-stream.c (shaxxx_stream):
* lib/sha3-stream.c (sha3_xxx_stream):
* lib/sha512-stream.c (shaxxx_stream):
* lib/sm3-stream.c (sm3_stream):
Don’t allocate an unnecessary 72 extra bytes.
Paul Eggert [Sun, 22 Feb 2026 21:06:34 +0000 (13:06 -0800)]
crypto/sha3: Don’t leak if init fails and no free
If the init_ctx functions fail, it’s natural for callers to
immediately fail too. Change the init_ctx functions to not leak
when failing. This doesn’t invalidate any callers that free
if the init functions fail, as that free now becomes a no-op.
* lib/sha3.c (sha3_##SIZE##_init_ctx): Before failing,
free any storage that was allocated before failure was discovered.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(check, main): Test more cases of multiple frees.
Also, fix a memory leak.
Paul Eggert [Sun, 22 Feb 2026 19:51:26 +0000 (11:51 -0800)]
crypto/sha3: fix sha3_read_ctx reset bug
* lib/sha3.c (sha3_read_ctx): When using OpenSSL, don’t update the
internal context; we’re supposed to read it, not write it.
Instead, clone it and update the clone.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(check): Test for the bug.
Paul Eggert [Sun, 22 Feb 2026 16:53:14 +0000 (08:53 -0800)]
crypto/sha3: fix partial-buffer bug
* lib/sha3.c (sha3_process_bytes):
Update ctx->buflen to 0 if all bytes were processed.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(mismatch): New function.
(check): Check for the bug.
* lib/cdefs.h: Remove an ungrammatical #error diagnostic
that is not needed any more, now that people no longer
try to use glibc or Gnulib with K&R C compilers.
Paul Eggert [Sat, 21 Feb 2026 23:23:26 +0000 (15:23 -0800)]
cdefs: merge from glibc
Also, minimize whitespace differences from glibc,
to simplify comparison.
* lib/cdefs.h: Do not issue header warning if C++.
(__COLD, __attribute_overloadable__, __REDIRECT_FORTIFY)
(__REDIRECT_FORTIFY_NTH, __glibc_const_generic)
(__attribute_struct_may_alias__): New macros.
Several other new macros are defined if !__GNULIB_CDEFS.
(__glibc_safe_or_unknown_len): Check that __osz is a constant.
(__REDIRECT_LDBL): Optimize error redirects for ieeelongdouble.
(__fortified_attr_access): Drop access attribute for _FORTIFY_SOURCE=3.
Bruno Haible [Thu, 19 Feb 2026 14:00:04 +0000 (15:00 +0100)]
cycle-check: Relicense under LGPLv2+.
Jim Meyering's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00109.html>.
Paul Eggert's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00106.html>.
Pádraig Brady [Mon, 16 Feb 2026 11:21:57 +0000 (11:21 +0000)]
parse-datetime: avoid false test failure on windows
* tests/test-parse-datetime.c: Tweak so that year 2003 rather than 0003
is used, as the latter is not supported by mktime on Windows or Cygwin.
Reported by Bruno Haible.
Paul Eggert [Sun, 15 Feb 2026 02:59:54 +0000 (18:59 -0800)]
fchownat: port to IBM XL C for AIX 16.1
* lib/chown.c (rpl_chown):
* lib/fchownat.c (rpl_fchownat):
* lib/lchown.c (rpl_lchown):
Avoid using designated initializers (or even ordinary initializers)
in a way that provokes a bug in IBM XL C for AIX 16.1 (2018).
IBM says they will support this old compiler through April 2026
with extended support through April 2029.
Paul Eggert [Sun, 15 Feb 2026 02:50:17 +0000 (18:50 -0800)]
stdcountof-h: port to IBM XL C for AIX 16.1
Improve the test for the bug in MSVC and Oracle Developer Studio
so that it does not rely on symbols like _MSC_VER and so is more
likely to be portable to other compilers that have the bug, e.g.,
IBM XL C for AIX 16.1. Also, document bug since countof exposes it.
* doc/posix-headers/stdcountof.texi: New file.
* tests/test-stdcountof-h.c (a, b, c): Remove these extern decls.
(call_count): New static var.
(do_call): New static function.
(test_func): Use it to test whether the compiler bug exists with
sizeof, and if so, to skip the countof test.
Reported by Eric Blake in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00028.html>.
* m4/obstack-printf.m4 (gl_FUNC_OBSTACK_PRINTF_REPLACE): New macro,
extracted from gl_FUNC_OBSTACK_PRINTF.
(gl_FUNC_OBSTACK_PRINTF): Invoke it.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX_REPLACE): New
macro, extracted from gl_FUNC_OBSTACK_PRINTF_POSIX.
(gl_FUNC_OBSTACK_PRINTF_POSIX): Require gl_FUNC_OBSTACK_PRINTF_REPLACE.
* m4/obstack-printf-gnu.m4 (gl_FUNC_OBSTACK_PRINTF_GNU_REPLACE): New
macro, extracted from gl_FUNC_OBSTACK_PRINTF_GNU.
(gl_FUNC_OBSTACK_PRINTF_GNU): Require gl_FUNC_OBSTACK_PRINTF_REPLACE.
Pádraig Brady [Mon, 9 Feb 2026 17:06:11 +0000 (17:06 +0000)]
parse-datetime: support dd.mm. in combination
* lib/parse-datetime.y: The previous commit added DD.MM. and DD.MM.YYYY
grammar rules, plus lexer logic (NOT_DECIMAL flag) to prevent 17.6 from
being lexed as a single decimal token. The resulting shift/reduce
conflict between the two rules caused "1.2. 6:7:8.9" to consume 6 as
a year. Also the NOT_DECIMAL flag was never cleared in the DD.MM. case,
later preventing 8.9 from being lexed as a decimal.
Since the lexer already distinguishes the contiguous 1.2.3 and spaced,
we introduce tUNUMBER_DOTTED so each rule expects different tokens,
thus removing the shift/reduce conflict. Also we clear NOT_DECIMAL
in the normal path.
* tests/test-parse-datetime.c: Add test cases.
Sergei Litvin [Mon, 9 Feb 2026 01:24:30 +0000 (02:24 +0100)]
poll: When setting POLLHUP in revents, set also POLLIN and POLLRDNORM.
This fixes a hang of wget2 on Windows
<https://gitlab.com/gnuwget/wget2/-/issues/715>.
* lib/poll.c (windows_compute_revents_socket): Set POLLIN and POLLRDNORM
whenever lNetworkEvents has one of the bits FD_READ, FD_ACCEPT, FD_CLOSE
set.
(compute_revents): Set POLLIN and POLLRDNORM whenever fd is set in
rfds[].
* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Mention that --with-openssl=yes
will use libcrypto and --with-openssl=no will use a fallback
implementation provided by gnulib.
Gabriel [Sat, 7 Feb 2026 14:12:45 +0000 (14:12 +0000)]
parse-datetime: support dd.mm.yy format
* doc/parse-datetime.texi: Document dd.mm.yy support.
* lib/parse-datetime.y: Add grammar for dd.mm.yy and dd.mm.,
and logic to distinguish from tUDECIMAL_NUMBER.
Collin Funk [Sat, 7 Feb 2026 22:43:47 +0000 (14:43 -0800)]
doc: Fix links to headers removed in POSIX.1-2024 (regr. 2024-07-20).
* doc/posix-headers/stropts.texi: Use the POSIX.1-2017 link where this
header exists.
* doc/posix-headers/trace.texi: Likewise.
* doc/posix-headers/ulimit.texi: Likewise.
* doc/posix-headers/utime.texi: Likewise.
Pádraig Brady [Sat, 7 Feb 2026 21:10:47 +0000 (21:10 +0000)]
gendocs: support compound $MAKEINFO
* build-aux/gendocs.sh: Use eval consistently with $MAKEINFO,
to support it being a compound command. In coreutils at least,
it has the value: SHELL='/bin/sh' build-aux/makeinfo-wrapper.sh
Reported by Collin Funk.
Pádraig Brady [Mon, 2 Feb 2026 19:56:52 +0000 (19:56 +0000)]
maintainer-makefile: propagate MAKEINFO to gendocs
* top/maint.mk (web-manual): Propagate MAKEINFO explicitly,
rather than requiring it exported in the environment,
which can be awkward on Solaris make for example.
Reported by Pádraig Brady in
<https://lists.gnu.org/r/bug-gnulib/2026-02/msg00027.html>.
* build-aux/do-release-commit-and-tag: The stub_line number is
relative to the --stub-lines sed address, so offset it accordingly.
Zack Weinberg [Tue, 3 Feb 2026 16:34:15 +0000 (11:34 -0500)]
maintainer-makefile: Avoid false positives of unsigned_* syntax checks.
* top/maint.mk (sc_unsigned_char, sc_unsigned_short, sc_unsigned_int,
sc_unsigned_log): Add ‘exclude’ patterns so that these tests do not
throw a false positive on their own commentary.