]> Savannah Git Hosting - gnulib.git/log
gnulib.git
20 months agoreadutmp: Fix boot time in VMs after sleep state and date update.
Bruno Haible [Wed, 9 Aug 2023 19:12:40 +0000 (21:12 +0200)]
readutmp: Fix boot time in VMs after sleep state and date update.

* lib/readutmp.c (read_utmp_from_file): New function, extracted from
read_utmp.
(get_boot_time_uncached): Before all other approaches, try to find the
boot time in the /var/run/utmp file.
(read_utmp): Invoke read_utmp_from_file.

20 months agoreadutmp: Make it easier to filter for/against the boot-time entry.
Bruno Haible [Wed, 9 Aug 2023 16:49:22 +0000 (18:49 +0200)]
readutmp: Make it easier to filter for/against the boot-time entry.

* lib/readutmp.h (READ_UTMP_BOOT_TIME, READ_UTMP_NO_BOOT_TIME): New
enum items.
* lib/readutmp.c (desirable_utmp_entry, read_utmp_from_systemd):
Implement them.
(read_utmp): If no entries can match the given options, return
immediately.

20 months agoreadutmp: omit pragma
Paul Eggert [Wed, 9 Aug 2023 02:29:55 +0000 (19:29 -0700)]
readutmp: omit pragma

* lib/readutmp.c: Omit -Sstringop-overread pragma.
It’s no longer needed now that extract_trimmed_name
no longer calls strnlen.

20 months agoreadutmp: Use classical implementation for files != /var/run/utmp.
Bruno Haible [Tue, 8 Aug 2023 21:27:38 +0000 (23:27 +0200)]
readutmp: Use classical implementation for files != /var/run/utmp.

* lib/readutmp.c (read_utmp_from_systemd): Renamed from read_utmp
[READUTMP_USE_SYSTEMD]. Remove file argument.
(read_utmp): Call it when the file argument is "/var/run/utmp".

20 months agoreadutmp: Get the boot time with higher precision.
Bruno Haible [Tue, 8 Aug 2023 19:28:46 +0000 (21:28 +0200)]
readutmp: Get the boot time with higher precision.

Suggested by Thorsten Kukuk <kukuk@suse.com> in
<https://github.com/thkukuk/utmpx/blob/main/utmp-to-logind.md#determine-boot-time>.

* lib/readutmp.c (get_boot_time_uncached): Try clock_gettime first.

20 months agoreadutmp: Add comment about multithread-safety.
Bruno Haible [Tue, 8 Aug 2023 18:27:31 +0000 (20:27 +0200)]
readutmp: Add comment about multithread-safety.

* lib/readutmp.h (read_utmp): Add comment.

20 months agoreadutmp: Return entries with unbounded strings on all platforms.
Bruno Haible [Tue, 8 Aug 2023 15:36:10 +0000 (17:36 +0200)]
readutmp: Return entries with unbounded strings on all platforms.

Suggested  by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00165.html>.

* m4/readutmp.m4 (gl_READUTMP): Test also whether struct utmp has an
ut_tv member, and whether struct utmp and struct utmpx have an
ut_session member.
* lib/readutmp.h (struct gl_utmp): Define always. Add ut_exit field.
(HAVE_GL_UTMP): Remove macro.
(UT_USER, UT_TIME_MEMBER, UT_PID, UT_TYPE_EQ, UT_TYPE_NOT_DEFINED,
UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT, STRUCT_UTMP): Define w.r.t.
struct gl_utmp.
(UT_USER_SIZE, UT_ID_SIZE, UT_LINE_SIZE, UT_HOST_SIZE): Define to -1
always.
(getutent): Remove declaration.
(HAVE_STRUCT_XTMP_UT_EXIT): Remove unused macro.
(HAVE_STRUCT_XTMP_UT_ID, HAVE_STRUCT_XTMP_UT_PID,
HAVE_STRUCT_XTMP_UT_HOST): Change to match the way coreutils uses these
macros.
* lib/readutmp.c (UT_USER, UT_TIME_MEMBER, UT_PID, UT_TYPE_EQ,
UT_TYPE_NOT_DEFINED, IS_USER_PROCESS, UT_EXIT_E_TERMINATION,
UT_EXIT_E_EXIT, UT_USER_SIZE, UT_ID_SIZE, UT_LINE_SIZE, UT_HOST_SIZE):
Define w.r.t. struct utmpx or struct utmp.
(extract_trimmed_name): Don't use UT_USER or UT_USER_SIZE here.
(desirable_utmp_entry): Don't use UT_TIME_MEMBER or UT_USER here.
(struct utmp_alloc): Define always.
(add_utmp): Likewise. Add user_len, id_len, line_len, host_len,
termination, exit arguments. Don't require that user, id, line, host are
NUL-terminated. Assume user and host are non-NULL.
(finish_utmp): New function, extracted from read_utmp.
(read_utmp) [READUTMP_USE_SYSTEMD]: Update add_utmp invocations. Pass a
non-NULL user and a non-NULL host. Call finish_utmp.
(getutent): Move declaration from readutmp.h to here.
(copy_utmp_entry): Remove function.
(read_utmp) [UTMP_NAME_FUNCTION]: Replace variables n_read, n_alloc,
utmp with a 'struct utmp_alloc'. Use 'struct utmpx32' from
copy_utmp_entry here. Invoke add_utmp and finish_utmp.
(read_utmp) [!UTMP_NAME_FUNCTION]: Replace variables n_read, n_alloc,
utmp with a 'struct utmp_alloc'. Invoke add_utmp and finish_utmp.
* NEWS: Mention the API change.

20 months agoreadutmp: Fix compilation error on OpenBSD and AIX (regr. 2023-08-03).
Bruno Haible [Tue, 8 Aug 2023 15:17:42 +0000 (17:17 +0200)]
readutmp: Fix compilation error on OpenBSD and AIX (regr. 2023-08-03).

* lib/readutmp.h (UT_TIME_MEMBER) [HAVE_UTMP_H]: Revert last change.

20 months agoreadutmp: Fix compilation error on OpenBSD (regr. 2023-08-02).
Bruno Haible [Tue, 8 Aug 2023 15:23:24 +0000 (17:23 +0200)]
readutmp: Fix compilation error on OpenBSD (regr. 2023-08-02).

* lib/readutmp.h (UT_ID_SIZE): Define to a dummy if there is no ut_id
field.

20 months agoAdd ChangeLog entries for the last 3 commits.
Paul Eggert [Tue, 8 Aug 2023 12:16:57 +0000 (14:16 +0200)]
Add ChangeLog entries for the last 3 commits.

21 months agoquotearg: fix obsolete comment
Paul Eggert [Mon, 7 Aug 2023 16:10:21 +0000 (09:10 -0700)]
quotearg: fix obsolete comment

* lib/quotearg.h: Fix comment to match behavior.
This fixes a commentary bug introduced in
commit 1a43a982c927eaf26bbc2701a872009d9be4b33b
"quotearg: do not use grave accent for left quote"
dated 2011-12-18 15:44:17+01, where the comment
was not updated to match the changed behavior.

21 months agoreadutmp: fix comment bug ID
Paul Eggert [Sun, 6 Aug 2023 19:43:05 +0000 (12:43 -0700)]
readutmp: fix comment bug ID

* lib/readutmp.c: Fix comment (thanks to Bruno Haible).

21 months agoDocument Android, OpenBSD printf "%n" lack
Paul Eggert [Sun, 6 Aug 2023 19:19:36 +0000 (12:19 -0700)]
Document Android, OpenBSD printf "%n" lack

In doc/posix/functions/*printf*.texi,
document that the POSIX-specified printf functions
do not support the %n format on Android and OpenBSD.
This lack of support is deliberate, as %n is
a common target of attacks on security.

21 months agoreadutmp: anticipate Y2038 hack for utmp
Paul Eggert [Sat, 5 Aug 2023 18:16:12 +0000 (11:16 -0700)]
readutmp: anticipate Y2038 hack for utmp

* lib/readutmp.c (struct utmpx32): Use unsigned int for tv_sec,
not int, as that is more likely to work after 2038.
Suggested by Andreas Schwab in:
https://sourceware.org/pipermail/libc-alpha/2023-August/150661.html

21 months agodiffseq: simplify lint removal
Paul Eggert [Sat, 5 Aug 2023 17:04:41 +0000 (10:04 -0700)]
diffseq: simplify lint removal

* lib/diffseq.h (IF_LINT): Remove.
Instead, always ignore the diagnostic, as that’s simpler
now that we have the pragma change installed in May.
This removes the last IF_LINT from diffutils, though not
the last use of GCC_LINT.

21 months agounistr/{u8-mbtouc,u8-mbsnlen}: Fix test failures (regr. 2023-07-25).
Bruno Haible [Sat, 5 Aug 2023 00:40:03 +0000 (02:40 +0200)]
unistr/{u8-mbtouc,u8-mbsnlen}: Fix test failures (regr. 2023-07-25).

* modules/unistr/u8-mbtouc (configure.ac): Compile this code if the
preinstalled libunistring version is >= 0.9.4, < 1.2.
* modules/unistr/u8-mbsnlen (configure.ac): Likewise.

21 months agounistr/*-pcpy: Fix compilation errors (regression 2023-07-21).
Bruno Haible [Fri, 4 Aug 2023 21:44:27 +0000 (23:44 +0200)]
unistr/*-pcpy: Fix compilation errors (regression 2023-07-21).

* modules/unistr/base (configure.ac): Generate unistr.h if the
preinstalled libunistring version is >= 0.9.11, < 1.2.

21 months agoreadutmp: In systemd mode, fix the ut_host contents (regr. yesterday).
Bruno Haible [Fri, 4 Aug 2023 13:26:37 +0000 (15:26 +0200)]
readutmp: In systemd mode, fix the ut_host contents (regr. yesterday).

* lib/readutmp.c (add_utmp): Fix ut_host contents.
* tests/test-readutmp.c (main): Show also the contents of the ut_host
field.

21 months agoreadutmp: Ensure multithread-safety.
Bruno Haible [Fri, 4 Aug 2023 12:50:04 +0000 (14:50 +0200)]
readutmp: Ensure multithread-safety.

* lib/readutmp.c (get_boot_time): Initialize 'cached' after 'boot_time',
not before. Also declare both as volatile.

21 months agoreadutmp tests: Fix gcc warning (regression from yesterday).
Bruno Haible [Fri, 4 Aug 2023 11:28:27 +0000 (13:28 +0200)]
readutmp tests: Fix gcc warning (regression from yesterday).

* tests/test-readutmp.c: Include idx.h.
(main): Use idx_t instead of size_t.

21 months ago* m4/systemd.m4: Fix --help lineup.
Paul Eggert [Fri, 4 Aug 2023 01:41:52 +0000 (18:41 -0700)]
* m4/systemd.m4: Fix --help lineup.

21 months agoreadutmp: fix comments
Paul Eggert [Fri, 4 Aug 2023 01:27:35 +0000 (18:27 -0700)]
readutmp: fix comments

21 months agoreadutmp: systemd supports only UTMP_FILE
Paul Eggert [Thu, 3 Aug 2023 23:01:52 +0000 (16:01 -0700)]
readutmp: systemd supports only UTMP_FILE

* lib/readutmp.c (read_utmp): Fail if not UTMP_FILE.
* m4/systemd.m4 (gl_SYSTEMD_CHOICE): Default to no for now,
since yes means "who /var/log/wtmp" stops working.

21 months agoreadutmp: switch new struct to struct timespec
Paul Eggert [Thu, 3 Aug 2023 23:01:50 +0000 (16:01 -0700)]
readutmp: switch new struct to struct timespec

* lib/readutmp.c (get_boot_time_uncached, get_boot_time)
(add_utmp, read_utmp):
Use struct timespec, not struct timeval.
* lib/readutmp.h: Always include <time.h>, for struct timespec.
Simplify when utmp.h and utmpx.h are included.
(struct gl_utmp): Use the same struct for both the
systemd and the dummy version.  Reorder members, and
use proper pid_t type for ut_session.  Rename ut_tv to ut_ts
and make it a struct timespec.  All uses changed.
(HAVE_GL_UTMP): New macro.  Use it where appropriate, instead
of READUTMP_USE_SYSTEMD.
(UT_USER, HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID)
(HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_HOST):
Simplify.
* modules/readutmp (Depends-on): Add time-h, timespec_get.
Remove sys_type.  Sort.

21 months agoreadutmp: fix # indentation
Paul Eggert [Thu, 3 Aug 2023 22:54:14 +0000 (15:54 -0700)]
readutmp: fix # indentation

* lib/readutmp.h: Change # indentation to standard Gnulib style.

21 months agoreadutmp: pacify -Wstrict-prototypes
Paul Eggert [Thu, 3 Aug 2023 22:54:12 +0000 (15:54 -0700)]
readutmp: pacify -Wstrict-prototypes

* lib/readutmp.c (get_boot_time_uncached, get_boot_time):
Pacify gcc 13 -Wstrict-prototypes.

21 months agoreadutmp: fix idx_t FIXME in API
Paul Eggert [Thu, 3 Aug 2023 22:53:30 +0000 (15:53 -0700)]
readutmp: fix idx_t FIXME in API

* lib/readutmp.c (read_utmp): 2nd arg is now idx_t *, not
size_t *.
* lib/readutmp.h: Include idx.h, for idx_t.
* modules/readutmp (Depends-on): Add idx.

21 months agoreadutmp: go back to simple ‘free’
Paul Eggert [Thu, 3 Aug 2023 22:53:27 +0000 (15:53 -0700)]
readutmp: go back to simple ‘free’

Omit the new free_utmp function.  Instead, allocate storage
in one block, so that using code can still just call ‘free’.
* lib/readutmp.c (struct utmp_alloc) [READUTMP_USE_SYSTEMD]: New type.
(add_utmp) [READUTMP_USE_SYSTEMD]: New function.
(read_utmp) [READUTMP_USE_SYSTEMD]: Use it.
Also, use malloc a bit less heavily.
(free_utmp): Remove.
* tests/test-readutmp.c (main): Call free, not free_utmp.

21 months agoreadutmp: simplify extract_trimmed_name via ximemdup0
Paul Eggert [Thu, 3 Aug 2023 22:31:48 +0000 (15:31 -0700)]
readutmp: simplify extract_trimmed_name via ximemdup0

* lib/readutmp.c (extract_trimmed_name): Simplify.
* modules/readutmp (Depends-on):
Add strnlen, which was a missing dependency.

* lib/readutmp.c: Include xmemdup0.
(extract_trimmed_name): Simplify.
* modules/readutmp (Depends-on): Add xmemdup0.
Add strnlen, which was a missing dependency already.

21 months agoalignasof, stdalign: Avoid some -Wundef warnings from config.h.
Bruno Haible [Thu, 3 Aug 2023 16:09:29 +0000 (18:09 +0200)]
alignasof, stdalign: Avoid some -Wundef warnings from config.h.

Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00012.html>.

* m4/stdalign.m4 (gl_ALIGNASOF): Test whether __cplusplus is defined
before evaluating it. Assume HAVE_STDALIGN_H, _GL_STDALIGN_NEEDS_STDDEF
are never defined to 0.

21 months agodoc: More platform detail.
Bruno Haible [Thu, 3 Aug 2023 14:41:16 +0000 (16:41 +0200)]
doc: More platform detail.

* doc/posix-functions/fnmatch.texi: Mention Solaris OpenIndiana here,
since it behaves differently than Solaris 11.4.

21 months agodoc: Add references to FreeBSD bugs.
Bruno Haible [Thu, 3 Aug 2023 12:21:17 +0000 (14:21 +0200)]
doc: Add references to FreeBSD bugs.

* doc/posix-functions/fnmatch.texi: Add commented reference to FreeBSD
bug.
* doc/posix-functions/wcscmp.texi: Likewise.
* doc/posix-functions/wcsncmp.texi: Likewise.

21 months agoreadutmp: In systemd mode, put the X11 display into the ut_host field.
Bruno Haible [Wed, 2 Aug 2023 18:20:24 +0000 (20:20 +0200)]
readutmp: In systemd mode, put the X11 display into the ut_host field.

* lib/readutmp.c (read_utmp): In sessions of type "x11", use the X11
display as host.

21 months agoautoupdate
Karl Berry [Wed, 2 Aug 2023 14:01:58 +0000 (07:01 -0700)]
autoupdate

21 months agoreadutmp: Small change to reduce the code size on the coreutils side.
Bruno Haible [Wed, 2 Aug 2023 09:40:35 +0000 (11:40 +0200)]
readutmp: Small change to reduce the code size on the coreutils side.

* lib/readutmp.h (UT_ID_SIZE): New constant and macro.

21 months agoreadutmp: Small changes to reduce the code size on the coreutils side.
Bruno Haible [Tue, 1 Aug 2023 22:56:25 +0000 (00:56 +0200)]
readutmp: Small changes to reduce the code size on the coreutils side.

* m4/readutmp.m4 (gl_READUTMP): Test also for the ut_host field in
'struct utmpx' and 'struct utmp'.
* lib/readutmp.h (HAVE_STRUCT_XTMP_UT_HOST): New macro.
(UT_USER_SIZE): Define also as a macro. Set to -1 if
READUTMP_USE_SYSTEMD.
(UT_LINE_SIZE, UT_HOST_SIZE): New constants and macros.

21 months agoreadutmp: For year-2038 safety on Linux/{x86,arm}, use systemd APIs.
Bruno Haible [Tue, 1 Aug 2023 19:44:07 +0000 (21:44 +0200)]
readutmp: For year-2038 safety on Linux/{x86,arm}, use systemd APIs.

Suggested by Thorsten Kukuk <kukuk@suse.com> in
<https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/> and
<https://github.com/thkukuk/utmpx/blob/main/utmp-to-logind.md>.

* m4/systemd.m4: New file.
* m4/readutmp.m4 (gl_READUTMP): Require gl_SYSTEMD_CHOICE. Set
READUTMP_LIB. Conditionally define READUTMP_USE_SYSTEMD.
* lib/readutmp.h: For READUTMP_USE_SYSTEMD, include <sys/time.h> and
<utmpx.h>.
(struct gl_utmp): New type.
(UTMP_STRUCT_NAME, UT_TIME_MEMBER, UT_EXIT_E_TERMINATION,
UT_EXIT_E_EXIT, UT_USER, HAVE_STRUCT_XTMP_UT_EXIT,
HAVE_STRUCT_XTMP_UT_ID, HAVE_STRUCT_XTMP_UT_PID): Define differently for
READUTMP_USE_SYSTEMD.
(UT_USER_SIZE): Don't define for READUTMP_USE_SYSTEMD.
(UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, READ_UTMP_SUPPORTED): Define also for
READUTMP_USE_SYSTEMD.
(free_utmp): New declaration.
* lib/readutmp.c: Add new includes for READUTMP_USE_SYSTEMD.
(extract_trimmed_name): Adapt to READUTMP_USE_SYSTEMD.
(get_boot_time_uncached, get_boot_time, guess_pty_name): New functions.
(read_utmp): New implementation for READUTMP_USE_SYSTEMD.
(free_utmp): New function.
* tests/test-readutmp.c (main): At the end, invoke free_utmp.
* modules/readutmp (Files): Add m4/systemd.m4.
(Link): New section.
* modules/readutmp-tests (Makefile.am): Link test-readutmp with
READUTMP_LIB.
* NEWS: Mention the free_utmp function and the READUTMP_LIB link
requirement.

21 months agoreadutmp: Trivial simplification.
Bruno Haible [Tue, 1 Aug 2023 10:58:20 +0000 (12:58 +0200)]
readutmp: Trivial simplification.

* lib/readutmp.c (extract_trimmed_name): Use constant UT_USER_SIZE.

21 months agoreadutmp tests: Show also the ut_line field.
Bruno Haible [Mon, 31 Jul 2023 21:13:37 +0000 (23:13 +0200)]
readutmp tests: Show also the ut_line field.

* tests/test-readutmp.c (main): Add a "Device" column to the table.
Adjust the column widths. Flush stdout before possibly calling abort().

21 months agoreadutmp: Fix test failure on OpenBSD.
Bruno Haible [Mon, 31 Jul 2023 20:12:51 +0000 (22:12 +0200)]
readutmp: Fix test failure on OpenBSD.

* lib/readutmp.c (desirable_utmp_entry): On OpenBSD, eliminate entirely
empty entries.

21 months agoreadutmp: Revisit portability.
Bruno Haible [Mon, 31 Jul 2023 18:33:48 +0000 (20:33 +0200)]
readutmp: Revisit portability.

* m4/readutmp.m4 (gl_READUTMP): Don't test for struct utmp.ut_exit.ut_*,
since no platform has these.
* lib/readutmp.h (UT_EXIT_E_TERMINATION): Don't test
HAVE_STRUCT_UTMP_UT_EXIT_UT_TERMINATION.
(UT_EXIT_E_EXIT): Don't test HAVE_STRUCT_UTMP_UT_EXIT_UT_EXIT.
* doc/posix-headers/utmpx.texi: Update platforms list. Mention
portability problems of specific 'struct utmpx' fields.
* doc/glibc-headers/utmp.texi: Update platforms list. Mention
portability problems of specific 'struct utmp' fields.

21 months agoreadutmp: Make argument names consistent.
Bruno Haible [Mon, 31 Jul 2023 14:29:46 +0000 (16:29 +0200)]
readutmp: Make argument names consistent.

* lib/readutmp.h (UT_TIME_MEMBER, UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT,
UT_USER, UT_PID, UT_TYPE_EQ, UT_TYPE_BOOT_TIME, UT_TYPE_USER_PROCESS,
IS_USER_PROCESS): Rename parameter to 'UT'.
* lib/readutmp.c (desirable_utmp_entry, read_utmp): Rename local
variable 'u' to 'ut'.

21 months agoreadutmp: Make the header file and function usable on all platforms.
Bruno Haible [Mon, 31 Jul 2023 14:13:11 +0000 (16:13 +0200)]
readutmp: Make the header file and function usable on all platforms.

* lib/readutmp.h (struct gl_utmp, UTMP_STRUCT_NAME, UT_TIME_MEMBER,
UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT, UT_USER): Provide fallback
definitions.
(READ_UTMP_SUPPORTED): New macro.
* lib/readutmp.c (read_utmp) [!READ_UTMP_SUPPORTED]: Provide a dummy
definition.
* modules/readutmp (Depends-on): Add sys_time.
(configure.ac): Remove conditional.
(Makefile.am): Compile readutmp.c on all platforms.
(Include): Include readutmp.h on all platforms.
* tests/test-readutmp.c: Include readutmp.h on all platforms.
(main): Invoke read_utmp on all platforms.

21 months agoreadutmp: Add tests.
Bruno Haible [Sun, 30 Jul 2023 13:11:08 +0000 (15:11 +0200)]
readutmp: Add tests.

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

21 months agoreadutmp: Improve comments. Fix module description.
Bruno Haible [Sun, 30 Jul 2023 13:08:59 +0000 (15:08 +0200)]
readutmp: Improve comments. Fix module description.

* lib/readutmp.h (extract_trimmed_name): Add specification comment.
(read_utmp): Move specification comment from lib/readutmp.c to here.
Mention also UTMP_FILE and READ_UTMP_USER_PROCESS.
* lib/readutmp.c (extract_trimmed_name): Fix comment.
* modules/readutmp (Include): Only include the .h file if
HAVE_UTMPX_H || HAVE_UTMP_H.

21 months agoreadutmp: work around glibc utmpx bug
Paul Eggert [Sun, 30 Jul 2023 00:06:42 +0000 (17:06 -0700)]
readutmp: work around glibc utmpx bug

When compiled with _TIME_BITS=64, glibc <utmpx.h> does not work,
because the files use 32-bit time_t and the code passes this to
the user unmodified, but <utmpx.h> defines a struct with 64-bit
time_t.  Work around this compatibility bug.  Problem reported
by Jakub Wilk via Sven Joachim <https://bugs.gnu.org/64937>.
* lib/readutmp.c (copy_utmp_entry): New function.
(read_utmp): Use it.

21 months agowcsrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:56:31 +0000 (00:56 +0200)]
wcsrtombs tests: Renumber tests.

* tests/test-wcsrtombs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-wcsrtombs.c: Update.
* modules/wcsrtombs-tests: Update.

21 months agowcsnrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:52:24 +0000 (00:52 +0200)]
wcsnrtombs tests: Renumber tests.

* tests/test-wcsnrtombs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-wcsnrtombs.c: Update.
* modules/wcsnrtombs-tests: Update.

21 months agowcrtomb tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:48:14 +0000 (00:48 +0200)]
wcrtomb tests: Renumber tests.

* tests/test-wcrtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-wcrtomb.c: Update.
* tests/test-wcrtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-wcrtomb-w32.c: Update.
* modules/wcrtomb-tests: Update.

21 months agombstoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:41:06 +0000 (00:41 +0200)]
mbstoc32s tests: Renumber tests.

* tests/test-mbstoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbstoc32s.c: Update.

21 months agombsrtoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:38:01 +0000 (00:38 +0200)]
mbsrtoc32s tests: Renumber tests.

* tests/test-mbsrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsrtoc32s.c: Update.

21 months agombsnrtoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:34:41 +0000 (00:34 +0200)]
mbsnrtoc32s tests: Renumber tests.

* tests/test-mbsnrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsnrtoc32s.c: Update.

21 months agombstowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:29:19 +0000 (00:29 +0200)]
mbstowcs tests: Renumber tests.

* tests/test-mbstowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbstowcs.c: Update.
* modules/mbstowcs-tests: Update.

21 months agombsrtowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:25:57 +0000 (00:25 +0200)]
mbsrtowcs tests: Renumber tests.

* tests/test-mbsrtowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsrtowcs.c: Update.
* modules/mbsrtowcs-tests: Update.

21 months agombsnrtowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:21:41 +0000 (00:21 +0200)]
mbsnrtowcs tests: Renumber tests.

* tests/test-mbsnrtowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsnrtowcs.c: Update.
* modules/mbsnrtowcs-tests: Update.

21 months agombrtoc16 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:16:24 +0000 (00:16 +0200)]
mbrtoc16 tests: Renumber tests.

* tests/test-mbrtoc16-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtoc16.c: Update.
* tests/test-mbrtoc16-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtoc16-w32.c: Update.
* modules/mbrtoc16-tests: Update.

21 months agombrtoc32 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:10:44 +0000 (00:10 +0200)]
mbrtoc32 tests: Renumber tests.

* tests/test-mbrtoc32-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtoc32.c: Update.
* tests/test-mbrtoc32-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtoc32-w32.c: Update.
* modules/mbrtoc32-tests: Update.

21 months agombrtowc tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:03:01 +0000 (00:03 +0200)]
mbrtowc tests: Renumber tests.

* tests/test-mbrtowc*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtowc.c: Update.
* tests/test-mbrtowc-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtowc-w32.c: Update.
* modules/mbrtowc-tests: Update.

21 months agombrlen tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:18:42 +0000 (23:18 +0200)]
mbrlen tests: Renumber tests.

* tests/test-mbrlen*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrlen.c: Update.
* tests/test-mbrlen-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6
-> 8.
* tests/test-mbrlen-w32.c: Update.
* modules/mbrlen-tests: Update.

21 months agombmemcasecoll tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:04:32 +0000 (23:04 +0200)]
mbmemcasecoll tests: Renumber tests.

* tests/test-mbmemcasecoll*.sh: Renamed 1 -> 2 -> 3 -> 4.
* tests/test-mbmemcasecoll.c: Update.
* modules/mbmemcasecoll-tests: Update.

21 months agombmemcasecmp tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:02:01 +0000 (23:02 +0200)]
mbmemcasecmp tests: Renumber tests.

* tests/test-mbmemcasecmp*.sh: Renamed 1 -> 2 -> 3 -> 4.
* tests/test-mbmemcasecmp.c: Update.
* modules/mbmemcasecmp-tests: Update.

21 months agofnmatch tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:50:44 +0000 (22:50 +0200)]
fnmatch tests: Renumber tests.

* tests/test-fnmatch-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-fnmatch-w32.c: Update.
* modules/fnmatch-tests: Update.

21 months agoc32stombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:42:13 +0000 (22:42 +0200)]
c32stombs tests: Renumber tests.

* tests/test-c32stombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32stombs.c: Update.
* modules/c32stombs-tests: Update.

21 months agoc32srtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:35:24 +0000 (22:35 +0200)]
c32srtombs tests: Renumber tests.

* tests/test-c32srtombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32srtombs.c: Update.
* modules/c32srtombs-tests: Update.

21 months agoc32snrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:13:41 +0000 (22:13 +0200)]
c32snrtombs tests: Renumber tests.

* tests/test-c32snrtombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32snrtombs.c: Update.
* modules/c32snrtombs-tests: Update.

21 months agoc32rtomb tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:02:54 +0000 (22:02 +0200)]
c32rtomb tests: Renumber tests.

* tests/test-c32rtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-c32rtomb.c: Update.
* tests/test-c32rtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-c32rtomb-w32.c: Update.
* modules/c32rtomb-tests: Update.

21 months agobtoc32 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 19:44:56 +0000 (21:44 +0200)]
btoc32 tests: Renumber tests.

* tests/test-btoc32-*.sh: Renamed 1 -> 2 -> 3 -> 1.
* tests/test-btoc32.c: Update.

21 months agobtowc tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 19:39:02 +0000 (21:39 +0200)]
btowc tests: Renumber tests.

* tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1.
* tests/test-btowc.c: Update.
* modules/btowc-tests: Update.

21 months agotime-h: Simplify after 2017-05-01 change.
Bruno Haible [Sat, 29 Jul 2023 16:22:50 +0000 (18:22 +0200)]
time-h: Simplify after 2017-05-01 change.

* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Don't provide a default value for
GNULIB_GETTIMEOFDAY.

21 months agotime-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.
Bruno Haible [Sat, 29 Jul 2023 16:07:45 +0000 (18:07 +0200)]
time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.

* lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
timegm): Add _GL_WARN_ON_USE invocation.
(asctime, ctime): Don't assume that these functions are declared, since
POSIX obsoletes them.
* m4/time_h.m4 (gl_TIME_H): Test for the declarations of asctime, ctime,
gmtime_r, localtime, localtime_r, mktime, nanosleep, strftime, strptime,
time, timegm, timespec_get, timespec_getres, tzset.
(gl_TIME_H_DEFAULTS): Initialize REPLACE_CTIME, REPLACE_LOCALTIME_R,
REPLACE_MKTIME, REPLACE_NANOSLEEP, REPLACE_STRFTIME, REPLACE_TIMEGM,
REPLACE_TIMESPEC_GET, REPLACE_TZSET with 0 instead of GNULIB_PORTCHECK.
* m4/ctime.m4 (gl_FUNC_CTIME): Don't re-initialize REPLACE_CTIME.
* m4/time_r.m4 (gl_TIME_R): Don't re-initialize REPLACE_LOCALTIME_R.
* m4/mktime.m4 (gl_FUNC_MKTIME): Don't re-initialize REPLACE_MKTIME.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't re-initialize
REPLACE_NANOSLEEP.
* m4/strftime-fixes.m4 (gl_FUNC_STRFTIME): Don't re-initialize
REPLACE_STRFTIME.
* m4/timegm.m4 (gl_FUNC_TIMEGM): Don't re-initialize REPLACE_TIMEGM.
* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Don't re-initialize
REPLACE_TIMESPEC_GET.
* m4/tzset.m4 (gl_FUNC_TZSET: Don't re-initialize REPLACE_TZSET.

21 months agofnmatch: Ensure that on Cygwin ≥ 3.5.0, Cygwin's native fnmatch is used.
Bruno Haible [Fri, 28 Jul 2023 19:36:51 +0000 (21:36 +0200)]
fnmatch: Ensure that on Cygwin ≥ 3.5.0, Cygwin's native fnmatch is used.

Tested by Corinna Vinschen in
<https://cygwin.com/pipermail/cygwin/2023-July/254036.html>.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): On Cygwin, don't force
REPLACE_FNMATCH to 1 just because wchar_t is small.

21 months agoautoupdate
Karl Berry [Fri, 28 Jul 2023 15:27:29 +0000 (08:27 -0700)]
autoupdate

21 months agoposixcheck: Fix dependencies.
Bruno Haible [Fri, 28 Jul 2023 13:18:34 +0000 (15:18 +0200)]
posixcheck: Fix dependencies.

* modules/posixcheck (Depends-on): Add malloc-h, pthread-h, sched,
sys_random, threads-h, uchar, utmp.

21 months agouchar: Include the necessary snippets.
Bruno Haible [Fri, 28 Jul 2023 13:15:26 +0000 (15:15 +0200)]
uchar: Include the necessary snippets.

* lib/uchar.in.h: Add insertion points for _GL_ARG_NONNULL and
_GL_WARN_ON_USE.
* modules/uchar (Depends-on): Add snippet/arg-nonnull,
snippet/warn-on-use.
(Makefile.am): In uchar.h, include the ARG_NONNULL_H and WARN_ON_USE_H
snippets.

21 months agombmemcasecmp, mbmemcasecoll: Avoid test failure on MSVC.
Bruno Haible [Fri, 28 Jul 2023 11:56:15 +0000 (13:56 +0200)]
mbmemcasecmp, mbmemcasecoll: Avoid test failure on MSVC.

* tests/test-mbmemcasecmp.h (test_utf_8): Disable two tests on platforms
that don't have the upper/lower mappings for 'ü'/'Ü'.
* tests/test-mbmemcasecmp.c: Include <wchar.h>, <wctype.h>.
* tests/test-mbmemcasecoll.c: Likewise.
* modules/mbmemcasecmp-tests (Depends-on): Add mbrtowc, wctype-h.
* modules/mbmemcasecoll-tests (Depends-on): Likewise.

21 months agognulib-tool: Include ftruncate in testdirs.
Bruno Haible [Thu, 27 Jul 2023 21:15:09 +0000 (23:15 +0200)]
gnulib-tool: Include ftruncate in testdirs.

* gnulib-tool (func_create_testdir): Don't exclude module 'ftruncate'
from testdirs by default.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.

21 months agofnmatch-h, glob-h tests: Fix link errors (regression 2023-07-24).
Bruno Haible [Thu, 27 Jul 2023 20:19:08 +0000 (22:19 +0200)]
fnmatch-h, glob-h tests: Fix link errors (regression 2023-07-24).

* modules/fnmatch-h-c++-tests (Makefile.am): Link test-fnmatch-h-c++
with $(LIBUNISTRING).
* modules/glob-h-c++-tests (Makefile.am): Link test-glob-h-c++ with
$(LIBUNISTRING).

21 months agofnmatch, glob tests: Fix link errors (regression 2023-07-24).
Bruno Haible [Thu, 27 Jul 2023 18:52:36 +0000 (20:52 +0200)]
fnmatch, glob tests: Fix link errors (regression 2023-07-24).

* modules/fnmatch-tests (Makefile.am): Link test-fnmatch-w32 with the
same libraries as test-fnmatch.
* modules/glob (Link): Add $(LIBUNISTRING).
* modules/glob-tests (Makefile.am): Link test-glob with $(LIBUNISTRING).

21 months agowctrans: Work around bug on NetBSD.
Bruno Haible [Wed, 26 Jul 2023 14:32:48 +0000 (16:32 +0200)]
wctrans: Work around bug on NetBSD.

* lib/wctype.in.h (rpl_wctrans_t, wctrans_t, GNULIB_defined_wctrans_t):
Define if REPLACE_WCTRANS is 1.
(wctrans): Consider REPLACE_WCTRANS.
(towctrans): Override if REPLACE_WCTRANS is 1.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTRANS.
* m4/wctrans.m4 (gl_FUNC_WCTRANS): Define through AC_DEFUN_ONCE. Test
whether wctrans supports the "tolower" character mapping. Set
REPLACE_WCTRANS if not.
* m4/towctrans.m4 (gl_FUNC_TOWCTRANS): Require gl_FUNC_WCTRANS.
* modules/wctrans (Depends-on): Add towctrans.
(configure.ac): Consider REPLACE_WCTRANS.
* modules/towctrans (Files): Add m4/wctrans.m4.
(configure.ac): Override also if REPLACE_WCTRANS is 1.
* modules/wctype-h (Makefile.am): Substitute REPLACE_WCTRANS.
* doc/posix-functions/wctrans.texi: Mention the NetBSD bug.

21 months agotowctrans: Add tests.
Bruno Haible [Wed, 26 Jul 2023 13:26:21 +0000 (15:26 +0200)]
towctrans: Add tests.

* tests/test-towctrans.c: New file, based on
tests/test-c32_apply_mapping.c.
* modules/towctrans-tests: New file.

21 months agowctrans: Add tests.
Bruno Haible [Wed, 26 Jul 2023 13:25:35 +0000 (15:25 +0200)]
wctrans: Add tests.

* tests/test-wctrans.c: New file, based on tests/test-c32_get_mapping.c.
* modules/wctrans-tests: New file.

21 months agofnmatch: Update dependencies.
Bruno Haible [Wed, 26 Jul 2023 12:57:26 +0000 (14:57 +0200)]
fnmatch: Update dependencies.

* modules/fnmatch (Depends-on): Add wctype.

21 months agowctype: Work around wctype+iswctype bug on MSVC.
Bruno Haible [Wed, 26 Jul 2023 13:12:47 +0000 (15:12 +0200)]
wctype: Work around wctype+iswctype bug on MSVC.

* m4/wctype.m4 (gl_FUNC_WCTYPE): In the test program, test also for the
MSVC bug. Update cross-compilation guess.
* doc/posix-functions/wctype.texi: Mention the MSVC bug.

21 months agowctype: Work around wctype bug on mingw.
Bruno Haible [Wed, 26 Jul 2023 12:50:00 +0000 (14:50 +0200)]
wctype: Work around wctype bug on mingw.

* lib/wctype.in.h (rpl_wctype_t, wctype_t, GNULIB_defined_wctype_t):
Define if REPLACE_WCTYPE is 1.
(wctype): Consider REPLACE_WCTYPE.
(iswctype): Override also if REPLACE_WCTYPE is 1.
* lib/iswctype.c: If GNULIB_defined_wctype_t is defined, use the
function-pointer based implementation.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTYPE.
* m4/wctype.m4 (gl_FUNC_WCTYPE): Define through AC_DEFUN_ONCE. Test
whether wctype supports the "blank" character class. Set REPLACE_WCTYPE
if not.
* m4/iswctype.m4 (gl_FUNC_ISWCTYPE): Require gl_FUNC_WCTYPE.
* modules/wctype (Status, Notice): Remove.
(Depends-on): Add iswctype. Consider REPLACE_WCTYPE.
(configure.ac): Consider REPLACE_WCTYPE.
* modules/iswctype (Status, Notice): Remove.
(Files): Add m4/wctype.m4.
(configure.ac): Override also if REPLACE_WCTYPE is 1.
* modules/wctype-h (Makefile.am): Substitute REPLACE_WCTYPE.
* doc/posix-functions/wctype.texi: Mention the mingw bug.

21 months agowctype-h: Work around iswprint bug on mingw.
Bruno Haible [Wed, 26 Jul 2023 12:13:48 +0000 (14:13 +0200)]
wctype-h: Work around iswprint bug on mingw.

* lib/wctype.in.h (rpl_iswprint): On mingw, don't use the system's
iswprint function.
* tests/test-wctype-h.c (main): Verify that this character class
contains the ASCII space but not tab and newline.
* tests/test-c32isprint.c (main): For tab, \v, \f, expect the same value
on native Windows as on other platforms.
* doc/posix-functions/iswprint.texi: Mention the mingw bug.

21 months agoiswblank tests: Add more tests.
Bruno Haible [Wed, 26 Jul 2023 11:48:25 +0000 (13:48 +0200)]
iswblank tests: Add more tests.

* tests/test-iswblank.c (main): Verify that this character class
contains the ASCII space and tab, but not newline.

21 months agowctype, wctrans: Require a non-NULL argument.
Bruno Haible [Wed, 26 Jul 2023 11:40:06 +0000 (13:40 +0200)]
wctype, wctrans: Require a non-NULL argument.

* lib/wctype.in.h: Add placeholder for definition of _GL_ARG_NONNULL.
(wctype, wctrans): Mark with _GL_ARG_NONNULL ((1)).
* modules/wctype-h (Depends-on): Add snippet/arg-nonnull.
(Makefile.am): Substitute $(ARG_NONNULL_H) into wctype.h.

21 months agoiswctype: Add tests.
Bruno Haible [Tue, 25 Jul 2023 21:39:15 +0000 (23:39 +0200)]
iswctype: Add tests.

* tests/test-iswctype.c: New file, based on
tests/test-c32_apply_type_test.c.
* tests/test-c32_apply_type_test.c (main): Update accordingly.
* modules/iswctype-tests: New file.

21 months agowctype: Add tests.
Bruno Haible [Tue, 25 Jul 2023 21:38:03 +0000 (23:38 +0200)]
wctype: Add tests.

* tests/test-wctype.c: New file, based on
tests/test-c32_get_type_test.c.
* modules/wctype-tests: New file.

21 months agoCompile benchmark programs without assertions.
Bruno Haible [Tue, 25 Jul 2023 20:56:19 +0000 (22:56 +0200)]
Compile benchmark programs without assertions.

* modules/mbiter-bench-tests (Makefile.am): Compile bench-mbiter with
-DNDEBUG.
* modules/mbiterf-bench-tests (Makefile.am): Compile bench-mbiterf with
-DNDEBUG.
* modules/mbuiter-bench-tests (Makefile.am): Compile bench-mbuiter with
-DNDEBUG.
* modules/mbuiterf-bench-tests (Makefile.am): Compile bench-mbuiterf
with -DNDEBUG.
* modules/mbswidth-bench-tests (Makefile.am): Compile bench-mbswidth
with -DNDEBUG.
* modules/crypto/md5-buffer-tests (Makefile.am): Compile bench-md5 with
-DNDEBUG.
* modules/crypto/sha1-buffer-tests (Makefile.am): Compile bench-sha1
with -DNDEBUG.
* modules/crypto/sha256-buffer-tests (Makefile.am): Compile bench-sha224
and bench-sha256 with -DNDEBUG.
* modules/crypto/sha512-buffer-tests (Makefile.am): Compile bench-sha384
and bench-sha512 with -DNDEBUG.

21 months agounistr/u8-*: Make Unicode decoder more Unicode Standard compliant.
Bruno Haible [Tue, 25 Jul 2023 20:20:51 +0000 (22:20 +0200)]
unistr/u8-*: Make Unicode decoder more Unicode Standard compliant.

Based on a remark by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00120.html>.

* tests/unistr/test-u8-mbtouc.c (test_safe_function): Change expected
results for "non-shortest form" or out-of-range byte sequences. Add new
test cases of incomplete well-formed byte sequences.
* tests/unistr/test-u8-mbsnlen.c (main): Likewise.
* lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Reject a first byte in the
range 0xF5..0xF7 as invalid. Distinguish incomplete from invalid byte
sequences correctly. For the former, return only the number of bytes in
the maximal well-formed subpart.
* lib/unistr/u8-mbtouc.c (u8_mbtouc): Likewise.
* lib/unistr/u8-check.c (u8_check): Reject a first byte in the range
0xF5..0xF7 as invalid.
* lib/unistr/u8-mblen.c (u8_mblen): Likewise.
* lib/unistr/u8-mbtoucr.c (u8_mbtoucr): Likewise.
* lib/unistr/u8-strmbtouc.c (u8_strmbtouc): Likewise.
* lib/unistr/u8-strmblen.c (u8_strmblen): Likewise.
* lib/unistr/u8-prev.c (u8_prev): Likewise.

21 months agofnmatch: Overcome wchar_t limitations.
Bruno Haible [Mon, 24 Jul 2023 10:08:23 +0000 (12:08 +0200)]
fnmatch: Overcome wchar_t limitations.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Set REPLACE_FNMATCH to 1 on
AIX in 32-bit mode.
* lib/fnmatch.c: Include <uchar.h>. Conditionally include unistr.h.
(UCHAR_TO_WCHAR): Renamed from BTOWC.
(WCHAR_T, WINT_T, BTOWC, MBSRTOWCS, WCSLEN, WCSCAT, WMEMPCPY, WMEMCHR,
TOWLOWER, WCTYPE_T, WCTYPE, ISWCTYPE): New macros.
(IS_CHAR_CLASS): Use WCTYPE instead of wctype.
(UCHAR_TO_WCHAR): Use BTOWC instead of btowc.
(FOLD): Use TOWLOWER instead of towlower.
(CHAR): Use WCHAR_T instead of wchar_t.
(UCHAR, INT): Use WINT_T instead of wint_t.
(STRLEN): Use WCSLEN instead of wcslen.
(STRCAT): Use WCSCAT instead of wcscat.
(MEMPCPY): Use WMEMPCPY instead of wmempcpy.
(MEMCHR): Use WMEMCHR instead of wmemchr.
(is_char_class): Use WCTYPE_T instead of wctype_t, WCHAR_T instead of
wchar_t, WCTYPE instead of wctype.
(fnmatch): Use WCHAR_T instead of wchar_t, MBSRTOWCS instead of
mbsrtowcs.
* lib/fnmatch_loop.c (FCT): Use WCTYPE_T instead of wctype_t, ISWCTYPE
instead of iswctype. Update for renamed BTOWC.
* modules/fnmatch (Depends-on): Add btoc32, c32tolower,
c32_get_type_test, c32_apply_type_test, mbsrtoc32s, unistr/u32-chr,
unistr/u32-pcpy, unistr/u32-strcat, unistr/u32-strlen.
(Link): Add $(LIBUNISTRING).
* modules/fnmatch-tests (Makefile.am): Link test-fnmatch with
$(LIBUNISTRING).
* doc/posix-functions/fnmatch.texi: Move the Cygwin, mingw, MSVC, AIX
bug descriptions to the "fixed by Gnulib" section.

21 months agofnmatch: Update doc regarding Solaris 10.
Bruno Haible [Mon, 24 Jul 2023 09:10:15 +0000 (11:10 +0200)]
fnmatch: Update doc regarding Solaris 10.

* doc/posix-functions/fnmatch.texi: Move the Solaris 10 bug description
to the "fixed by Gnulib" section.

21 months agotimespec_get: port to Ubuntu 23.04
Paul Eggert [Mon, 24 Jul 2023 00:58:03 +0000 (17:58 -0700)]
timespec_get: port to Ubuntu 23.04

* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET):
Default REPLACE_TIMESPEC_GET to 0, fixing a typo.

21 months agounistr/u32-strcat: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:42 +0000 (02:00 +0200)]
unistr/u32-strcat: Relicense under LGPLv2+.

* modules/unistr/u32-strcat (License): Change to LGPLv2+.
* lib/unistr/u32-strcat.c: Update license notice.
* lib/unistr/u-strcat.h: Likewise.

21 months agounistr/u32-strlen: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:37 +0000 (02:00 +0200)]
unistr/u32-strlen: Relicense under LGPLv2+.

* modules/unistr/u32-strlen (License): Change to LGPLv2+.
* lib/unistr/u32-strlen.c: Update license notice.

21 months agounistr/u32-chr: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:13 +0000 (02:00 +0200)]
unistr/u32-chr: Relicense under LGPLv2+.

* modules/unistr/u32-chr (License): Change to LGPLv2+.
* lib/unistr/u32-chr.c: Update license notice.

21 months agoutimecmp: clean up old spare1 cruft
Paul Eggert [Sun, 23 Jul 2023 18:35:10 +0000 (11:35 -0700)]
utimecmp: clean up old spare1 cruft

* lib/utimecmp.c: Remove a ‘defined HAVE_STRUCT_STAT_ST_SPARE1’
that has been false since 2007.

21 months agofnmatch tests: Avoid a test failure on FreeBSD.
Bruno Haible [Sun, 23 Jul 2023 14:49:22 +0000 (16:49 +0200)]
fnmatch tests: Avoid a test failure on FreeBSD.

* tests/test-fnmatch.c (main): In a GB18030 locale, test the towupper()
mapping of 'ö', not of 'ü'.

21 months agofnmatch: Work around bugs on FreeBSD, NetBSD, Solaris, Cygwin, Android.
Bruno Haible [Sun, 23 Jul 2023 13:26:28 +0000 (15:26 +0200)]
fnmatch: Work around bugs on FreeBSD, NetBSD, Solaris, Cygwin, Android.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Add three more test cases to
the test program. Reorganize its return values.
* tests/test-fnmatch.c (main): Reflect the changes done in fnmatch.m4.
* doc/posix-functions/fnmatch.texi: Move the corresponding bug
descriptions to the "fixed by Gnulib" section.