]> Savannah Git Hosting - gnulib.git/log
gnulib.git
3 months agocrc-x86_64: port to old GCC compilers
Paul Eggert [Fri, 17 Jan 2025 18:39:38 +0000 (10:39 -0800)]
crc-x86_64: port to old GCC compilers

* m4/crc-x86_64.m4 (gl_CRC_X86_64_PCLMUL):
Check that the compiler supports __m128i_u, too,
since we’re using the type now.  Issue reported in
the same message from Lasse Collin.

3 months agocrc-x86_64: better fix for unaligned access
Paul Eggert [Fri, 17 Jan 2025 18:27:55 +0000 (10:27 -0800)]
crc-x86_64: better fix for unaligned access

Avoid undefined behavior in a way that doesn’t require
the input buffer to be aligned.
From a suggestion by Lasse Collin in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00148.html
* lib/crc-x86_64-pclmul.c (crc32_update_no_xor_pclmul):
Since the const void * pointer ‘buf’ might not be aligned,
assign it to const __m128i_u * instead of to const __m128i *.
* lib/crc.c (crc32_update_no_xor):
Remove recently-addeda check for buffer alignment.

3 months agoAvoid -Wformat=security failures with --disable-nls
Pádraig Brady [Fri, 17 Jan 2025 13:01:40 +0000 (13:01 +0000)]
Avoid -Wformat=security failures with --disable-nls

This was noticed with GCC 14.

* lib/xmemcoll.c: Always use format arguments.
* lib/xprintf.c: Likewise.

3 months agocrc-x86_64: fix unaligned access
Paul Eggert [Fri, 17 Jan 2025 06:58:55 +0000 (22:58 -0800)]
crc-x86_64: fix unaligned access

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00142.html
* lib/crc.c (crc32_update_no_xor): Don’t pass unaligned buffer to
crc32_update_no_xor_pclmul.  No doubt there is a higher
performance fix, perhaps involving advancing byte-by-byte along
the buffer until we get to an aligned boundary, but at least this
should fix the alignment bug.

3 months agogetopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).
Bruno Haible [Thu, 16 Jan 2025 22:10:10 +0000 (23:10 +0100)]
getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).

Reported by G. Branden Robinson <g.branden.robinson@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00135.html>.

* lib/getopt-pfx-core.h: On several platforms, include <unistd.h> first.
* modules/getopt-posix (Files): Add m4/musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.

3 months agowchar_h: Fix for glibc 2.5.
Bruno Haible [Thu, 16 Jan 2025 20:14:45 +0000 (21:14 +0100)]
wchar_h: Fix for glibc 2.5.

* lib/wchar.in.h (__need_wint_t): Clean up after including glibc's
<wchar.h>.

3 months agofile-has-acl: handle listxattr returning ENOTSUP
Pádraig Brady [Wed, 15 Jan 2025 23:30:24 +0000 (23:30 +0000)]
file-has-acl: handle listxattr returning ENOTSUP

listxattr() was seen to return ENOTSUP on virtiofs,
which resulted in ls outputting "Not supported" errors.

* lib/file-has-acl.c (aclinfo_may_indicate_xattr): Treat any
non valid acl errno as being inconclusive as to whether there
are xattrs available.

3 months agolibgmp-mpz: Respect Automake's silent-rules.
Collin Funk [Thu, 16 Jan 2025 04:27:34 +0000 (20:27 -0800)]
libgmp-mpz: Respect Automake's silent-rules.

* modules/libgmp-mpz (Depends-on): Depend on gen-header.
(Makefile.am): Prefix commands with $(AM_V_GEN), $(gl_V_at), and
$(AM_V_at).

3 months agoassert-h: Fix compilation error with gcc >= 13 on Solaris 11.
Bruno Haible [Tue, 14 Jan 2025 21:47:43 +0000 (22:47 +0100)]
assert-h: Fix compilation error with gcc >= 13 on Solaris 11.

Reported by Pádraig Brady <P@draigBrady.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00120.html>.

* m4/assert_h.m4 (gl_ASSERT_H): Don't assume that on Solaris with gcc or
clang, static_assert works: /usr/include/assert.h is in the way.

3 months agogit-version-gen: Fix makefile rule typo, suggested by Bruno.
Simon Josefsson [Tue, 14 Jan 2025 15:21:08 +0000 (16:21 +0100)]
git-version-gen: Fix makefile rule typo, suggested by Bruno.

* build-aux/git-version-gen: Typo fix.

3 months agogit-version-gen: Use an indirect 'dist-hook' make rule instead.
Simon Josefsson [Tue, 14 Jan 2025 06:25:24 +0000 (07:25 +0100)]
git-version-gen: Use an indirect 'dist-hook' make rule instead.

* build-aux/git-version-gen: Doc fix.

3 months agofts, savedir: avoid glibc 2.2 readdir ENOENT bug
Paul Eggert [Mon, 13 Jan 2025 18:17:21 +0000 (10:17 -0800)]
fts, savedir: avoid glibc 2.2 readdir ENOENT bug

This is mostly to document the bug.
If these old platforms were still common I suppose we should
change the readdir module to work around it.  However, I’m not
sure it’s worth the hassle at this point.
* doc/posix-functions/readdir.texi, doc/posix-functions/readdir_r.texi:
Document the bug.
* lib/fts.c (fts_build):
* lib/savedir.c (streamsavedir):
Work around it.

3 months agostdlib-h: Define WCOREDUMP, as required by POSIX:2024.
Bruno Haible [Mon, 13 Jan 2025 09:04:04 +0000 (10:04 +0100)]
stdlib-h: Define WCOREDUMP, as required by POSIX:2024.

* lib/stdlib.in.h: Include <sys/wait.h> also when WCOREDUMP is not
defined.
* doc/posix-headers/stdlib.texi: Document the glibc bug.

3 months agocrc: Respect Automake's silent-rules.
Collin Funk [Mon, 13 Jan 2025 06:28:44 +0000 (22:28 -0800)]
crc: Respect Automake's silent-rules.

* modules/crc (Makefile.am): Add the $(AM_V_GEN) prefix before the
command.

3 months agoprogname: also set program_invocation_short_name
Pádraig Brady [Sun, 12 Jan 2025 16:47:57 +0000 (16:47 +0000)]
progname: also set program_invocation_short_name

* lib/progname.c (set_program_name): Keep program_invocation_name
and program_invocation_short_name consistent.

3 months agofile-has-acl: handle NFSv4 ACLs with listxattr returning EACCES
Pádraig Brady [Sat, 11 Jan 2025 16:40:33 +0000 (16:40 +0000)]
file-has-acl: handle NFSv4 ACLs with listxattr returning EACCES

* lib/file-has-acl.c (has_xattr): A new helper function to
lookup aclinfo for the xattr or fallback to getxattr() if appropriate.
(get_aclinfo): Use has_xattr() rather than aclinfo_has_xattr().
Discussed at <https://bugs.gnu.org/74692>

3 months agosys_un-h: Document the glibc bug.
Bruno Haible [Sat, 11 Jan 2025 14:45:30 +0000 (15:45 +0100)]
sys_un-h: Document the glibc bug.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>.

* doc/posix-headers/sys_un.texi: Mention the glibc bug.

3 months agosys_socket-h: Fix configuration mistake (regression yesterday).
Bruno Haible [Sat, 11 Jan 2025 14:38:49 +0000 (15:38 +0100)]
sys_socket-h: Fix configuration mistake (regression yesterday).

* m4/sys_socket_h.m4 (gl_SYS_SOCKET_H): Test
ac_cv_type_struct_sockaddr_storage after invoking
gl_PREREQ_SYS_SA_FAMILY, not before.

3 months agoeealloc, malloca: Fix module dependencies.
Bruno Haible [Sat, 11 Jan 2025 14:20:48 +0000 (15:20 +0100)]
eealloc, malloca: Fix module dependencies.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>.

* modules/eealloc (Depends-on): Add stdlib-h.
* modules/malloca (Depends-on): Likewise.

3 months agocanonicalize: Fix module dependencies.
Bruno Haible [Sat, 11 Jan 2025 14:19:57 +0000 (15:19 +0100)]
canonicalize: Fix module dependencies.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>.

* modules/canonicalize (Depends-on): Add stdlib-h.

3 months agosys_un-h: Ensure that <sys/un.h> defines sa_family_t.
Bruno Haible [Fri, 10 Jan 2025 22:52:54 +0000 (23:52 +0100)]
sys_un-h: Ensure that <sys/un.h> defines sa_family_t.

* lib/sys_un.in.h: Include <sys/socket.h> or define sa_family_t
explicitly.
* m4/sys_socket_h.m4 (gl_PREREQ_SYS_SA_FAMILY): New macro, extracted
from gl_SYS_SOCKET_H.
(gl_SYS_SOCKET_H): Invoke it.
(gl_SYS_SOCKET_H_DEFAULTS): Don't initialize HAVE_SA_FAMILY_T.
* m4/sys_un_h.m4 (gl_SYS_UN_H): Invoke gl_PREREQ_SYS_SA_FAMILY. Test
whether <sys/un.h> defines sa_family_t. If not, set GL_GENERATE_SYS_UN_H
to true.
* modules/sys_un-h (Makefile.am): Substitute HAVE_SA_FAMILY_T,
HAVE_SA_FAMILY_T_IN_SYS_UN_H.
* tests/test-sys_un-h.c: Include intprops.h. Verify that sa_family_t is
defined and an unsigned integer type.
* modules/sys_un-h-tests (Depends-on): Add intprops.
* doc/posix-headers/sys_un.texi: Mention the problem with sa_family_t.

3 months agosys_wait-h: Document WCOREDUMP fix.
Bruno Haible [Fri, 10 Jan 2025 20:29:56 +0000 (21:29 +0100)]
sys_wait-h: Document WCOREDUMP fix.

* doc/posix-headers/sys_wait.texi: Mention the portability problem with
WCOREDUMP.

3 months agosys_wait-h tests: Check that WCOREDUMP is defined.
Collin Funk [Fri, 10 Jan 2025 19:34:06 +0000 (11:34 -0800)]
sys_wait-h tests: Check that WCOREDUMP is defined.

* tests/test-sys_wait-h.h (test_sys_wait_macros): Check that WCOREDUMP
is defined and can be used.

3 months agosys_wait-h: Update comment.
Collin Funk [Fri, 10 Jan 2025 19:27:29 +0000 (11:27 -0800)]
sys_wait-h: Update comment.

* lib/sys_wait.in.h (WCOREDUMP): Remove comment about this macro being
non-standardized since it was added by POSIX.1-2024.

3 months agodoc: document some file system portability issues
Paul Eggert [Fri, 10 Jan 2025 18:34:58 +0000 (10:34 -0800)]
doc: document some file system portability issues

* doc/glibc-functions/flistxattr.texi:
* doc/glibc-functions/listxattr.texi:
* doc/glibc-functions/llistxattr.texi:
* doc/posix-functions/fchdir.texi, doc/posix-functions/fstat.texi:
* doc/posix-functions/fstatvfs.texi:
Document some portability gotchas that Gnulib does not work around.

3 months agogitlog-to-changelog: Recommend more reliable Makefile rule idiom.
Bruno Haible [Fri, 10 Jan 2025 11:57:01 +0000 (12:57 +0100)]
gitlog-to-changelog: Recommend more reliable Makefile rule idiom.

Reported by Basil L. Contovounesios <basil@contovou.net>.

* doc/gitlog-to-changelog.texi: Make the gen-ChangeLog rule fail if the
ChangeLog file cannot be created or if the disk is full. Drop the use of
an intermediate file, not needed under $(distdir).

3 months agodoc: Fix syntax errors (regression yesterday).
Bruno Haible [Fri, 10 Jan 2025 11:41:35 +0000 (12:41 +0100)]
doc: Fix syntax errors (regression yesterday).

* doc/posix-headers/sys_socket.texi: Fix syntax errors.

3 months agofile-has-acl: port to Linux 6.12 + NFS listxattr
Paul Eggert [Fri, 10 Jan 2025 04:37:13 +0000 (20:37 -0800)]
file-has-acl: port to Linux 6.12 + NFS listxattr

* lib/file-has-acl.c (get_aclinfo): Try the getxattr-related calls
even if [l]listxattr fails with EACCES.  Problem reported by
Pádraig Brady <https://bugs.gnu.org/74692#25>.  Also, treat E2BIG
like EACCES.

3 months agosys_socket-h: Update for POSIX:2024.
Bruno Haible [Thu, 9 Jan 2025 09:12:00 +0000 (10:12 +0100)]
sys_socket-h: Update for POSIX:2024.

* doc/posix-headers/sys_socket.texi: Mention a variety of portability
problems.
* tests/test-sys_socket-h.c: Check for struct sockaddr,
struct sockaddr_storage, struct linger, SOL_SOCKET, SOMAXCONN.
Include macros.h.
(main): Check the socket types, socket options, and some MSG* constants.
* modules/sys_socket-h-tests (Files): Add tests/macros.h.

3 months agobootstrap: Support a tag name as GNULIB_REVISION.
Bruno Haible [Thu, 9 Jan 2025 08:37:41 +0000 (09:37 +0100)]
bootstrap: Support a tag name as GNULIB_REVISION.

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If $GNULIB_REVISION
is a tag name, make sure to add that tag.
* build-aux/bootstrap: Regenerated.

3 months agosys_select-h: Define suseconds_t on native Windows.
Bruno Haible [Thu, 9 Jan 2025 01:08:34 +0000 (02:08 +0100)]
sys_select-h: Define suseconds_t on native Windows.

* lib/sys_select.in.h (suseconds_t): New type.
(GNULIB_defined_suseconds_t): New macro.

3 months agopselect: Document this module.
Bruno Haible [Wed, 8 Jan 2025 21:39:36 +0000 (22:39 +0100)]
pselect: Document this module.

* doc/posix-functions/pselect.texi: Document module 'pselect'.

3 months agosys_select-h: Update for POSIX:2024.
Bruno Haible [Wed, 8 Jan 2025 21:24:13 +0000 (22:24 +0100)]
sys_select-h: Update for POSIX:2024.

* lib/sys_select.in.h (rpl_fd_isset): Change type of second parameter to
'const fd_set *'.
* tests/test-sys_select-h.c: Check for some more types and for
FD_SETSIZE.
(FD_ISSET): Expect type of second parameter to be 'const fd_set *'.

3 months agodoc: Add a comment.
Bruno Haible [Wed, 8 Jan 2025 20:51:43 +0000 (21:51 +0100)]
doc: Add a comment.

* doc/posix-headers/errno.texi: Reference a Haiku bug.

3 months agodoc: Document the previous change.
Bruno Haible [Wed, 8 Jan 2025 09:32:56 +0000 (10:32 +0100)]
doc: Document the previous change.

* doc/posix-headers/fcntl.texi: Document O_SEARCH musl workaround.

3 months agofcntl-h: port better to musl on GNU/Linux
Paul Eggert [Wed, 8 Jan 2025 08:32:23 +0000 (00:32 -0800)]
fcntl-h: port better to musl on GNU/Linux

* lib/fcntl.in.h (O_SEARCH): Redefine to O_RDONLY on musl,
which mistakenly defines it to be O_PATH on GNU/Linux.
Problem reported by Lasse Collin in:
https://bugs.gnu.org/75405

3 months agoservent tests: Fix mistake in previous commit.
Collin Funk [Tue, 7 Jan 2025 02:28:35 +0000 (18:28 -0800)]
servent tests: Fix mistake in previous commit.

Reported by Bruno Haible.

* tests/test-servent.c (getservbyname, getservbyport)
[_WIN32 && !_WIN64 && !__CYGWIN__]: Disable signature check.

3 months agoservent tests: Fix failure on 32-bit native Windows.
Collin Funk [Mon, 6 Jan 2025 21:56:40 +0000 (13:56 -0800)]
servent tests: Fix failure on 32-bit native Windows.

* tests/test-servent.c (getservbyname, getservbyport)
[_WIN64 && !__CYGWIN__]: Disable signature check.
* doc/posix-functions/getservbyname.texi: Document the incompatible
__stdcall function signature.
* doc/posix-functions/getservbyport.texi: Likewise.

3 months agoparse-datetime-tests: port to Gnulib mktime
Paul Eggert [Mon, 6 Jan 2025 04:44:22 +0000 (20:44 -0800)]
parse-datetime-tests: port to Gnulib mktime

Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00040.html
* tests/test-parse-datetime.c (main): Allow both pedantic and
naive interpretation of "now - 35 years", since the main point of
the test introfuced to fix <https://bugs.gnu.org/48085> was that
parse_datetime shouldn’t fail.

3 months agoutimensat: mention Linux kernel bug with CIFS
Paul Eggert [Mon, 6 Jan 2025 01:45:41 +0000 (17:45 -0800)]
utimensat: mention Linux kernel bug with CIFS

* doc/posix-functions/utimensat.texi (utimensat):
Mention Linux kernel bug reported by Bruno Haible in:
https://lists.gnu.org/r/bug-tar/2024-12/msg00004.html

3 months agoparse-datetime: Internationalize 6 more strings.
Bruno Haible [Sun, 5 Jan 2025 23:04:56 +0000 (00:04 +0100)]
parse-datetime: Internationalize 6 more strings.

* lib/parse-datetime.y (dbg_printf, dbg_fputs): Don't invoke _().
(parse_datetime_body): Internationalize 6 dbg_fputs invocations.

3 months agosigsegv tests: Work around a longjmp bug on GNU/Hurd.
Bruno Haible [Mon, 6 Jan 2025 00:16:11 +0000 (01:16 +0100)]
sigsegv tests: Work around a longjmp bug on GNU/Hurd.

* tests/test-sigsegv-catch-stackoverflow1.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Undefine, as a workaround to the Hurd longjmp bug.
* tests/test-sigsegv-catch-stackoverflow2.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Likewise.
* doc/posix-functions/longjmp.texi: Document the Hurd bug.

3 months agoparse-datetime: pacify gcc 14 -Wformat-security
Paul Eggert [Sun, 5 Jan 2025 20:45:47 +0000 (12:45 -0800)]
parse-datetime: pacify gcc 14 -Wformat-security

I found this when updating GNU patch.
* lib/parse-datetime.y (dbg_herald): New static function.
(dbg_printf): Use it.
(dbg_fputs): New static function.  All dbg_printf callers
changed to use it, if their formats contain no directives.
(parse_datetime_body): Call fputs instead of fprintf
if either will do.

3 months agoxstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.
Bruno Haible [Sun, 5 Jan 2025 17:52:47 +0000 (18:52 +0100)]
xstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.

* tests/test-xstrtol.c (main): Update expected test results regarding
Cygwin 2.9.0.

3 months agotests: Don't use module 'getcwd' as dependency.
Bruno Haible [Sun, 5 Jan 2025 12:21:35 +0000 (13:21 +0100)]
tests: Don't use module 'getcwd' as dependency.

* modules/getcwd (Comment): New section.
* modules/xgetcwd (Comment): Likewise.
* modules/xgetcwd-lgpl: New file, based on modules/xgetcwd.
* modules/chown-tests (Depends-on): Add xgetcwd-lgpl. Remove xgetcwd.
* modules/fchownat-tests (Depends-on): Likewise.
* modules/fdutimensat-tests (Depends-on): Likewise.
* modules/futimens-tests (Depends-on): Likewise.
* modules/lchown-tests (Depends-on): Likewise.
* modules/stat-time-tests (Depends-on): Likewise.
* modules/utime-tests (Depends-on): Likewise.
* modules/utimens-tests (Depends-on): Likewise.
* modules/utimensat-tests (Depends-on): Likewise.

3 months agomktime: ease merge of locking code with glibc
Paul Eggert [Sun, 5 Jan 2025 05:08:29 +0000 (21:08 -0800)]
mktime: ease merge of locking code with glibc

This shouldn't affect behavior of either Gnulib or glibc.
* lib/mktime-internal.h (__libc_lock_lock, __libc_lock_unlock)
(__tzset_unlocked) [!_LIBC]: New macros.
* lib/mktime.c (tzset) [!_LIBC]: Define this instead of __tzset,
if defining either.
(__mktime64): Simplify now that mktime-internal defines
libc-specific macros to noops when !_LIBC.

3 months agomktime: improve tm_isdst heuristic
Paul Eggert [Sat, 4 Jan 2025 20:40:11 +0000 (12:40 -0800)]
mktime: improve tm_isdst heuristic

* lib/mktime.c (__mktime_internal): When tm_isdst disagrees with
what was requested, search at most a year (+ stride) from the
requested time for a matching tm_isdst, and ignore the request if
the search fails.  This is more likely to match user expectations
in timezones like Asia/Kolkata.
Problem reported by Florian Weimer in:
https://sourceware.org/pipermail/libc-alpha/2025-January/163342.html

3 months agomktime: support glibc locking
Paul Eggert [Sat, 4 Jan 2025 19:08:32 +0000 (11:08 -0800)]
mktime: support glibc locking

This is part of my attempt to merge glibc and gnulib mktime.c.
It should not affect Gnulib-using code.
* lib/mktime.c [_LIBC]: Include <tzset.h>.
(convert_time, __tz_convert) [_LIBC]: Omit definitions,
since glibc supplies __tz_convert internally.
(__mktime64) [_LIBC]: Lock __tzset_lock while running.

3 months agomktime: prefer bool to int
Paul Eggert [Sat, 4 Jan 2025 18:48:13 +0000 (10:48 -0800)]
mktime: prefer bool to int

* lib/mktime.c (__mktime_internal): Use bool for a boolean local.

3 months agombs_endswith: Fix abort in the case of incomplete characters.
Bruno Haible [Sat, 4 Jan 2025 14:19:46 +0000 (15:19 +0100)]
mbs_endswith: Fix abort in the case of incomplete characters.

Reported by Paul Eggert.

* lib/mbs_endswith.c: Don't include <stdlib.h>.
(mbs_endswith): Instead of aborting, return false.
* tests/test-mbs_endswith2.c (main): Test invalid and incomplete
characters.

3 months agodoc: Deal with tables that are overloaded in info mode.
Bruno Haible [Sat, 4 Jan 2025 09:53:07 +0000 (10:53 +0100)]
doc: Deal with tables that are overloaded in info mode.

Suggested by Paul Eggert.

* doc/strings.texi (Comparison of string APIs): In info mode, use manual
line breaking in the startswith row.
* doc/containers.texi (Ordinary containers): Use different column
proportions in info mode.
(Sequential lists): In info mode, suggest to look at the HTML-formatted
documentation.
* doc/libunistring.texi (<unictype.h> modules): Likewise.

3 months ago*_startswith, *_endswith: Change return type to 'bool'.
Bruno Haible [Sat, 4 Jan 2025 09:17:39 +0000 (10:17 +0100)]
*_startswith, *_endswith: Change return type to 'bool'.

Suggested by Paul Eggert.

* lib/string.in.h (str_startswith, str_endswith, mbs_startswith,
mbs_endswith): Change return type to 'bool'.
* lib/str_startswith.c (str_startswith): Likewise.
* lib/str_endswith.c (str_endswith): Likewise.
* lib/mbs_endswith.c (mbs_endswith): Likewise.
* modules/str_startswith (Depends-on): Add bool.
* modules/str_endswith (Depends-on): Likewise.
* modules/mbs_startswith (Depends-on): Likewise.
* modules/mbs_endswith (Depends-on): Likewise.

4 months agodoc: Mention the new modules.
Bruno Haible [Fri, 3 Jan 2025 15:38:52 +0000 (16:38 +0100)]
doc: Mention the new modules.

* doc/strings.texi (Comparison of string APIs): Add rows for startswith
and endswith functions.

4 months agodoc: Mention the new modules.
Bruno Haible [Fri, 3 Jan 2025 13:05:57 +0000 (14:05 +0100)]
doc: Mention the new modules.

* doc/strings.texi (Comparison of string APIs): Add rows for startswith
and endswith functions.

4 months agombs_endswith: Add tests.
Bruno Haible [Fri, 3 Jan 2025 12:34:16 +0000 (13:34 +0100)]
mbs_endswith: Add tests.

* tests/test-mbs_endswith1.c: New file.
* tests/test-mbs_endswith2.sh: New file, based on tests/test-mbsstr2.sh.
* tests/test-mbs_endswith2.c: New file.
* tests/test-mbs_endswith3.sh: New file, based on tests/test-mbsstr3.sh.
* tests/test-mbs_endswith3.c: New file.
* modules/mbs_endswith-tests: New file.

4 months agombs_endswith: New module.
Bruno Haible [Fri, 3 Jan 2025 12:32:32 +0000 (13:32 +0100)]
mbs_endswith: New module.

* lib/string.in.h (mbs_endswith): New declaration.
* lib/mbs_endswith.c: New file.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_MBS_ENDSWITH.
* modules/string-h (Makefile.am): Substitute GNULIB_MBS_ENDSWITH.
* modules/mbs_endswith: New file.

4 months agombs_startswith: New module.
Bruno Haible [Fri, 3 Jan 2025 10:17:16 +0000 (11:17 +0100)]
mbs_startswith: New module.

* lib/string.in.h (mbs_startswith): New declaration.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_MBS_STARTSWITH.
* modules/string-h (Makefile.am): Substitute GNULIB_MBS_STARTSWITH.
* modules/mbs_startswith: New file.

4 months agotests: Use str_endswith.
Bruno Haible [Fri, 3 Jan 2025 09:43:15 +0000 (10:43 +0100)]
tests: Use str_endswith.

* tests/test-canonicalize.c (main): Use str_endswith.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-setlocale-w32utf8.c (main): Likewise.
* modules/canonicalize-tests (Depends-on): Add str_endswith.
* modules/canonicalize-lgpl-tests (Depends-on): Likewise.
* modules/setlocale-tests (Depends-on): Likewise.

4 months agogen-uni-tables, get-rusage-data, isatty: Use str_endswith.
Bruno Haible [Fri, 3 Jan 2025 09:38:58 +0000 (10:38 +0100)]
gen-uni-tables, get-rusage-data, isatty: Use str_endswith.

* lib/gen-uni-tables.c (fill_attributes): Use str_endswith.
* lib/get-rusage-data.c (get_rusage_data_via_setrlimit): Likewise.
* lib/isatty.c (IsCygwinConsoleHandle): Likewise.
* modules/gen-uni-tables (Depends-on): Add str_endswith.
* modules/get-rusage-data (Depends-on): Likewise.
* modules/isatty (Depends-on): Likewise.

4 months agotests: Use str_startswith.
Bruno Haible [Fri, 3 Jan 2025 09:23:56 +0000 (10:23 +0100)]
tests: Use str_startswith.

* tests/test-environ.c (main): Use str_startswith.
* tests/test-getprogname.c (main): Likewise.
* tests/test-libtextstyle.c (main): Likewise.
* tests/test-strsignal.c (ASSERT_DESCRIPTION): Likewise.
* modules/environ-tests (Depends-on): Add str_startswith.
* modules/getprogname-tests (Depends-on): Likewise.
* modules/libtextstyle-optional-tests (Depends-on): Likewise.
* modules/strsignal-tests (Depends-on): Likewise.

4 months agogit-merge-changelog, gen-uni-tables: Use str_startswith.
Bruno Haible [Fri, 3 Jan 2025 09:12:08 +0000 (10:12 +0100)]
git-merge-changelog, gen-uni-tables: Use str_startswith.

* lib/git-merge-changelog.c (main): Use str_startswith.
* lib/gen-uni-tables.c (output_predicate, is_property_composite,
is_nonspacing): Likewise.
* modules/git-merge-changelog (Depends-on): Add str_startswith.
* modules/gen-uni-tables (Depends-on): Likewise.

4 months agostr_endswith: Add tests.
Bruno Haible [Fri, 3 Jan 2025 08:59:56 +0000 (09:59 +0100)]
str_endswith: Add tests.

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

4 months agostr_endswith: New module.
Bruno Haible [Fri, 3 Jan 2025 08:54:14 +0000 (09:54 +0100)]
str_endswith: New module.

* lib/string.in.h (str_endswith): New declaration.
* lib/str_endswith.c: New file.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STR_ENDSWITH.
* modules/string-h (Makefile.am): Substitute GNULIB_STR_ENDSWITH.
* modules/str_endswith: New file.

4 months agostr_startswith: Add tests.
Bruno Haible [Fri, 3 Jan 2025 08:33:01 +0000 (09:33 +0100)]
str_startswith: Add tests.

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

4 months agostr_startswith: New module.
Bruno Haible [Fri, 3 Jan 2025 08:26:14 +0000 (09:26 +0100)]
str_startswith: New module.

* lib/string.in.h (str_startswith): New declaration.
* lib/str_startswith.c: New file.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STR_STARTSWITH.
* modules/string-h (Makefile.am): Substitute GNULIB_STR_STARTSWITH.
* modules/str_startswith: New file.

4 months agognulib-l10n: Clarify the license of the POT file.
Bruno Haible [Thu, 2 Jan 2025 14:57:15 +0000 (15:57 +0100)]
gnulib-l10n: Clarify the license of the POT file.

Reported by Simon Josefsson. Suggested by Benno Schulenberg.

* po/Makefile ($(DOMAIN).pot): Replace the license notice line.

4 months agostring-desc, xstring-desc, string-desc-quotearg: Rename functions.
Bruno Haible [Thu, 2 Jan 2025 12:54:54 +0000 (13:54 +0100)]
string-desc, xstring-desc, string-desc-quotearg: Rename functions.

* lib/string-desc.h (sd_equals): Renamed from string_desc_equals.
(sd_startswith): Renamed from string_desc_startswith.
(sd_endswith): Renamed from string_desc_endswith.
(sd_cmp): Renamed from string_desc_cmp.
(sd_c_casecmp): Renamed from string_desc_c_casecmp.
(sd_index): Renamed from string_desc_index.
(sd_last_index): Renamed from string_desc_last_index.
(sd_contains): Renamed from string_desc_contains.
(sd_new_empty): Renamed from string_desc_new_empty.
(sd_new_addr): Renamed from string_desc_new_addr.
(sd_from_c): Renamed from string_desc_from_c.
(sd_substring): Renamed from string_desc_substring.
(sd_write): Renamed from string_desc_write.
(sd_fwrite): Renamed from string_desc_fwrite.
(sd_new): Renamed from string_desc_new.
(sd_new_filled): Renamed from string_desc_new_filled.
(sd_copy): Renamed from string_desc_copy.
(sd_concat): Renamed from string_desc_concat.
(sd_c): Renamed from string_desc_c.
(sd_set_char_at): Renamed from string_desc_set_char_at.
(sd_fill): Renamed from string_desc_fill.
(sd_overwrite): Renamed from string_desc_overwrite.
(sd_free): Renamed from string_desc_free.
(sd_length): Renamed from string_desc_length.
(sd_char_at): Renamed from string_desc_char_at.
(sd_data): Renamed from string_desc_data.
(sd_is_empty): Renamed from string_desc_is_empty.
* lib/string-desc.c (sd_equals): Renamed from string_desc_equals.
(sd_startswith): Renamed from string_desc_startswith.
(sd_endswith): Renamed from string_desc_endswith.
(sd_cmp): Renamed from string_desc_cmp.
(sd_c_casecmp): Renamed from string_desc_c_casecmp.
(sd_index): Renamed from string_desc_index.
(sd_last_index): Renamed from string_desc_last_index.
(sd_new_empty): Renamed from string_desc_new_empty.
(sd_new_addr): Renamed from string_desc_new_addr.
(sd_from_c): Renamed from string_desc_from_c.
(sd_substring): Renamed from string_desc_substring.
(sd_write): Renamed from string_desc_write.
(sd_fwrite): Renamed from string_desc_fwrite.
(sd_new): Renamed from string_desc_new.
(sd_new_filled): Renamed from string_desc_new_filled.
(sd_copy): Renamed from string_desc_copy.
(sd_concat): Renamed from string_desc_concat.
(sd_c): Renamed from string_desc_c.
(sd_set_char_at): Renamed from string_desc_set_char_at.
(sd_fill): Renamed from string_desc_fill.
(sd_overwrite): Renamed from string_desc_overwrite.
(sd_free): Renamed from string_desc_free.
* lib/xstring-desc.h (xsd_concat): Renamed from xstring_desc_concat.
(xsd_new): Renamed from xstring_desc_new.
(xsd_new_filled): Renamed from xstring_desc_new_filled.
(xsd_copy): Renamed from xstring_desc_copy.
(xsd_c): Renamed from xstring_desc_c.
* lib/xstring-desc.c (xsd_concat): Renamed from xstring_desc_concat.
* lib/string-desc-quotearg.h (sd_quotearg_buffer): Renamed from
string_desc_quotearg_buffer.
(sd_quotearg_alloc): Renamed from string_desc_quotearg_alloc.
(sd_quotearg_n): Renamed from string_desc_quotearg_n.
(sd_quotearg): Renamed from string_desc_quotearg.
(sd_quotearg_n_style): Renamed from string_desc_quotearg_n_style.
(sd_quotearg_style): Renamed from string_desc_quotearg_style.
(sd_quotearg_char): Renamed from string_desc_quotearg_char.
(sd_quotearg_colon): Renamed from string_desc_quotearg_colon.
(sd_quotearg_n_custom): Renamed from string_desc_quotearg_n_custom.
(sd_quotearg_custom): Renamed from sd_quotearg_n_custom.
* lib/string-desc-contains.c (sd_contains): Renamed from
string_desc_contains.
* lib/string-buffer.h: Update.
* lib/string-buffer.c (sb_append_desc, sb_contents, sb_dupfree): Update.
* lib/xstring-buffer.c (sb_xdupfree): Update.
* lib/sf-istream.c (sf_istream_init_from_string_desc): Update.
* tests/test-string-desc.c (main): Update.
* tests/test-string-desc.sh: Update.
* tests/test-xstring-desc.c (main): Update.
* tests/test-string-desc-quotearg.c (main): Update.
* tests/test-string-buffer.c (main): Update.
* tests/test-sf-istream.c (main): Update.
* tests/test-sfl-istream.c (main): Update.
* doc/string-desc.texi: Update.
* doc/strings.texi: Update.
* NEWS: Mention the change.

4 months agomaintainer-makefile: Improve gnulib-version handling.
Simon Josefsson [Thu, 2 Jan 2025 08:28:48 +0000 (09:28 +0100)]
maintainer-makefile: Improve gnulib-version handling.

* top/maint.mk (gnulib-version): Prefix commit id with human
readable leading ChangeLog date, suggested by Bruno Haible.
(announcement): Handle multi-word gnulib-version.

4 months agodoc: Update regarding stable branches.
Bruno Haible [Wed, 1 Jan 2025 23:42:27 +0000 (00:42 +0100)]
doc: Update regarding stable branches.

* doc/gnulib-readme.texi (Stable Branches): Mention new branch
stable-202501. Mention that stable-202401 is no longer updated.

4 months agoautoupdate
Paul Eggert [Wed, 1 Jan 2025 22:52:39 +0000 (14:52 -0800)]
autoupdate

4 months agomaint: update copyrights by hand
Paul Eggert [Wed, 1 Jan 2025 19:31:58 +0000 (11:31 -0800)]
maint: update copyrights by hand

This fixes some copyright dates that were not updated
correctly by "make update-copyright".

4 months agomaint: run 'make update-copyright'
Pádraig Brady [Wed, 1 Jan 2025 09:24:36 +0000 (09:24 +0000)]
maint: run 'make update-copyright'

4 months agomaint: update update-copyright for Emacs
Paul Eggert [Wed, 1 Jan 2025 07:46:36 +0000 (23:46 -0800)]
maint: update update-copyright for Emacs

* build-aux/update-copyright: Add support for Emacs, which
uses file names like Changelog.1 that are not man pages,
and file names like emacs.1.in that are man page templates.

4 months agoservent tests: Fix failure due to missing htons declaration.
Collin Funk [Wed, 1 Jan 2025 03:51:26 +0000 (19:51 -0800)]
servent tests: Fix failure due to missing htons declaration.

* modules/servent-tests (Depends-on): Add htonl.
(Makefile.am): Link program to $(HTONL_LIB).
* tests/test-servent.c (main): Fix formatting and typo.

4 months agoservent: Make sure netdb.h is generated.
Collin Funk [Wed, 1 Jan 2025 03:43:28 +0000 (19:43 -0800)]
servent: Make sure netdb.h is generated.

* modules/servent (Depends-on): Add netdb-h.

4 months agogetcwd: Return "/bin" instead of "//bin" on Adélie Linux.
Bruno Haible [Tue, 31 Dec 2024 18:38:42 +0000 (19:38 +0100)]
getcwd: Return "/bin" instead of "//bin" on Adélie Linux.

Reported by Zach van Rijn <me@zv.io> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00072.html>
and <https://git.adelielinux.org/adelie/packages/-/issues/987>.

* lib/getcwd.c (__getcwd_generic): Remove a trailing slash from the
result of readlink().

4 months agoservent: Add tests.
Collin Funk [Tue, 31 Dec 2024 03:00:01 +0000 (19:00 -0800)]
servent: Add tests.

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

4 months agombfile: Support pushback characters also right before EOF.
Bruno Haible [Tue, 31 Dec 2024 01:09:47 +0000 (02:09 +0100)]
mbfile: Support pushback characters also right before EOF.

* lib/mbfile.h (mbfile_multi_getc): Read pushed-back character before
testing for sticky EOF.
* tests/test-mbfile.c (main): Test pushback at EOF.

4 months agombfile: Allow 2 pushback characters.
Bruno Haible [Tue, 31 Dec 2024 00:39:03 +0000 (01:39 +0100)]
mbfile: Allow 2 pushback characters.

* lib/mbfile.h: Include <stdlib.h>.
(MBFILE_MAX_PUSHBACK): New macro.
(struct mbfile_multi): Replace field 'have_pushback' with
'pushback_count'. Make field 'pushback' an array.
(mbfile_multi_getc, mbfile_multi_ungetc): Handle multiple pushback
characters.
(mbf_init): Update.

4 months agobcp47: Handle language variants.
Bruno Haible [Tue, 31 Dec 2024 00:07:47 +0000 (01:07 +0100)]
bcp47: Handle language variants.

Reported by Balló György <ballogyor@gmail.com> at
<https://savannah.gnu.org/bugs/?66620>.

* lib/bcp47.c (xpg_to_bcp47, bcp47_to_xpg): Handle variants.
* tests/test-bcp47.c (main): Test a regional variant.

4 months agodoc: Revisit some index entries.
Bruno Haible [Mon, 30 Dec 2024 14:38:51 +0000 (15:38 +0100)]
doc: Revisit some index entries.

* doc/attribute.texi: Refer to the 'attribute' module.
* doc/verify.texi: Refer to the 'verify' module.
* doc/noreturn.texi: Remove duplicate index entries.

4 months agodoc: Document the 'inline' module.
Bruno Haible [Mon, 30 Dec 2024 14:17:42 +0000 (15:17 +0100)]
doc: Document the 'inline' module.

* doc/static-inline.texi: Document the 'inline' module.
* m4/inline.m4: Fix comment.

4 months agosignal: Deprecate old stub module.
Bruno Haible [Mon, 30 Dec 2024 10:16:27 +0000 (11:16 +0100)]
signal: Deprecate old stub module.

* modules/signal: Mark as deprecated.

4 months agoqsort_r: Update documentation.
Bruno Haible [Sun, 29 Dec 2024 22:06:06 +0000 (23:06 +0100)]
qsort_r: Update documentation.

* modules/qsort_r (Description): Say "POSIX signature".
* doc/posix-functions/qsort_r.texi: Mention the qsort_r module.

4 months agogit-version-gen: reinstate executable permission
Pádraig Brady [Sun, 29 Dec 2024 21:39:42 +0000 (21:39 +0000)]
git-version-gen: reinstate executable permission

* build-aux/git-version-gen: chmod a+x

4 months agosig2str: Document a portability problem.
Bruno Haible [Sun, 29 Dec 2024 20:15:16 +0000 (21:15 +0100)]
sig2str: Document a portability problem.

* doc/posix-functions/sig2str.texi: Document IRIX problem.
* doc/posix-functions/str2sig.texi: Likewise.

4 months agodoc: Document the advanced FILE stream functions.
Bruno Haible [Sun, 29 Dec 2024 20:01:27 +0000 (21:01 +0100)]
doc: Document the advanced FILE stream functions.

* doc/stdioext.texi: New file.
* doc/gnulib.texi (Particular Modules): Include it.

4 months agosignal-h tests: Check that SIG2STR_MAX is properly defined.
Collin Funk [Sun, 29 Dec 2024 19:56:28 +0000 (11:56 -0800)]
signal-h tests: Check that SIG2STR_MAX is properly defined.

* modules/signal-h-tests (Depends-on): Add assert-h.
* tests/test-signal-h.c: Check that SIG2STR_MAX is defined to a
positive integer.

4 months agosig2str tests: Add signature check.
Collin Funk [Sun, 29 Dec 2024 19:30:59 +0000 (11:30 -0800)]
sig2str tests: Add signature check.

* modules/sig2str-tests (Files): Add tests/signature.h.
* tests/test-sig2str.c: Include signal.h instead of sig2str.h. Check the
function signature of sig2str and str2sig.

4 months agodoc: Document the modules for containers.
Bruno Haible [Sun, 29 Dec 2024 17:47:11 +0000 (18:47 +0100)]
doc: Document the modules for containers.

* doc/containers.texi: Document the modules for each container data
type.

4 months agodoc: Omit internal modules from the "Undocumented modules" index.
Bruno Haible [Sun, 29 Dec 2024 17:16:27 +0000 (18:16 +0100)]
doc: Omit internal modules from the "Undocumented modules" index.

* doc/internal-modules: New file.
* doc/Makefile (undocumented-modules.texi): Filter out the internal
modules.

4 months agodoc: Add missing module index.
Collin Funk [Sun, 29 Dec 2024 02:11:03 +0000 (18:11 -0800)]
doc: Add missing module index.

Suggested by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-12/msg00240.html>.

* doc/posix-functions/getservbyname.texi (getservbyname): Add module
index.
* doc/posix-functions/getservbyport.texi (getservbyport): Likewise.

4 months agodoc: Fix the previous commit.
Collin Funk [Sun, 29 Dec 2024 01:26:28 +0000 (17:26 -0800)]
doc: Fix the previous commit.

Suggested by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-12/msg00236.html>.

* doc/posix-functions/getservbyname.texi: Mention the Windows
declaration under "Portability problems fixed by Gnulib".
* doc/posix-functions/getservbyport.texi: Likewise.

4 months agodoc: Mention the servent module.
Collin Funk [Sun, 29 Dec 2024 00:19:01 +0000 (16:19 -0800)]
doc: Mention the servent module.

* doc/posix-functions/getservbyname.texi: Document that the servent
module will provide the declarations in netdb.h.
* doc/posix-functions/getservbyport.texi: Likewise.

4 months agogit-version-gen: avoid use of grep, suggested by Jim Meyering.
Simon Josefsson [Sat, 28 Dec 2024 20:19:18 +0000 (21:19 +0100)]
git-version-gen: avoid use of grep, suggested by Jim Meyering.

* build-aux/git-version-gen: Use /bin/sh case instead.

4 months agogit-version-gen: fix preceding change
Simon Josefsson [Sat, 28 Dec 2024 17:57:46 +0000 (18:57 +0100)]
git-version-gen: fix preceding change

* build-aux/git-version-gen: Do use *-git content when keyword
is not present.  Move post-processing later.  Doc fixes.

4 months agodoc: Omit deprecated modules from the "Undocumented modules" index.
Bruno Haible [Sat, 28 Dec 2024 19:16:40 +0000 (20:16 +0100)]
doc: Omit deprecated modules from the "Undocumented modules" index.

* doc/Makefile (undocumented-modules.texi): Filter out the deprecated
modules.

4 months agomaintainer-makefile: Improve gnulib-version derivation.
Simon Josefsson [Sat, 28 Dec 2024 18:46:30 +0000 (19:46 +0100)]
maintainer-makefile: Improve gnulib-version derivation.

* top/maint.mk (gnulib-version): Use git only when possible,
falling back to GNULIB_REVISION or ChangeLog date otherwise.  Use
consistent full identifier.

4 months agoannounce-gen: Support VPATH builds better.
Simon Josefsson [Sat, 28 Dec 2024 18:42:43 +0000 (19:42 +0100)]
announce-gen: Support VPATH builds better.

* build-aux/announce-gen: Pass -C$srcdir to git.

4 months agoendian: Fix link error on CentOS 5.
Bruno Haible [Sat, 28 Dec 2024 17:39:24 +0000 (18:39 +0100)]
endian: Fix link error on CentOS 5.

* m4/endian_h.m4 (gl_ENDIAN_H): Use AC_LINK_IFELSE, not
AC_COMPILE_IFELSE.