Bruno Haible [Sun, 19 Jan 2025 09:40:02 +0000 (10:40 +0100)]
attribute: Add note about ongoing standardization of some attributes.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Add note that the meaning of
_GL_ATTRIBUTE_REPRODUCIBLE and _GL_ATTRIBUTE_UNSEQUENCED are likely to
change.
* lib/attribute.h (UNSEQUENCED, REPRODUCIBLE): Likewise.
Paul Eggert [Sun, 19 Jan 2025 07:02:09 +0000 (23:02 -0800)]
flexmember: port to IBM XL C 16.1
* lib/flexmember.h (FLEXALIGNOF): Use the conservative definition
if _Alignof is a macro, to avoid a C99 conformance issue exposed
by IBM XL C 16.1 which otherwise complains "An aggregate
containing a flexible array member cannot be used as a member of a
structure or as an array element."
Paul Eggert [Sun, 19 Jan 2025 06:06:55 +0000 (22:06 -0800)]
alignasof: port to IBM XL C 16.1
* doc/gnulib.texi (alignof):
Improve doc to match implementationa better.
* m4/stdalign.m4 (alignas): Do not define to _Alignas
if __xlC__ claims to conform to C11, because _Alignas fails with
weird diagnostics "Unexpected text %1$s encountered."
* tests/test-alignasof.c (TEST_ALIGNMENT, alignas):
Follow doc advice.
Paul Eggert [Sat, 18 Jan 2025 06:11:54 +0000 (22:11 -0800)]
alignasof: port to IBM XL C V16.1
* m4/stdalign.m4 (gl_ALIGNASOF):
Work around similar bug in IBM XL C V16.1.0 cc (non-clang).
Since this is the last version of this obsolescent compiler,
assume the bug is in earlier versions.
* modules/stdalign, modules/stdalign-h, modules/stdnoreturn:
* modules/stdnoreturn-h: Use more consistent deprecation
warnings, that do not recommend a different deprecated module.
Bruno Haible [Fri, 17 Jan 2025 21:51:55 +0000 (22:51 +0100)]
sys_stat-h: Ensure blksize_t and blkcnt_t are defined.
* tests/test-sys_stat-h.c: Check that blksize_t and blkcnt_t are
defined. Include intprops.h. Check the signedness of various types.
* modules/sys_stat-h-tests (Depends-on): Add intprops.
* doc/posix-headers/sys_stat.texi: Mention the issues with blksize_t and
blkcnt_t.
Bruno Haible [Fri, 17 Jan 2025 21:32:58 +0000 (22:32 +0100)]
sys_types-h: Ensure blksize_t and blkcnt_t are defined.
* lib/sys_types.in.h (blksize_t, blkcnt_t): New definitions.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set HAVE_BLKSIZE_T and
HAVE_BLKCNT_T.
* modules/sys_types-h (Makefile.am): Substitute HAVE_BLKSIZE_T and
HAVE_BLKCNT_T.
* tests/test-sys_types-h.c: Check that blksize_t and blkcnt_t are
defined. Include intprops.h. Check the signedness of various types.
* modules/sys_types-h-tests (Depends-on): Add assert-h, intprops.
* doc/posix-headers/sys_types.texi: Mention the issues with blksize_t
and blkcnt_t.
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.
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.
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.
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.
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>
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.
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.
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).
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.
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 *'.
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
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.
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
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.
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.
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.
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
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.
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.
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.
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.
* 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.
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.
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.
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().
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.
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.