]> git.ipfire.org Git - thirdparty/gnulib.git/log
thirdparty/gnulib.git
2 hours agoautoupdate master
Karl Berry [Mon, 20 Apr 2026 14:27:13 +0000 (07:27 -0700)] 
autoupdate

2 hours agoautoupdate
Karl Berry [Mon, 20 Apr 2026 14:22:45 +0000 (07:22 -0700)] 
autoupdate

14 hours agomaint.mk: fix sc_Wundef_boolean race with parallel syntax-check
Jim Meyering [Mon, 20 Apr 2026 02:36:03 +0000 (19:36 -0700)] 
maint.mk: fix sc_Wundef_boolean race with parallel syntax-check

With highly parallel "make syntax-check", sc_Wundef_boolean's
in_files='config.h' was matched as an unanchored, unescaped regex
by "find | grep -E", so the '.' matched any character and the lack
of anchoring matched anywhere in a path.  This made it match the
.sc-start-sc_*config_h* marker files created by parallel rules.
Symptom: I saw see these go by:
  grep: ./.sc-start-sc_require_config_h_first: No such file or directory
  grep: ./.sc-start-sc_prohibit_have_config_h: No such file or directory
  grep: ./.sc-start-sc_require_config_h: No such file or directory
* top/maint.mk (sc_Wundef_boolean): Use '(^|/)config\.h$' rather
than bare 'config.h' as the in_files ERE.

22 hours agoregex tests: pacify -Wshadow
Paul Eggert [Sun, 19 Apr 2026 18:21:49 +0000 (11:21 -0700)] 
regex tests: pacify -Wshadow

* tests/test-regex.c (main):
Rename a local to avoid shadowing confusion.

22 hours agoreadutmp: greeters are not users
Paul Eggert [Sun, 19 Apr 2026 18:12:16 +0000 (11:12 -0700)] 
readutmp: greeters are not users

* lib/readutmp.c (read_utmp_from_systemd):
Do not merely treat a "manager*" class as a login process.
Instead, treat all non-"user*" processes as login processes.
With current systemd, this changes the treatment of "greeter",
"lock-screen", "background", "background-light", and "none"
classes so that they are now considered to be login processes, not
user processes.

23 hours agoregex: avoid a UBSAN failure: remove an unnecessary DEBUG_ASSERT
Jim Meyering [Sun, 19 Apr 2026 16:52:26 +0000 (09:52 -0700)] 
regex: avoid a UBSAN failure: remove an unnecessary DEBUG_ASSERT

* lib/regex_internal.c (re_node_set_insert): Remove the DEBUG_ASSERT
and instead return early for an attempt to insert an ELEM that is
already present in the set.  Relax the function's comment that says
there should be no duplicate.  This function is called from many
places and has been working fine.  With its nontrivial backrefs,
the sample regexp apparently elicits enough backtracking retries
and state-set merges to trigger this duplicate insertion attempt.
Reported by Bruno Haible in
https://lists.gnu.org/r/bug-gnulib/2026-04/msg00138.html

27 hours agoregex tests: Add a test case that triggers an assertion failure.
Bruno Haible [Sun, 19 Apr 2026 13:18:55 +0000 (15:18 +0200)] 
regex tests: Add a test case that triggers an assertion failure.

* tests/test-regex.c (main): Add a test case related to back references.

38 hours agoreadutmp: Silence -Wzero-as-null-pointer-constant warning.
Collin Funk [Sun, 19 Apr 2026 02:42:21 +0000 (19:42 -0700)] 
readutmp: Silence -Wzero-as-null-pointer-constant warning.

* lib/readutmp.c (read_utmp_from_systemd): Initialize all of the struct
members and use NULL for the pointer.

3 days agodoc: doc FTS_NOSTAT with FIFO, not directory
Paul Eggert [Fri, 17 Apr 2026 16:14:49 +0000 (09:14 -0700)] 
doc: doc FTS_NOSTAT with FIFO, not directory

* lib/fts.in.h (FTS_NOSTAT): Use a FIFO, not a directory,
in the commentary’s example.  This is a better example
because directories never have FTS_NSOK.

3 days agoregex: Silence -Wzero-as-null-pointer-constant warning.
Collin Funk [Fri, 17 Apr 2026 04:50:27 +0000 (21:50 -0700)] 
regex: Silence -Wzero-as-null-pointer-constant warning.

* lib/regexec.c (merge_state_with_log): Check the pointer against NULL.

4 days agobyteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).
Bruno Haible [Thu, 16 Apr 2026 16:49:36 +0000 (18:49 +0200)] 
byteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).

* lib/byteswap.in.h: Include <stdint.h>.
* modules/byteswap (Depends-on): Add stdint-h.

4 days agosigdelay: Don't use out-of-range signal numbers.
Bruno Haible [Thu, 16 Apr 2026 12:15:52 +0000 (14:15 +0200)] 
sigdelay: Don't use out-of-range signal numbers.

* lib/sigdelay.c (states): Change number of elements to NSIG.

4 days agosigdelay, posix-spawn-internal: Ignore out-of-range signal numbers.
Bruno Haible [Thu, 16 Apr 2026 12:14:38 +0000 (14:14 +0200)] 
sigdelay, posix-spawn-internal: Ignore out-of-range signal numbers.

* lib/sigdelay.c (sigdelay): Do nothing when sigismember() returns -1.
* lib/spawni.c (__spawni): Likewise.

4 days agosigprocmask: Fix sigismember function.
Bruno Haible [Thu, 16 Apr 2026 11:03:39 +0000 (13:03 +0200)] 
sigprocmask: Fix sigismember function.

* lib/sigprocmask.c (sigismember): If the signal argument is invalid,
return -1 instead of 0.

4 days agopthread_sigmask tests: Fix test failure on Solaris, AIX (regr. today).
Bruno Haible [Wed, 15 Apr 2026 22:28:43 +0000 (00:28 +0200)] 
pthread_sigmask tests: Fix test failure on Solaris, AIX (regr. today).

Reported by Pádraig Brady.

* tests/test-pthread_sigmask2.c (main): Reestablish the signal handler
after SIGINT arrived.
* tests/test-sigdelay2.c (main): Likewise.

4 days agodoc: doc FTS_NOSTAT similarity to FTS_DEFER_STAT
Paul Eggert [Wed, 15 Apr 2026 21:47:55 +0000 (14:47 -0700)] 
doc: doc FTS_NOSTAT similarity to FTS_DEFER_STAT

* lib/fts.in.h (FTS_NOSTAT, FTS_DEFER_STAT):
Document that FTS_NOSTAT updates fts_statp->st_mode
similarly with FTS_DEFER_STAT.

4 days agofts: match doc for FTS_DEFER_STAT mode
Paul Eggert [Wed, 15 Apr 2026 21:45:53 +0000 (14:45 -0700)] 
fts: match doc for FTS_DEFER_STAT mode

* lib/fts.c (fts_open): Clear fts_statp->fts_mode for the
FTS_DEFER_STAT case too, since it’s documented to work since 2008.

5 days agosigdelay: Add tests.
Bruno Haible [Wed, 15 Apr 2026 11:45:58 +0000 (13:45 +0200)] 
sigdelay: Add tests.

* tests/test-sigdelay1.c: New file, based on
tests/test-pthread_sigmask1.c.
* tests/test-sigdelay2.c: New file, based on
tests/test-pthread_sigmask2.c.
* modules/sigdelay-tests: New file.

5 days agosigdelay: New module.
Bruno Haible [Wed, 15 Apr 2026 11:45:52 +0000 (13:45 +0200)] 
sigdelay: New module.

* lib/sigdelay.h: New file.
* lib/sigdelay.c: New file.
* modules/sigdelay: New file.

5 days agopthread_sigmask tests: Enhance test.
Bruno Haible [Wed, 15 Apr 2026 11:45:44 +0000 (13:45 +0200)] 
pthread_sigmask tests: Enhance test.

* tests/test-pthread_sigmask2.c (killer_thread1): Renamed from
killer_thread.
(killer_thread2): New variable.
(killer_thread1_func): Renamed from killer_thread_func.
(killer_thread2_func): New function.
(main): Add a second test with killer_thread2.

5 days agopthread_sigmask tests: More details about VirtualBox / KVM bug.
Bruno Haible [Wed, 15 Apr 2026 11:45:35 +0000 (13:45 +0200)] 
pthread_sigmask tests: More details about VirtualBox / KVM bug.

* tests/test-pthread_sigmask1.c (main): Refine comment regarding
VirtualBox / KVM bug.
* tests/test-pthread_sigmask2.c (main): Likewise.

5 days agosigprocmask: On mingw, avoid dependency on libwinpthread.
Bruno Haible [Tue, 14 Apr 2026 19:56:00 +0000 (21:56 +0200)] 
sigprocmask: On mingw, avoid dependency on libwinpthread.

* lib/sigprocmask.c: Include windows-tls.h, windows-once.h.
(thread_local): Remove macro.
(struct per_thread): New type.
(tls_key): New variable.
(keys_init): New function.
(keys_init_once): New variable.
(get_per_thread): New function.
(per_thread_singleton): New variable.
(blocked_set, pending_array): Remove variables.
(sigpending, override_handler, pthread_sigmask, _gl_raise_SIGPIPE):
Invoke get_per_thread, to access blocked_set or pending_array.
* modules/sigprocmask (Depends-on): Add windows-once, windows-tls.

5 days agosigaction: Fix test failure on native Windows.
Bruno Haible [Tue, 14 Apr 2026 18:38:39 +0000 (20:38 +0200)] 
sigaction: Fix test failure on native Windows.

* lib/sigaction.c (sigaction): Hide the sigaction_handler from the
caller.

6 days agoerror_h: fix icx version in commentary
Paul Eggert [Tue, 14 Apr 2026 02:19:09 +0000 (19:19 -0700)] 
error_h: fix icx version in commentary

6 days agostdbit-h: Port to Intel icpx C++ compiler.
Bruno Haible [Mon, 13 Apr 2026 21:44:24 +0000 (23:44 +0200)] 
stdbit-h: Port to Intel icpx C++ compiler.

* lib/stdbit.in.h: With the Intel icpx C++ compiler, include <stddef.h>
and <stdint.h>, and define the __STDC_ENDIAN_* macros.
* doc/posix-headers/stdbit.texi: Document the Intel icpx bug.

6 days agoerror-h: port to Intel OneAPI icx 2026.0.0
Paul Eggert [Mon, 13 Apr 2026 21:01:36 +0000 (14:01 -0700)] 
error-h: port to Intel OneAPI icx 2026.0.0

Problem reported by Harmen Stoppels in:
https://lists.gnu.org/r/bug-gnulib/2026-04/msg00085.html
* m4/error_h.m4 (gl_ERROR_H): Plant an alarm in case error infloops.

6 days agoregex: omit unnecessary check_halt_state_context
Paul Eggert [Mon, 13 Apr 2026 20:26:58 +0000 (13:26 -0700)] 
regex: omit unnecessary check_halt_state_context

* lib/regexec.c (prune_impossible_nodes):
Avoid unnecessary call to check_halt_state_context.
Suggested by Florian Weimer in:
https://sourceware.org/pipermail/libc-alpha/2026-April/176627.html

7 days agoregex: Fix use of uninitialized variable (regression yesterday).
Bruno Haible [Mon, 13 Apr 2026 15:14:26 +0000 (17:14 +0200)] 
regex: Fix use of uninitialized variable (regression yesterday).

Reported by Coverity.

* lib/regexec.c (re_search_internal): Move initialization of variable
'save_state_log' further up.

7 days agoregex: small simplification
Jim Meyering [Mon, 13 Apr 2026 06:07:09 +0000 (23:07 -0700)] 
regex: small simplification

* lib/regexec.c (re_search_internal): Use only one copy
of the 5-line reg-initialization code, removing that else block,
at the tiny cost of moving a small test into the loop.

7 days agoregex: fix missed short match with backrefs
Jim Meyering [Sun, 12 Apr 2026 19:36:45 +0000 (12:36 -0700)] 
regex: fix missed short match with backrefs

With a backref pattern like ^(.?)(.?).?\2\1 (no $), the engine
could miss valid short matches.  For example, "ab" should match
via all-empty groups, yet regexec returned no-match because
set_regs failed at the longest structural match (match_last=2)
and never retried at a shorter match_last.
* lib/regexec.c (re_search_internal): When set_regs fails for a
backref pattern, retry prune_impossible_nodes and set_regs at
progressively shorter match lengths.  Save a copy of state_log
before pruning so shorter retries can re-sift from the original
states.
* m4/regex.m4: Also reject system regex with this bug.
* tests/test-regex.c (main): Add a test for this bug.
Reported by Ed Morton in https://bugs.gnu.org/68725
Co-authored-by: Claude <noreply@anthropic.com>
7 days agodoc: update documentation about fopen with the 'e' mode character
Collin Funk [Sun, 12 Apr 2026 19:07:00 +0000 (12:07 -0700)] 
doc: update documentation about fopen with the 'e' mode character

* doc/posix-functions/fopen.texi: Mention the 'e' mode character was
added in POSIX.1-2024 instead of a future revision.

7 days agoregex: fix false match with backrefs and $ anchor
Jim Meyering [Sun, 12 Apr 2026 17:27:03 +0000 (10:27 -0700)] 
regex: fix false match with backrefs and $ anchor

Use of sed or grep with both backreferences and an end-of-line
anchor could get false matches.  For example, this grep command
would falsely declare "ab" to be a palindrome:
  grep -E '^(.?)(.?).?\2\1$' <<< ab
In prune_impossible_nodes, falling back to a shorter match
skipped the halt-state context check, so $ was not verified.
* lib/regexec.c (prune_impossible_nodes): Also require
check_halt_state_context to succeed in the loop that searches
for an earlier halt state.
* m4/regex.m4: Bump serial to 82.  Reject any system regex
implementation with this bug.
* tests/test-regex.c (main): Add a test for this bug.
Reported by Ed Morton in https://bugs.gnu.org/68725

8 days agotempname: call ‘clock’ only if !CLOCK_REALTIME
Paul Eggert [Sat, 11 Apr 2026 21:06:09 +0000 (14:06 -0700)] 
tempname: call ‘clock’ only if !CLOCK_REALTIME

* lib/tempname.c (random_bits) [CLOCK_REALTIME]: Do not call
‘clock’, as an optimization.  There is no need to call ‘clock’, as
it likely gives us less info than clock_gettime, and if
clock_gettime fails then ‘clock’ will likely fail too.
This patch is a simplified version of the patch made in glibc commit
5f62cf88c4530c11904482775b7582bd7f6d80d2 dated 2024-09-25,
and Gnulib lib/tempname.c should now be suitable as-is for
replacing Glibc sysdeps/posix/tempname.c.

8 days agodoc: fix typos in previous doc patch
Paul Eggert [Sat, 11 Apr 2026 20:29:07 +0000 (13:29 -0700)] 
doc: fix typos in previous doc patch

8 days agodoc: be more like POSIX in threading terms
Paul Eggert [Sat, 11 Apr 2026 20:19:43 +0000 (13:19 -0700)] 
doc: be more like POSIX in threading terms

In documentation and comments, be more like POSIX in terminology
involving multithreading.  Explain the distinction between
multithreaded process vs multithreaded program.  Change “program”
to “process” when the latter wording is more accurate or informative.
Simplify the wording for the constraints on processes that use
unlocked I/O.  Change “multithread-safe” to “thread-safe”.
Change “thread-safety” to “thread safety”.
However, do not change “multithreaded” to “multi-threaded” even
though there are some uses of both spellinga, as there are a whole
bunch of uses of “multithreaded”, also in identifier names;
perhaps Gnulib should even standardize on “multithreaded”
(not “multi-threaded”), contra POSIX.

9 days agosigprocmask: clarify GNULIB_SIGPROCMASK_SINGLE_THREAD doc
Paul Eggert [Sat, 11 Apr 2026 16:36:46 +0000 (09:36 -0700)] 
sigprocmask: clarify GNULIB_SIGPROCMASK_SINGLE_THREAD doc

9 days agofenv-exceptions-trapping tests: Make test more debugging friendly.
Bruno Haible [Fri, 10 Apr 2026 23:16:35 +0000 (01:16 +0200)] 
fenv-exceptions-trapping tests: Make test more debugging friendly.

Suggested by Pali Rohár <pali.rohar@gmail.com>.

* tests/test-fenv-except-trapping-1.c (main): Add an assertion.

9 days agosigprocmask: Allow single-thread optimization again.
Bruno Haible [Fri, 10 Apr 2026 21:11:40 +0000 (23:11 +0200)] 
sigprocmask: Allow single-thread optimization again.

* lib/sigprocmask.c (glwthread_spin_lock, glwthread_spin_unlock): Define
to empty if GNULIB_SIGPROCMASK_SINGLE_THREAD is defined.
(overrides_mt_lock, overrides_handler_lock): Don't define if
GNULIB_SIGPROCMASK_SINGLE_THREAD is defined.
* doc/multithread.texi (Multithreading Optimizations): Document
GNULIB_SIGPROCMASK_SINGLE_THREAD instead of
GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD.

9 days agosigprocmask: Fix a signal-handler hang in case of a race condition.
Bruno Haible [Fri, 10 Apr 2026 20:57:04 +0000 (22:57 +0200)] 
sigprocmask: Fix a signal-handler hang in case of a race condition.

* lib/sigprocmask.c (overrides_handler_lock): Renamed from
overrides_lock.
(overrides_mt_lock): New variable.
(pthread_sigmask): Lock both locks.
(rpl_signal): Lock overrides_mt_lock, not overrides_lock.

10 days agosigprocmask: Support multithreaded applications on native Windows.
Bruno Haible [Fri, 10 Apr 2026 15:22:07 +0000 (17:22 +0200)] 
sigprocmask: Support multithreaded applications on native Windows.

* lib/signal.in.h (WIN_PTHREADS_SIGNAL_H): New macro.
* lib/sigprocmask.c: Include windows-spin.h.
(thread_local): New macro.
(blocked_set, pending_array): Mark as thread-local.
(blocked_handler): Remove function.
(struct override): New type.
(overrides, overrides_lock): New variables.
(override_handler): New function.
(pthread_sigmask): New function, borrowing from the previous sigprocmask
definition.
(sigprocmask): Now a wrapper around pthread_sigmask.
(rpl_signal): Use the overrides_lock to make it multithread-safe.
(_gl_raise_SIGPIPE): Add comments.
* modules/sigprocmask (Depends-on): Add windows-spin.
* lib/pthread_sigmask.c: Revert last change. On native Windows, don't
define pthread_sigmask here.
* modules/pthread_sigmask (Depends-on): Remove lock.
* NEWS: Remove the last entry.

2 weeks agostat: Update doc regarding mingw bug.
Bruno Haible [Mon, 6 Apr 2026 11:38:22 +0000 (13:38 +0200)] 
stat: Update doc regarding mingw bug.

* doc/posix-functions/stat.texi: Update regarding mingw bug.

2 weeks agombrtowc, mbrtoc32: Silence -Wshadow warnings (regr. 2026-04-02).
Bruno Haible [Mon, 6 Apr 2026 11:21:56 +0000 (13:21 +0200)] 
mbrtowc, mbrtoc32: Silence -Wshadow warnings (regr. 2026-04-02).

Reported by Collin Funk.

* lib/mbrtowc.c (rpl_mbrtowc): Enclose the #include in a block.
* lib/mbrtoc32.c (mbrtoc32): Likewise.

2 weeks agosigprocmask: add NEWS entry
Paul Eggert [Sun, 5 Apr 2026 22:20:39 +0000 (15:20 -0700)] 
sigprocmask: add NEWS entry

2 weeks agoterm-style-control: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:29:48 +0000 (11:29 -0700)] 
term-style-control: use pthread_sigmask

* lib/term-style-control.c (block_relevant_signals)
(unblock_relevant_signals): Prefer pthread_sigmask to sigprocmask.
* modules/term-style-control (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.

2 weeks agofatal-signal: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:28:19 +0000 (11:28 -0700)] 
fatal-signal: use pthread_sigmask

* lib/fatal-signal.c (block_fatal_signals)
(unblock_fatal_signals): Prefer pthread_sigmask to sigprocmask.
* modules/fatal-signal (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.

2 weeks agosigaction: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:26:56 +0000 (11:26 -0700)] 
sigaction: use pthread_sigmask

* lib/sigaction.c (sigaction_handler, sigaction):
Use pthread_sigmask, not sigprocmask.
* modules/sigaction (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.

2 weeks agopthread_sigmask: lock here, not in sigprocmask
Paul Eggert [Sun, 5 Apr 2026 18:25:05 +0000 (11:25 -0700)] 
pthread_sigmask: lock here, not in sigprocmask

Since sigprocmask should now be used only in single-threaded processes,
move the locking from lib/sigprocmask.c to lib/pthread_sigmask.c.
* lib/pthread_sigmask.c: If !HAVE_SIGPROCMASK &&
!GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD, replace Gnulib sigprocmask
with a thread-safe subsitute sigprocmask_r.
Include glthread/lock.h to implement this.
* lib/sigprocmask.c (gl_lock_define_initialized, gl_lock_lock)
(gl_lock_unlock, sig_lock): Remove.  All uses removed.
Do not include glthread/lock.h.
* m4/signalblocking.m4 (gl_SIGNALBLOCKING):
Define HAVE_SIGPROCMASK, for the benefit of pthread_sigmask.c.
* modules/pthread_sigmask (Depends-on): Add ‘lock’.
* modules/sigprocmask (Depends-on): Remove ‘lock’.

2 weeks agomcel: remove forced use of GLIBC's mbrtoc32
Pádraig Brady [Sun, 5 Apr 2026 11:30:21 +0000 (12:30 +0100)] 
mcel: remove forced use of GLIBC's mbrtoc32

This is a performance win on GLIBC,
as tested on the coreutils multi-byte update to cut(1):

   $ yes $(yes éééááé | head -n9 | paste -s -d,) |
     head -n1M > mb.in

   $ time LC_ALL=C.UTF-8 src/cut-before -c1 mb.in >/dev/null
   real    0m1.582s

   $ time LC_ALL=C.UTF-8 src/cut-after -c1 mb.in >/dev/null
   real    0m0.592s

* lib/mcel.h: While GLIBC's mbrtoc32 is functional for mcel,
it is seen to be 2.6x slower than gnulib's implementation
due to GLIBC's per call locale handling.

2 weeks agoposix_spawn-internal: Remove a FIXME.
Bruno Haible [Sat, 4 Apr 2026 21:17:59 +0000 (23:17 +0200)] 
posix_spawn-internal: Remove a FIXME.

* lib/spawni.c (__spawni): Add comment regarding sigprocmask.

2 weeks agolinked-list-unportable-tests: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:55:34 +0000 (22:55 +0200)] 
linked-list-unportable-tests: Prefer pthread_sigmask over sigprocmask.

Suggested by Paul Eggert.

* tests/test-asyncsafe-linked_list-strong.c (block_sigint): Use
pthread_sigmask instead of sigprocmask.
* tests/test-asyncsafe-linked_list-weak.c (block_sigint): Likewise.

2 weeks agoasyncsafe-spin: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:44:10 +0000 (22:44 +0200)] 
asyncsafe-spin: Prefer pthread_sigmask over sigprocmask.

Suggested by Paul Eggert.

* lib/asyncsafe-spin.c (asyncsafe_spin_lock, asyncsafe_spin_unlock): Use
pthread_sigmask instead of sigprocmask.
* modules/asyncsafe-spin (Depends-on): Add pthread_sigmask. Remove
sigprocmask.
(Link): New section.
* modules/asyncsafe-spin-tests (Makefile.am): Link test-asyncsafe-spin1
with $(PTHREAD_SIGMASK_LIB).
* modules/jit/cache-tests (Makefile.am): Link test-cache with
$(PTHREAD_SIGMASK_LIB).

2 weeks agospawn-pipe: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:26:25 +0000 (22:26 +0200)] 
spawn-pipe: Prefer pthread_sigmask over sigprocmask.

Suggested by Paul Eggert.

* lib/spawn-pipe.c (execute): Use pthread_sigmask to get the set of
blocked signals.
* modules/spawn-pipe (Depends-on): Add pthread_sigmask.

2 weeks agoexecute: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:15:24 +0000 (22:15 +0200)] 
execute: Prefer pthread_sigmask over sigprocmask.

Suggested by Paul Eggert.

* lib/execute.c (execute): Use pthread_sigmask to get the set of blocked
signals.
* modules/execute (Depends-on): Add pthread_sigmask.

2 weeks agosigpipe-die: Relax specification.
Bruno Haible [Sat, 4 Apr 2026 20:01:56 +0000 (22:01 +0200)] 
sigpipe-die: Relax specification.

* lib/sigpipe-die.h (install_sigpipe_die_handler): Clarify how to use
this function in a multithreaded program.

2 weeks agopthread_sigmask: Make it usable without -lpthread on most platforms.
Bruno Haible [Sat, 4 Apr 2026 13:16:44 +0000 (15:16 +0200)] 
pthread_sigmask: Make it usable without -lpthread on most platforms.

* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Define
PTHREAD_SIGMASK_LIB to empty, except on AIX. Define
PTHREAD_SIGMASK_NOT_IN_LIBC if a workaround is needed.
* lib/pthread_sigmask.c (pthread_sigmask): If
PTHREAD_SIGMASK_NOT_IN_LIBC, just use sigprocmask.
* doc/posix-functions/pthread_sigmask.texi: Mention the dropped link
requirement. Mention that the NetBSD 9 bug is fixed.
* doc/posix-functions/sigprocmask.texi: Update note relating to
pthread_sigmask.

2 weeks agopthread_sigmask: Don't force an override on NetBSD.
Bruno Haible [Sat, 4 Apr 2026 13:16:31 +0000 (15:16 +0200)] 
pthread_sigmask: Don't force an override on NetBSD.

* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Limit the macro test
to native Windows.

2 weeks agopthread_sigmask tests: Enable all tests on NetBSD.
Bruno Haible [Sat, 4 Apr 2026 13:16:17 +0000 (15:16 +0200)] 
pthread_sigmask tests: Enable all tests on NetBSD.

* modules/pthread_sigmask-tests (Depends-on): Remove test-xfail.
(Makefile.am): Don't test OS_IS_NETBSD.

2 weeks agosigprocmask: document race bugs on macOS
Paul Eggert [Sat, 4 Apr 2026 02:55:48 +0000 (19:55 -0700)] 
sigprocmask: document race bugs on macOS

In documentation and comments, mention macOS sigprocmask
incompatibility with GNU and most other systems, and note Gnulib
uses of sigprocmask that can cause subtle race condition bugs on
macOS.  Although an obvious fix is to switch to pthread_sigmask as
POSIX suggests, that will require some changing to linking
instructions, and the first step is documentation.

2 weeks agosigprocmask: single-thread optimization typo fix
Paul Eggert [Fri, 3 Apr 2026 18:22:54 +0000 (11:22 -0700)] 
sigprocmask: single-thread optimization typo fix

* lib/sigprocmask.c (gl_lock_define_initialized):
Swap #if’s then- and else-parts.

2 weeks agombrtoc32: Optimize single-locale case on glibc systems.
Bruno Haible [Thu, 2 Apr 2026 19:59:58 +0000 (21:59 +0200)] 
mbrtoc32: Optimize single-locale case on glibc systems.

Suggested by Pádraig Brady.

* lib/mbrtoc32.c (is_locale_utf8, cached_is_locale_utf8,
is_locale_utf8_cached): New functions/variable, copied from
lib/wcwidth.c.
(mbrtoc32): If GNULIB_WCHAR_SINGLE_LOCALE is defined, optimize the
frequent case of an UTF-8 locale on glibc systems.

2 weeks agombrtowc: Optimize single-locale case on glibc systems.
Bruno Haible [Thu, 2 Apr 2026 19:58:36 +0000 (21:58 +0200)] 
mbrtowc: Optimize single-locale case on glibc systems.

Suggested by Pádraig Brady.

* lib/mbrtowc.c (is_locale_utf8, cached_is_locale_utf8,
is_locale_utf8_cached): New functions/variable, copied from
lib/wcwidth.c.
(rpl_mbrtowc): If GNULIB_WCHAR_SINGLE_LOCALE is defined, optimize the
frequent case of an UTF-8 locale on glibc systems.

2 weeks agosigprocmask: Allow single-thread optimization in a more reliable way.
Bruno Haible [Wed, 1 Apr 2026 20:45:55 +0000 (22:45 +0200)] 
sigprocmask: Allow single-thread optimization in a more reliable way.

* modules/sigprocmask: Revert last change.
* lib/sigprocmask.c: Test GNULIB_SIGPROCMASK_SINGLE_THREAD before
including glthread/lock.h.
* doc/multithread.texi: Document GNULIB_SIGPROCMASK_SINGLE_THREAD.

2 weeks agolock: Document backward-incompatible change from yesterday.
Bruno Haible [Wed, 1 Apr 2026 20:33:56 +0000 (22:33 +0200)] 
lock: Document backward-incompatible change from yesterday.

* NEWS: Add note about 'lock' module.

2 weeks agogettext-h: Revert most of last change.
Bruno Haible [Wed, 1 Apr 2026 20:20:21 +0000 (22:20 +0200)] 
gettext-h: Revert most of last change.

* m4/gettext_h.m4 (gl_GETTEXT_H): Revert last change.
* lib/gettext.h: Revert last change.
(LC_MESSAGES): Define fallback like in locale.in.h.

2 weeks agombs_endswith, mbs_startswith: port to mcel-prefer
Paul Eggert [Wed, 1 Apr 2026 18:41:53 +0000 (11:41 -0700)] 
mbs_endswith, mbs_startswith: port to mcel-prefer

* lib/mbs_endswith.c (mbs_endswith):
* lib/mbs_startswith.c (mbs_startswith):
If GNULIB_MCEL_PREFER, prefer the mcel.h API and semantics.

2 weeks agoyesno: treat unlocking similarly if !ENABLE_NLS
Paul Eggert [Wed, 1 Apr 2026 18:34:42 +0000 (11:34 -0700)] 
yesno: treat unlocking similarly if !ENABLE_NLS

If the application is using unlocked-io, do that in the
!ENABLE_NLS case too.  This is more for consistency than for
performance in the typical case.
* lib/yesno.c [USE_UNLOCKED_IO]: Include unlocked-io.h.

2 weeks agoautoupdate
Karl Berry [Wed, 1 Apr 2026 14:12:55 +0000 (07:12 -0700)] 
autoupdate

2 weeks agosigprocmask: allow --avoid=lock
Paul Eggert [Wed, 1 Apr 2026 02:54:46 +0000 (19:54 -0700)] 
sigprocmask: allow --avoid=lock

* modules/sigprocmask (Files): Add lib/glthread/lock.h,
so that this module works even if the lock module is avoided.
This is useful for gzip, which does not use multithreading.

2 weeks agothread: lessen glthread namespace pollution
Paul Eggert [Wed, 1 Apr 2026 02:51:36 +0000 (19:51 -0700)] 
thread: lessen glthread namespace pollution

In lib/glthread/*.h, avoid including files if it’s easy, and if
the files are not needed in the .h file to implement the module.
* lib/glthread/cond.h: Include glthread/lock.h only if needed.
* lib/glthread/lock.c, lib/glthread/once.c: Include <errno.h> here ...
* lib/glthread/lock.h, lib/glthread/once.h: ... instead of here.
* lib/glthread/lock.h: Include glthread/once.h only if needed.
* lib/glthread/yield.h: Don’t include <errno.h>.

2 weeks agogettext-h: don’t depend on locale-h
Paul Eggert [Tue, 31 Mar 2026 23:38:47 +0000 (16:38 -0700)] 
gettext-h: don’t depend on locale-h

This is useful for apps like gzip.h that stay in the C locale
and don’t need all the the locale-h machinery.
* lib/gettext.h: Include <locale.h> only if !ENABLE_NLS && __sun.
(pgettext, dpgettext, npgettext, dnpgettext, pgettext_expr)
(npgettext_expr): Use _GL_LC_MESSAGES, not LC_MESSAGES.
* m4/gettext_h.m4 (gl_GETTEXT_H): Define _GL_LC_MESSAGES.
* modules/gettext-h (Depends-on): Remove locale-h.

2 weeks agofenv-exceptions-trapping: Work around mingw 14.0.0 bug.
Bruno Haible [Tue, 31 Mar 2026 06:44:44 +0000 (08:44 +0200)] 
fenv-exceptions-trapping: Work around mingw 14.0.0 bug.

* doc/glibc-functions/feenableexcept.texi: Mention the mingw 14.0.0 bug.

2 weeks agofenv-exceptions-trapping: Work around mingw 14.0.0 bug.
Bruno Haible [Mon, 30 Mar 2026 20:12:50 +0000 (22:12 +0200)] 
fenv-exceptions-trapping: Work around mingw 14.0.0 bug.

* m4/fenv-exceptions-trapping.m4 (gl_FENV_EXCEPTIONS_TRAPPING): Override
feenableexcept, fedisableexcept also on mingw.

3 weeks agorenameatu tests: Enhance test of the RENAME_* macros.
Bruno Haible [Mon, 30 Mar 2026 10:19:35 +0000 (12:19 +0200)] 
renameatu tests: Enhance test of the RENAME_* macros.

* tests/test-renameatu.c (main): Test that the RENAME_* macro values are
disjoint.

3 weeks agorenameatu tests: Test that the RENAME_* macros are defined.
Collin Funk [Mon, 30 Mar 2026 03:29:48 +0000 (20:29 -0700)] 
renameatu tests: Test that the RENAME_* macros are defined.

* tests/test-renameatu.c (main): Test that the RENAME_* macros are
defined and unique.

3 weeks agorenameatu: Ensure all RENAME_* macros are defined.
Collin Funk [Mon, 30 Mar 2026 03:27:33 +0000 (20:27 -0700)] 
renameatu: Ensure all RENAME_* macros are defined.

* lib/renameatu.h (RENAME_EXCHANGE) [!RENAME_EXCHANGE]: Define macro.
(RENAME_WHITEOUT) [!RENAME_WHITEOUT]: Likewise.

3 weeks agognu-web-doc-update: Add an environment variable for the CVS username
Collin Funk [Fri, 27 Mar 2026 02:59:19 +0000 (19:59 -0700)] 
gnu-web-doc-update: Add an environment variable for the CVS username

* build-aux/gnu-web-doc-update (help): Mention the SAVANNAH_CVS_USER
environment variable.
($cvs_user): Use the SAVANNAH_CVS_USER environment variable and fallback
to USER if it is unset or empty.

3 weeks agodoc: Mention a Solaris 11.4 bug.
Collin Funk [Wed, 25 Mar 2026 03:11:36 +0000 (20:11 -0700)] 
doc: Mention a Solaris 11.4 bug.

* doc/posix-functions/open.texi: Mention that Solaris 11.4 sets errno to
EINVAL instead of EISDIR when open is called on a directory with
O_CREAT.
* doc/posix-functions/openat.texi: Likewise.

4 weeks agoFix typos in recent ChangeLog entry.
Bruno Haible [Sat, 21 Mar 2026 10:40:36 +0000 (11:40 +0100)] 
Fix typos in recent ChangeLog entry.

4 weeks agovasprintf-posix, vasprintf, stdio-windows: Prefer AC_CHECK_FUNCS_ONCE.
Collin Funk [Sat, 21 Mar 2026 01:43:34 +0000 (18:43 -0700)] 
vasprintf-posix, vasprintf, stdio-windows: Prefer AC_CHECK_FUNCS_ONCE.

* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Use
AC_CHECK_FUNCS_ONCE instead of AC_CHECK_FUNCS.
* m4/vasprintf.m4 (gl_FUNC_VASPRINTF): Likewise.
* modules/stdio-windows: Likewise.

4 weeks agonstrftime: revert size typo non-fix
Paul Eggert [Fri, 20 Mar 2026 23:24:48 +0000 (16:24 -0700)] 
nstrftime: revert size typo non-fix

(Thanks to Bruno Haible.)

4 weeks agobyteswap: depend on stdbit-h, not stdint-h
Paul Eggert [Fri, 20 Mar 2026 22:31:37 +0000 (15:31 -0700)] 
byteswap: depend on stdbit-h, not stdint-h

* lib/byteswap.in.h: Do not include stdint.h, as stdbit.h suffices.
* modules/byteswap (Depends-on): Depend on stdbit-h, not stdint-h.

4 weeks agocountof-h: use countof, part 3
Paul Eggert [Fri, 20 Mar 2026 21:41:55 +0000 (14:41 -0700)] 
countof-h: use countof, part 3

* lib/nproc.c, lib/regex_internal.h, lib/set-permissions.c:
* lib/strftime.c:
Include <stdcountof.h>.
* lib/nproc.c (ARRAY_SIZE):
* lib/sig2str.c (NUNNAME_ENTRIES):
Remove.  All uses replaced with countof.
* lib/regcomp.c (regerror):
* lib/set-permissions.c (set_acls_from_mode):
* lib/strftime.c (__strftime_internal):
Use countof instead of doing it by hand.
* modules/acl-permissions, modules/c-nstrftime, modules/fprintftime:
* modules/nproc, modules/regex, modules/nstrftime:
* modules/nstrftime-limited, modules/sig2str:
Depend on stdcountof-h.

4 weeks agoboot-time: remove SIZEOF
Paul Eggert [Fri, 20 Mar 2026 21:30:53 +0000 (14:30 -0700)] 
boot-time: remove SIZEOF

* lib/boot-time-aux.h (SIZEOF): Remove; no longer used,
now that the code uses countof.

4 weeks agonstrftime: fix size typo when compiling for glibc
Paul Eggert [Fri, 20 Mar 2026 20:56:29 +0000 (13:56 -0700)] 
nstrftime: fix size typo when compiling for glibc

* lib/strftime.c (c_weekday_names, c_month_names) [COMPILE_WIDE]:
Fix size typo.

4 weeks agostdbit-h: don’t generate some dummy .o files
Paul Eggert [Mon, 16 Mar 2026 22:17:26 +0000 (15:17 -0700)] 
stdbit-h: don’t generate some dummy .o files

On recent GNU and other C23ish platforms, do not compile files
like lib/stdc_bit_ceil.c, as the corresponding .o files contain
nothing useful.
* m4/stdbit_h.m4 (gl_STDBIT_H):
Define the Automake condition GL_HAVE_STDBIT_H.
Quote cache variables in case the cache is bad.
* modules/stdc_bit_ceil, modules/stdc_bit_floor:
* modules/stdc_bit_width, modules/stdc_count_ones:
* modules/stdc_count_zeros, modules/stdc_first_leading_one:
* modules/stdc_first_leading_zero:
* modules/stdc_first_trailing_one:
* modules/stdc_first_trailing_zero, modules/stdc_has_single_bit:
* modules/stdc_leading_ones, modules/stdc_leading_zeros:
* modules/stdc_trailing_ones, modules/stdc_trailing_zeros:
Generate if !GL_HAVE_STDBIT_H, not if GL_GENERATE_STDBIT_H.

4 weeks agocygpath: Add reminder to include <config.h>.
Collin Funk [Mon, 16 Mar 2026 19:25:28 +0000 (12:25 -0700)] 
cygpath: Add reminder to include <config.h>.

* lib/cygpath.h: Check that config.h was already included so
_GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE are defined.

4 weeks agostdc_memrevers8u: Add comment.
Bruno Haible [Mon, 16 Mar 2026 19:42:58 +0000 (20:42 +0100)] 
stdc_memrevers8u: Add comment.

* lib/stdbit.in.h (stdc_memreverse8u*): Add comment regarding
uint_leastN_t.

4 weeks agostdbit-h: Make code more readable and typo-proof.
Bruno Haible [Mon, 16 Mar 2026 19:30:13 +0000 (20:30 +0100)] 
stdbit-h: Make code more readable and typo-proof.

* lib/stdbit.in.h (stdc_load8_beu16, stdc_load8_beu32, stdc_load8_beu64,
stdc_load8_leu16, stdc_load8_leu32, stdc_load8_leu64): Avoid declaring
multiple variables in one declaration.

4 weeks agostdbit-h: don’t memcpy on oddball hosts
Paul Eggert [Mon, 16 Mar 2026 19:18:23 +0000 (12:18 -0700)] 
stdbit-h: don’t memcpy on oddball hosts

Mostly-theoretical problem reported by Lasse Collin in:
https://lists.gnu.org/r/bug-gnulib/2026-03/msg00135.html
* lib/stdbit.in.h (_GL_STDBIT_OPTIMIZE_VIA_MEMCPY):
Do not define to 1 on oddball hosts.

5 weeks agostdbit-h: be clearer about castless conversion
Paul Eggert [Mon, 16 Mar 2026 16:10:00 +0000 (09:10 -0700)] 
stdbit-h: be clearer about castless conversion

* lib/stdbit.in.h (stdc_load8_beu16, stdc_load8_beu32)
(stdc_load8_beu64, stdc_load8_leu16, stdc_load8_leu32)
(stdc_load8_leu64): Assign to temporaries rather than ORing to zero.

5 weeks agostdc_rotate_left, stdc_rotate_right: Update documentation.
Bruno Haible [Mon, 16 Mar 2026 12:31:59 +0000 (13:31 +0100)] 
stdc_rotate_left, stdc_rotate_right: Update documentation.

* doc/posix-functions/stdc_rotate_left.texi: Document the effects of the
new module.
* doc/posix-functions/stdc_rotate_right.texi: Likewise.

5 weeks agostdbit-h: Reorder definitions.
Bruno Haible [Mon, 16 Mar 2026 09:12:46 +0000 (10:12 +0100)] 
stdbit-h: Reorder definitions.

* lib/stdbit.in.h: Move private helper macros and functions to the
section conditionalized by @GNULIB_STDC_LEADING_ZEROS@,
@GNULIB_STDC_TRAILING_ZEROS@, @GNULIB_STDC_COUNT_ONES@, respectively.

5 weeks agostdbit-h: Fix syntax error in C++ mode (regression 2026-03-12).
Bruno Haible [Mon, 16 Mar 2026 08:45:45 +0000 (09:45 +0100)] 
stdbit-h: Fix syntax error in C++ mode (regression 2026-03-12).

* lib/stdbit.in.h: Move the 'extern "C" {' outside of the
'#if !@HAVE_STDBIT_H@'.

5 weeks agostdbit-h: remove stdbit.c
Paul Eggert [Mon, 16 Mar 2026 06:54:59 +0000 (23:54 -0700)] 
stdbit-h: remove stdbit.c

lib/stdbit.c was present only to define private helper functions.
Move them into lib/stdc_leading_zeros.c and
lib/stdc_trailing_zeros.c, depending on what they help.
The latter now might use the former, since the
_gl_stdbit_ctz family calls the _gl_stdbit_clz family
when !defined _GL_STDBIT_HAS_BUILTIN_CTZ && !defined _MSC_VER,
so stdc_trailing_zeros now depends on stdc_leading_zeros.
* lib/stdbit.c: Remove file.
* lib/stdbit.in.h (_GL_STDBIT_INLINE): Remove.
All uses replaced by _GL_STDC_LEADING_ZEROS_INLINE
or _GL_STDC_TRAILING_ZEROS_INLINE.
* modules/stdbit-h (Files, lib_SOURCES): Remove lib/stdbit.c.
* modules/stdc_trailing_zeros (Depends-on): Add stdc_leading_zeros.

5 weeks agostdbit-h: test without <stdint.h>
Paul Eggert [Mon, 16 Mar 2026 06:54:58 +0000 (23:54 -0700)] 
stdbit-h: test without <stdint.h>

Improve the <stdbit.h> tests so that they check
that <stdbit.h> works even if <stdint.h> is not included.
* modules/stdc_bit_ceil-tests, modules/stdc_bit_floor-tests:
* modules/stdc_bit_width-tests, modules/stdc_count_ones-tests:
* modules/stdc_count_zeros-tests:
* modules/stdc_first_leading_one-tests:
* modules/stdc_first_leading_zero-tests:
* modules/stdc_first_trailing_one-tests:
* modules/stdc_first_trailing_zero-tests:
* modules/stdc_has_single_bit-tests:
* modules/stdc_leading_ones-tests:
* modules/stdc_leading_zeros-tests:
* modules/stdc_trailing_ones-tests:
* modules/stdc_trailing_zeros-tests:
(Depends-on): Remove stdint-h.
* tests/from-glibc/tst-stdbit.h [GNULIB_TEST_STDBIT]:
Do not include <stdint.h>.

5 weeks agostdbit-h: don’t depend on stdint-h
Paul Eggert [Mon, 16 Mar 2026 06:54:58 +0000 (23:54 -0700)] 
stdbit-h: don’t depend on stdint-h

* modules/stdc_load8, modules/stdc_load8_aligned:
* modules/stdc_store8, modules/stdc_store8_aligned:
* modules/stdc_memreverse8u:
(Depends-on): Remove stdint-h, as Gnulib should be able to assume
the small subset of C99 <stdint.h> that stdbit.in.h uses.

5 weeks agostdbit-h: namespace cleanup on recent GNU
Paul Eggert [Mon, 16 Mar 2026 06:54:58 +0000 (23:54 -0700)] 
stdbit-h: namespace cleanup on recent GNU

* lib/stdbit.in.h: Include <stddef.h> if !@HAVE_STDBIT_H@, good on
all known Gnulib targets, not if @GNULIB_STDC_MEMREVERSE8@, which
is not quite right because C23 requires that stdbit.h define
size_t even if stdc_memreverse8 is not used.
Do not include <stdint.h> if @HAVE_STDBIT_H@ && defined
__UINT_FAST64_TYPE__, as it is no longer needed.
(_GL_STDBIT_UINT_FAST16, _GL_STDBIT_UINT_FAST32)
(_GL_STDBIT_UINT_FAST64): New macros.  Use them instead of
uint_fast16_t etc., to avoid namespace pollution.
(stdc_load8_beu16, stdc_load8_beu32, stdc_load8_beu64)
(stdc_load8_leu16, stdc_load8_leu32, stdc_load8_leu64):
Use them instead of casting to the relevant types,
to avoid the need for casts.

5 weeks agotest-stdc_rotate_right tests: Fix whitespace.
Collin Funk [Mon, 16 Mar 2026 05:29:25 +0000 (22:29 -0700)] 
test-stdc_rotate_right tests: Fix whitespace.

* tests/test-stdc_rotate_right.c (TEST_CASE): Remove extra space
character.

5 weeks agodoc: add missing module indexes.
Collin Funk [Mon, 16 Mar 2026 05:27:18 +0000 (22:27 -0700)] 
doc: add missing module indexes.

Reported by Bruno Haible in
<https://lists.gnu.org/r/bug-gnulib/2026-03/msg00124.html>.

* doc/posix-functions/stdc_rotate_left.texi: Add missing module index.
* doc/posix-functions/stdc_rotate_right.texi: Likewise.

5 weeks agostdc_rotate_right: Add tests.
Collin Funk [Mon, 16 Mar 2026 00:01:40 +0000 (17:01 -0700)] 
stdc_rotate_right: Add tests.

* modules/stdc_rotate_right-tests: New file.
* tests/test-stdc_rotate_right.c: Likewise.