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.
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.
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.
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.
* top/maint.mk (gnulib-version): Use git only when possible,
falling back to GNULIB_REVISION or ChangeLog date otherwise. Use
consistent full identifier.
Jim Meyering [Sat, 28 Dec 2024 17:42:21 +0000 (18:42 +0100)]
git-version-gen: fix preceding change
* build-aux/git-version-gen: Use the contents of the -git file
when its first line has the proper form (fixing a reversed test).
Also, reference the file only once, rather than three times.
Also, double quote $tarball_version_file in preexisting code.
Jim Meyering [Sat, 28 Dec 2024 17:35:08 +0000 (09:35 -0800)]
git-version-gen: fix preceding change
* build-aux/git-version-gen: Use the contents of the -git file
when its first line has the proper form (fixing a reversed test).
Also, reference the file only once, rather than three times.
Also, double quote $tarball_version_file in preexisting code.
Bruno Haible [Sat, 28 Dec 2024 15:47:16 +0000 (16:47 +0100)]
endian: Fix compilation error on NetBSD 7.1.
* m4/endian_h.m4 (gl_ENDIAN_H): Test for <sys/endian.h>. Set
HAVE_SYS_ENDIAN_H.
* lib/endian.in.h: Test HAVE_SYS_ENDIAN_H as an alternative to
HAVE_ENDIAN_H.
* modules/endian (Makefile.am): Substitute HAVE_SYS_ENDIAN_H.