]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agoposix_spawn-internal: Optimize DuplicateHandle calls on native Windows.
Bruno Haible [Sat, 10 Sep 2022 00:27:05 +0000 (02:27 +0200)]
posix_spawn-internal: Optimize DuplicateHandle calls on native Windows.

* lib/windows-spawn.h (KEEP_OPEN_IN_PARENT): New macro.
* lib/windows-spawn.c (init_inheritable_handles): When a handle is
already inheritable, don't bother duplicating it; instead, just mark it
as KEEP_OPEN_IN_PARENT.
* lib/spawni.c (shrink_inheritable_handles, close_inheritable_handles,
do_open, do_dup2, do_close): Don't close handles that are marked as
KEEP_OPEN_IN_PARENT.

2 years agoposix_spawn-internal: Don't lose flags while duplicating an fd.
Bruno Haible [Sat, 10 Sep 2022 00:26:18 +0000 (02:26 +0200)]
posix_spawn-internal: Don't lose flags while duplicating an fd.

* lib/spawni.c (do_dup2): Fix the flags of the new fd.

2 years agospawn-pipe: Fix pipe-filter-* test hangs (regression 2020-12-24).
Bruno Haible [Fri, 9 Sep 2022 14:49:10 +0000 (16:49 +0200)]
spawn-pipe: Fix pipe-filter-* test hangs (regression 2020-12-24).

* lib/windows-spawn.h (struct inheritable_handles): Widen the per-fd
flags from 8 bits to 16 bits.
(KEEP_OPEN_IN_CHILD): New macro.
(init_inheritable_handles): Change description of what it does when
duplicate == true.
* lib/windows-spawn.c (init_inheritable_handles): If duplicate == true,
add all fds to the array, regardless whether they are scheduled to be
preserved in the child process.
(compose_handles_block): Update.
(spawnpvech): Update.
* lib/spawni.c (grow_inheritable_handles): Update.
(shrink_inheritable_handles): Also close the handles not marked with
KEEP_OPEN_IN_CHILD.
(do_open, do_dup2): Mark the new fd with KEEP_OPEN_IN_CHILD.

2 years agoautoupate
Karl Berry [Fri, 9 Sep 2022 14:41:01 +0000 (07:41 -0700)]
autoupate

2 years agospawn-pipe: Fix possible hangs in programs that spawn several children.
Bruno Haible [Fri, 9 Sep 2022 13:14:45 +0000 (15:14 +0200)]
spawn-pipe: Fix possible hangs in programs that spawn several children.

* lib/spawn-pipe.c (create_pipe) [Unix]: Create the ifd[] and ofd[] file
descriptors with the close-on-exec flag set.

2 years agopipe-filter-gi tests: Fix long-standing failure on native Windows.
Bruno Haible [Tue, 6 Sep 2022 13:09:41 +0000 (15:09 +0200)]
pipe-filter-gi tests: Fix long-standing failure on native Windows.

* tests/test-pipe-filter-gi2-main.c: Include binary-io.h.
(main): Avoid NL to CRLF conversion on standard output.
* tests/test-pipe-filter-gi2-child.c: Include <unistd.h>, binary-io.h.
(main): Avoid NL to CRLF conversion on standard output.

2 years agoposix_spawn_file_actions_addclose tests: Fix mistake from 2022-09-07.
Bruno Haible [Fri, 9 Sep 2022 12:26:54 +0000 (14:26 +0200)]
posix_spawn_file_actions_addclose tests: Fix mistake from 2022-09-07.

* modules/posix_spawn_file_actions_addclose-tests (Files): Add
m4/musl.m4.

2 years agostdbool-tests: match stdbool
Paul Eggert [Fri, 9 Sep 2022 04:46:19 +0000 (23:46 -0500)]
stdbool-tests: match stdbool

* tests/test-stdbool.c: Omit test for
__bool_true_false_are_defined since AC_CHECK_HEADER_STDBOOL no
longer checks for this obsolescent macro.

2 years agomktime: back in sync with GNUlib
Paul Eggert [Fri, 9 Sep 2022 04:11:59 +0000 (23:11 -0500)]
mktime: back in sync with GNUlib

* config/srclist.txt: glibc has synced mktime from Gnulib.

2 years agoautoupdate
Paul Eggert [Fri, 9 Sep 2022 04:10:20 +0000 (23:10 -0500)]
autoupdate

2 years agoposix_spawn_file_actions_addclose tests: Avoid test failure on musl.
Bruno Haible [Wed, 7 Sep 2022 21:33:31 +0000 (23:33 +0200)]
posix_spawn_file_actions_addclose tests: Avoid test failure on musl.

Reported by Valery Ushakov <uwe@stderr.spb.ru> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-09/msg00041.html>.

* modules/posix_spawn_file_actions_addclose-tests (configure.ac): Invoke
gl_MUSL_LIBC.
* tests/test-posix_spawn_file_actions_addclose.c (main): Skip one of the
tests on musl libc.

2 years agoautoupdate
Karl Berry [Tue, 6 Sep 2022 14:18:41 +0000 (07:18 -0700)]
autoupdate

2 years agognumakefile: Improve tarball reproducibility.
Simon Josefsson [Tue, 6 Sep 2022 12:32:05 +0000 (14:32 +0200)]
gnumakefile: Improve tarball reproducibility.

* top/GNUmakefile (TAR_OPTIONS): Add --sort=name.  Suggested by
Tzvetelin Katchov <katchov@gnu.org>.
* DEPENDENCIES: Mention tar 1.28 dependency.

2 years agopthread-h: Fix compilation error on mingw with --enable-threads=windows.
Bruno Haible [Mon, 5 Sep 2022 19:54:10 +0000 (21:54 +0200)]
pthread-h: Fix compilation error on mingw with --enable-threads=windows.

* lib/pthread.in.h: In C++ mode, if mingw's <pthread.h> has not been
used, import many pthread_* symbols from the GNULIB_NAMESPACE into the
global namespace.

2 years agoautoupdate
Karl Berry [Mon, 5 Sep 2022 14:55:49 +0000 (07:55 -0700)]
autoupdate

2 years agoFix various test link errors on MSVC.
Bruno Haible [Sun, 4 Sep 2022 23:53:28 +0000 (01:53 +0200)]
Fix various test link errors on MSVC.

* modules/crypto/gc-arcfour-tests (Makefile.am): Link test-gc-arcfour
with $(LIB_GETRANDOM).
* modules/crypto/gc-arctwo-tests (Makefile.am): Link test-gc-arctwo with
$(LIB_GETRANDOM).
* modules/crypto/gc-des-tests (Makefile.am): Link test-gc-des with
$(LIB_GETRANDOM).
* modules/crypto/gc-hmac-md5-tests (Makefile.am): Link test-gc-hmac-md5
with $(LIB_GETRANDOM).
* modules/crypto/gc-hmac-sha1-tests (Makefile.am): Link
test-gc-hmac-sha1 with $(LIB_GETRANDOM).
* modules/crypto/gc-hmac-sha256-tests (Makefile.am): Link
test-gc-hmac-sha256 with $(LIB_GETRANDOM).
* modules/crypto/gc-hmac-sha512-tests (Makefile.am): Link
test-gc-hmac-sha512 with $(LIB_GETRANDOM).
* modules/crypto/gc-md2-tests (Makefile.am): Link test-gc-md2 with
$(LIB_GETRANDOM).
* modules/crypto/gc-md4-tests (Makefile.am): Link test-gc-md4 with
$(LIB_GETRANDOM).
* modules/crypto/gc-md5-tests (Makefile.am): Link test-gc-md5 with
$(LIB_GETRANDOM).
* modules/crypto/gc-pbkdf2-tests (Makefile.am): Link test-gc-pbkdf2 with
$(LIB_GETRANDOM).
* modules/crypto/gc-pbkdf2-sha1-tests (Makefile.am): Link
test-gc-pbkdf2-sha1 with $(LIB_GETRANDOM).
* modules/crypto/gc-rijndael-tests (Makefile.am): Link test-gc-rijndael
with $(LIB_GETRANDOM).
* modules/crypto/gc-sha1-tests (Makefile.am): Link test-gc-sha1 with
$(LIB_GETRANDOM).
* modules/crypto/gc-sha256-tests (Makefile.am): Link test-gc-sha256 with
$(LIB_GETRANDOM).
* modules/crypto/gc-sha512-tests (Makefile.am): Link test-gc-sha512 with
$(LIB_GETRANDOM).
* modules/crypto/gc-sm3-tests (Makefile.am): Link test-gc-sm3 with
$(LIB_GETRANDOM).
* modules/sys_stat-c++-tests (Makefile.am): Link test-sys_stat-c++ with
$(LIB_GETRANDOM).
* modules/unistd-c++-tests (Makefile.am): Link test-unistd-c++ with
$(LIB_GETRANDOM).

2 years agocount-leading-zeros: Fix a link error on 32-bit MSVC and a test failure.
Bruno Haible [Sun, 4 Sep 2022 23:34:36 +0000 (01:34 +0200)]
count-leading-zeros: Fix a link error on 32-bit MSVC and a test failure.

* lib/count-leading-zeros.h: Correct syntax for #pragma intrinsic.
(COUNT_LEADING_ZEROS): Fix the return value.
(count_leading_zeros_ll): Use two _BitScanReverse invocations instead
of a _BitScanReverse64 invocation.

2 years agocount-trailing-zeros: Fix a link error on 32-bit MSVC.
Bruno Haible [Sun, 4 Sep 2022 23:29:26 +0000 (01:29 +0200)]
count-trailing-zeros: Fix a link error on 32-bit MSVC.

* lib/count-trailing-zeros.h: Correct syntax for #pragma intrinsic.
(count_trailing_zeros_ll): Use two _BitScanForward invocations instead
of a _BitScanForward64 invocation.

2 years agounictype/category-none tests: Fix a link error on MSVC.
Bruno Haible [Sun, 4 Sep 2022 22:31:33 +0000 (00:31 +0200)]
unictype/category-none tests: Fix a link error on MSVC.

* tests/unictype/test-categ_none.c (main): Disable the test on MSVC.

2 years agooset-c++: Fix compilation error with MSVC 14.
Bruno Haible [Sun, 4 Sep 2022 22:14:48 +0000 (00:14 +0200)]
oset-c++: Fix compilation error with MSVC 14.

* lib/gl_oset.hh: With MSVC, avoid 'friend'.

2 years agoglob tests: Fix link error on mingw.
Bruno Haible [Sun, 4 Sep 2022 22:02:44 +0000 (00:02 +0200)]
glob tests: Fix link error on mingw.

* modules/glob-tests (Makefile.am): Link test-glob with $(LIBINTL).

2 years agoautoupdate
Karl Berry [Sun, 4 Sep 2022 15:47:07 +0000 (08:47 -0700)]
autoupdate

2 years agotimespec_get: Fix compilation error with MSVC 14.
Bruno Haible [Sun, 4 Sep 2022 15:09:53 +0000 (17:09 +0200)]
timespec_get: Fix compilation error with MSVC 14.

* m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): New macro.
(gl_GETTIME): Use it instead of AC_CHECK_FUNCS_ONCE.
* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Likewise.

2 years agostdbool: Fix compilation error in C++ mode with MSVC 14.
Bruno Haible [Sun, 4 Sep 2022 14:24:56 +0000 (16:24 +0200)]
stdbool: Fix compilation error in C++ mode with MSVC 14.

* lib/stdbool.in.h (_Bool, bool, false, true): In C++ mode with MSVC 14,
don't define these as macros.

2 years agofts: Fix compilation error with MSVC 14.
Bruno Haible [Sun, 4 Sep 2022 14:14:17 +0000 (16:14 +0200)]
fts: Fix compilation error with MSVC 14.

* lib/fts.c (S_IFBLK): Add fallback definition.

2 years agolstat: Fix compilation error in C++ mode on mingw.
Bruno Haible [Sun, 4 Sep 2022 14:06:37 +0000 (16:06 +0200)]
lstat: Fix compilation error in C++ mode on mingw.

* lib/sys_stat.h (lstat): Move declaration after the declaration of
'stat'.

2 years agopselect: Fix compilation error in C++ mode on mingw.
Bruno Haible [Sun, 4 Sep 2022 13:51:29 +0000 (15:51 +0200)]
pselect: Fix compilation error in C++ mode on mingw.

* lib/sys_select.in.h (pselect): Enable the C++ alias warning only on
glibc systems.

2 years agonanosleep: Work around bug on newer 32-bit mingw.
Bruno Haible [Sun, 4 Sep 2022 11:26:19 +0000 (13:26 +0200)]
nanosleep: Work around bug on newer 32-bit mingw.

* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Test for 32-bit mingw bug.
* tests/test-nanosleep.c (main): Add another test.
* doc/posix-functions/nanosleep.texi: Mention the mingw bug.

2 years agofmal: Work around glibc 2.17 bug on x86_64.
Bruno Haible [Sun, 4 Sep 2022 02:48:31 +0000 (04:48 +0200)]
fmal: Work around glibc 2.17 bug on x86_64.

* m4/fmal.m4 (gl_FUNC_FMAL_WORKS): Test against bug seen on glibc 2.17
x86_64.
* doc/posix-functions/fmal.texi: Update info.

2 years agoFix a compilation error in C++ mode on Solaris 11.4.
Bruno Haible [Sun, 4 Sep 2022 00:52:14 +0000 (02:52 +0200)]
Fix a compilation error in C++ mode on Solaris 11.4.

* lib/uchar.in.h (c32rtomb): Enable the C++ alias warning only on
glibc ≥ 2.16 systems. Fix a GNULIB_POSIXCHECK mistake.
(mbrtoc32): Enable the C++ alias warning only on glibc ≥ 2.16 systems.

2 years agoFix compilation errors of C++ tests on Solaris 10 with Sun C++.
Bruno Haible [Sat, 3 Sep 2022 23:14:18 +0000 (01:14 +0200)]
Fix compilation errors of C++ tests on Solaris 10 with Sun C++.

* modules/string-c++-tests (Makefile.am): Link test-string-c++ with
$(LIBUNISTRING).
* modules/wchar-c++-tests (Makefile.am): Link test-wchar-c++ with
$(LIBUNISTRING).

2 years agoFix a compilation error in C++ mode on FreeBSD 13.1.
Bruno Haible [Sat, 3 Sep 2022 20:40:05 +0000 (22:40 +0200)]
Fix a compilation error in C++ mode on FreeBSD 13.1.

* lib/signal.in.h: Don't include <pthread.h> on FreeBSD ≥ 8.0.
* lib/sys_select.in.h: Don't include <sys/time.h> on FreeBSD.

2 years agostdnoreturn: Document relation to C++.
Bruno Haible [Sat, 3 Sep 2022 20:12:42 +0000 (22:12 +0200)]
stdnoreturn: Document relation to C++.

* doc/posix-headers/stdnoreturn.texi: Document FreeBSD problem.

2 years agosysexits: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 19:13:35 +0000 (21:13 +0200)]
sysexits: Add C++ tests.

* tests/test-sysexits-c++.cc: New file.
* modules/sysexits-c++-tests: New file.
* modules/sysexits-tests (Depends-on): Add sysexits-c++-tests.

2 years agosys_utsname: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 19:10:07 +0000 (21:10 +0200)]
sys_utsname: Add C++ tests.

* tests/test-sys_utsname-c++.cc: New file.
* modules/sys_utsname-c++-tests: New file.
* modules/sys_utsname-tests (Depends-on): Add sys_utsname-c++-tests.

2 years agosys_uio: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 19:07:36 +0000 (21:07 +0200)]
sys_uio: Add C++ tests.

* tests/test-sys_uio-c++.cc: New file.
* modules/sys_uio-c++-tests: New file.
* modules/sys_uio-tests (Depends-on): Add sys_uio-c++-tests.

2 years agosys_times: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 19:02:30 +0000 (21:02 +0200)]
sys_times: Add C++ tests.

* tests/test-sys_times-c++.cc: New file.
* modules/sys_times-c++-tests: New file.
* modules/sys_times-tests (Depends-on): Add sys_times-c++-tests.

2 years agosys_file: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:58:32 +0000 (20:58 +0200)]
sys_file: Add C++ tests.

* tests/test-sys_file-c++.cc: New file.
* modules/sys_file-c++-tests: New file.
* modules/sys_file-tests (Depends-on): Add sys_file-c++-tests.

2 years agosys_file: Document this module.
Bruno Haible [Sat, 3 Sep 2022 18:57:14 +0000 (20:57 +0200)]
sys_file: Document this module.

* doc/glibc-headers/sys_file.texi: New file.
* doc/gnulib.texi (Glibc Header File Substitutes): Include it.

2 years agostdckdint: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:48:58 +0000 (20:48 +0200)]
stdckdint: Add C++ tests.

* tests/test-stdckdint-c++.cc: New file.
* modules/stdckdint-c++-tests: New file.
* modules/stdckdint-tests (Depends-on): Add stdckdint-c++-tests.

2 years agostdalign: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:42:51 +0000 (20:42 +0200)]
stdalign: Add C++ tests.

* tests/test-stdalign-c++.cc: New file.
* modules/stdalign-c++-tests: New file.
* modules/stdalign-tests (Depends-on): Add stdalign-c++-tests.

2 years agosched: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:39:11 +0000 (20:39 +0200)]
sched: Add C++ tests.

* tests/test-sched-c++.cc: New file.
* modules/sched-c++-tests: New file.
* modules/sched-tests (Depends-on): Add sched-c++-tests.

2 years agonetinet_in: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:33:32 +0000 (20:33 +0200)]
netinet_in: Add C++ tests.

* tests/test-netinet_in-c++.cc: New file.
* modules/netinet_in-c++-tests: New file.
* modules/netinet_in-tests (Depends-on): Add netinet_in-c++-tests.

2 years agonet_if: Add C++ tests.
Bruno Haible [Sat, 3 Sep 2022 18:21:37 +0000 (20:21 +0200)]
net_if: Add C++ tests.

* tests/test-net_if-c++.cc: New file.
* modules/net_if-c++-tests: New file.
* modules/net_if-tests (Depends-on): Add net_if-c++-tests.
* doc/posix-headers/net_if.texi: Fix documentation.

2 years agotermcap: Fix link error on AIX 7.
Bruno Haible [Sat, 3 Sep 2022 16:42:13 +0000 (18:42 +0200)]
termcap: Fix link error on AIX 7.

* m4/termcap.m4 (gl_TERMCAP_BODY): Search also for libxcurses and for
libcurses, like gl_TERMINFO_BODY does.
* m4/terminfo.m4 (gl_TERMINFO_BODY): Update platform list in comment.

2 years agogetrandom: Fix compilation error in C++ mode on FreeBSD 12.
Bruno Haible [Sat, 3 Sep 2022 00:48:38 +0000 (02:48 +0200)]
getrandom: Fix compilation error in C++ mode on FreeBSD 12.

* lib/sys_random.in.h (getrandom): Enable the C++ alias warning only on
glibc ≥ 2.25 systems.

2 years agomath C++ tests: Fix compilation error with clang on FreeBSD 13.
Bruno Haible [Fri, 2 Sep 2022 22:56:19 +0000 (00:56 +0200)]
math C++ tests: Fix compilation error with clang on FreeBSD 13.

* lib/math.in.h (isnan): For clang >= 11 on FreeBSD, declare 'isnan',
not 'rpl_isnan'.

2 years agostrerror_r-posix: Fix for Hurd.
Bruno Haible [Fri, 2 Sep 2022 21:45:21 +0000 (23:45 +0200)]
strerror_r-posix: Fix for Hurd.

* lib/strerror_r.c (strerror_r): Interpret return value of
__xpg_strerror_r correctly. Remove assumption about how strerror_r
behaves.

2 years agoptsname tests, ptsname_r tests: Fix test failures on Hurd.
Bruno Haible [Fri, 2 Sep 2022 20:47:49 +0000 (22:47 +0200)]
ptsname tests, ptsname_r tests: Fix test failures on Hurd.

* tests/test-ptsname.c (main): On Hurd, test only the BSD ptys that
actually exist on Hurd.
* tests/test-ptsname_r.c (main): Likewise.

2 years agostrtol, strtoul: Fix compilation error in C++ mode on Solaris 11.
Bruno Haible [Fri, 2 Sep 2022 18:34:44 +0000 (20:34 +0200)]
strtol, strtoul: Fix compilation error in C++ mode on Solaris 11.

* lib/stdlib.in.h (strtol, strtoul): Enable the C++ alias warning only
on glibc systems.

2 years agoaligned_alloc: Fix compilation error in C++ mode on Solaris 11.
Bruno Haible [Fri, 2 Sep 2022 18:07:03 +0000 (20:07 +0200)]
aligned_alloc: Fix compilation error in C++ mode on Solaris 11.

* lib/stdlib.in.h (aligned_alloc): Enable the C++ alias warning only on
glibc systems.

2 years agogetdomainname: Fix compilation error in C++ mode on Solaris 11.
Bruno Haible [Fri, 2 Sep 2022 17:48:09 +0000 (19:48 +0200)]
getdomainname: Fix compilation error in C++ mode on Solaris 11.

* lib/unistd.in.h (getdomainname): Enable the C++ alias warning only on
glibc systems.

2 years agoautoupdate
Karl Berry [Fri, 2 Sep 2022 16:02:04 +0000 (09:02 -0700)]
autoupdate

2 years agoterminfo: Don't disturb the termcap module.
Bruno Haible [Fri, 2 Sep 2022 15:23:38 +0000 (17:23 +0200)]
terminfo: Don't disturb the termcap module.

* m4/terminfo.m4 (gl_TERMINFO_BODY): Save and restore the variables
determined by the gl_TERMCAP_BODY macro.

2 years agofnmatch: fix stdckdint typo
Paul Eggert [Tue, 30 Aug 2022 22:37:06 +0000 (17:37 -0500)]
fnmatch: fix stdckdint typo

* lib/fnmatch_loop.c (NEW_PATTERN): Fix typo in previous patch.
Problem and fix reported by Simon Josefsson in:
https://lists.gnu.org/r/bug-gnulib/2022-08/msg00104.html

2 years agoautoupdate
Karl Berry [Mon, 29 Aug 2022 16:20:25 +0000 (09:20 -0700)]
autoupdate

2 years agotempname: simplify by omitting _LIBC code
Paul Eggert [Thu, 25 Aug 2022 18:35:23 +0000 (13:35 -0500)]
tempname: simplify by omitting _LIBC code

* lib/tempname.c [_LIBC]: Simplify.
Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-08/msg00077.html
I plan to propose a corresponding patch to glibc.

2 years ago* m4/gnulib-common.m4: Fix comment.
Paul Eggert [Tue, 23 Aug 2022 16:41:27 +0000 (09:41 -0700)]
* m4/gnulib-common.m4: Fix comment.

2 years agotempname: don't lose entropy in seed
Paul Eggert [Mon, 22 Aug 2022 20:43:18 +0000 (15:43 -0500)]
tempname: don't lose entropy in seed

* lib/tempname.c (random_bits): Don't lose entropy in S
in the rare case where where the template has more than 10 Xs.
From a suggestion by Bruno Haible in:
https://bugs.gnu.org/57129#149

2 years agotempname: fix multithreading, ASLR leak etc.
Paul Eggert [Mon, 22 Aug 2022 19:07:27 +0000 (12:07 -0700)]
tempname: fix multithreading, ASLR leak etc.

Fix problems with tempname and multithreading, entropy loss,
and missing clock data (this last on non-GNU platforms).
See analysis by Bruno Haible in:
https://bugs.gnu.org/57129#149
While looking into this, I noticed that tempname can leak
info derived from ASLR into publicly-visible file names,
which is a no-no.  Fix that too.
* lib/tempname.c: Don't include stdalign.h.
(HAS_CLOCK_ENTROPY): Remove.
(mix_random_values): New function.
(random_bits): Use it.  Args are now new value address and
old value, and this function now returns a success indicator.
Omit old USE_GETRANDOM argument: always try getrandom now, as
there is no good reason not to now that GRND_NONBLOCK is used.
Caller changed.  Use CLOCK_REALTIME for for ersatz entropy,
as CLOCK_MONOTONIC doesn't work on some platforms.
Also, mix in ersatz entropy from tv_sec and from clock ().
(try_tempname_len): Do not mix in ASLR-based entropy, as
the result is published to the world and ASLR should be private.
Do not try to use a static var as that has issues if multithreaded.
Instead, simply generate new random bits.
Worry about bias only with high-quality random bits.
* modules/tempname (Depends-on): Do not depend on stdalign.

2 years agotempname: merge 64-bit time_t fix from glibc
Paul Eggert [Mon, 22 Aug 2022 19:22:52 +0000 (12:22 -0700)]
tempname: merge 64-bit time_t fix from glibc

This merges glibc commit 52a5fe70a2c77935afe807fb6e904e512ddd894e
"Use 64 bit time_t stat internally".
* lib/tempname.c (struct_stat64) [_LIBC]: Use struct __stat64_t64.
(__lstat64_time64) [!_LIBC]: Rename from __lstat64.
All uses changed.
(direxists): Use __stat64_time64 instead of __stat64.

2 years agoautoupdate
Karl Berry [Sun, 21 Aug 2022 19:51:21 +0000 (12:51 -0700)]
autoupdate

2 years agoautoupdate
Karl Berry [Fri, 19 Aug 2022 15:05:52 +0000 (08:05 -0700)]
autoupdate

2 years agotempname: Add more tests.
Bruno Haible [Tue, 16 Aug 2022 19:50:11 +0000 (21:50 +0200)]
tempname: Add more tests.

Based on scenario described by Eli Zaretskii in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-08/msg00043.html>.

* tests/test-tempname.c (main): Add another test.
* modules/tempname-tests (Status): Mark the test as unportable.

2 years agotempname: generate better names for MinGW Emacs
Paul Eggert [Tue, 16 Aug 2022 19:06:48 +0000 (12:06 -0700)]
tempname: generate better names for MinGW Emacs

On MinGW, GNU Emacs disables clock_gettime, which reliably breaks
some of gen_tempname’s optimistic callers.  Work around the
problem by making the generated names less predictable.  We don’t
need cryptographic randomness here, just enough unpredictability
to keep Emacs happy most of the time.
* lib/tempname.c (HAS_CLOCK_ENTROPY): New macro.
(random_bits): Use it.
(try_tempname_len): On systems lacking clock entropy, maintain
state so that gen_filename generates less-predictable names on
successive successful calls.

2 years agomaintainer-makefile: Check for incorrect DISTCHECK_CONFIGURE_FLAGS usage.
Simon Josefsson [Tue, 16 Aug 2022 15:26:56 +0000 (17:26 +0200)]
maintainer-makefile: Check for incorrect DISTCHECK_CONFIGURE_FLAGS usage.

* top/maint.mk (sc_makefile_DISTCHECK_CONFIGURE_FLAGS): Add.

2 years agotempname: Add tests.
Bruno Haible [Tue, 16 Aug 2022 13:27:50 +0000 (15:27 +0200)]
tempname: Add tests.

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

2 years agopmccabe2html: Doc fix.
Simon Josefsson [Mon, 15 Aug 2022 22:28:22 +0000 (00:28 +0200)]
pmccabe2html: Doc fix.

* build-aux/pmccabe2html: Don't use reserved _SOURCES namespace.
Use AM_V_GEN.  Use LC_ALL=C.

2 years agostdbool: Drop old BeOS support that gets in the way of ISO C 23 support.
Bruno Haible [Mon, 15 Aug 2022 21:38:12 +0000 (23:38 +0200)]
stdbool: Drop old BeOS support that gets in the way of ISO C 23 support.

* lib/stdbool.in.h: Don't include <OS.h>.

2 years agotempname: Fix a comment.
Bruno Haible [Mon, 15 Aug 2022 21:21:05 +0000 (23:21 +0200)]
tempname: Fix a comment.

* lib/tempname.c (try_tempname_len): Use of entropy makes the function
more, not less, secure.

2 years agotempname: remove incorrect comment
Paul Eggert [Mon, 15 Aug 2022 20:04:08 +0000 (13:04 -0700)]
tempname: remove incorrect comment

* lib/tempname.c, lib/tempname.h: Remove incorrect comment,
as the names are not necessarily hard to predict (Bug#57129).

2 years agobootstrap.conf: Use proper shell marker for Emacs.
Simon Josefsson [Sun, 14 Aug 2022 20:38:01 +0000 (22:38 +0200)]
bootstrap.conf: Use proper shell marker for Emacs.

* build-aux/bootstrap.conf: Add it.

2 years agostdbool: port to C23
Paul Eggert [Sun, 14 Aug 2022 03:00:02 +0000 (20:00 -0700)]
stdbool: port to C23

* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Copy from bleeding-edge
Autoconf.  Don’t define if Autoconf 2.72 or later.
* tests/test-stdbool.c (bool, false, true)
(__bool_true_false_are_defined): Do not require these to be
defined.  C23 still requires __bool_true_false_are_defined but
marks it as obsolescent, and it’s no longer worth testing.
(WORKING_BOOL): New macro, which also tests __STDC_VERSION__.
Use it in tests for working bool.
Test for bool instead of for _Bool, which C23 says is obsolescent.

2 years agognulib-tool.py: Fix some code generation details.
Bruno Haible [Sat, 13 Aug 2022 13:02:55 +0000 (15:02 +0200)]
gnulib-tool.py: Fix some code generation details.

* pygnulib/GLEmiter.py: Don't produce Windows CR-LFs on Windows.
(GLEmiter.po_Makevars): Emit a definition of top_builddir, not
top_subdir.
(GLEmiter.po_POTFILES_in): Fix result when sourcebase is 'tests' or
something like that.
(GLEmiter.initmacro_start): Add two more newlines (mistake from
2021-04-11).

2 years agognulib-tool.py: Reduce code duplication.
Bruno Haible [Sat, 13 Aug 2022 11:18:06 +0000 (13:18 +0200)]
gnulib-tool.py: Reduce code duplication.

* pygnulib/constants.py (relinverse): New function.
* pygnulib/GLEmiter.py (GLEmiter.po_Makevars,
GLEmiter.tests_Makefile_am): Use it.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.

2 years agohamt: fix technically undefined behavior
Marc Nieper-Wißkirchen [Fri, 12 Aug 2022 14:00:23 +0000 (16:00 +0200)]
hamt: fix technically undefined behavior

Bug reported by Bruno Haible in
<https://lists.gnu.org/r/bug-gnulib/2022-04/msg00023.html>.
* lib/hamt.c (entry_insert): Remove technically undefined
behavior when shifting an integer of N bits by N or more bits.

2 years agostdckdint: fix dependency
Paul Eggert [Wed, 10 Aug 2022 14:58:18 +0000 (07:58 -0700)]
stdckdint: fix dependency

* modules/stdckdint (Depends-on): Add stdbool.
Reported by Bruno Haible.

2 years agomaint: parenthesize macro definiens
Paul Eggert [Wed, 10 Aug 2022 07:17:58 +0000 (00:17 -0700)]
maint: parenthesize macro definiens

* lib/intprops.h (INT_ADD_OK, INT_SUBTRACT_OK, INT_MULTIPLY_OK):
* lib/pipe-filter-ii.c (GetLastError):
* lib/thread-optim.h (gl_multithreaded): Parenthesize
function-like macro definiens beginning with a unary operator;
needed for weird invocations like ‘m (...)[p]’.

2 years agostdckdint: prefer to intprops when easy
Paul Eggert [Wed, 10 Aug 2022 06:20:49 +0000 (23:20 -0700)]
stdckdint: prefer to intprops when easy

stdckdint.h is part of draft C23 and therefore is more likely
to be familiar to programmers in the future, so prefer it to
intprops.h in files that don’t need non-_WRAPV intprops.h macros.
* lib/alignalloc.c, lib/backupfile.c, lib/fnmatch.c, lib/fnmatch_loop.c:
* lib/group-member.c, lib/malloca.c, lib/posixtm.c, lib/reallocarray.c:
* lib/xmalloc.c:
For files that can use stdckdint.h just as easily as intprops.h,
include the former instead of the latter, and use the former’s
ckd_* macros instead of the latter’s *_WRAPV macros.
* modules/alignalloc, modules/backup-rename, modules/backupfile:
* modules/fnmatch, modules/group-member, modules/malloca:
* modules/posixtm, modules/reallocarray:
* modules/relocatable-prog-wrapper, modules/xalloc:
Depend on stdckdint instead of intprops.

2 years agostdckdint-h: new module
Paul Eggert [Wed, 10 Aug 2022 06:20:49 +0000 (23:20 -0700)]
stdckdint-h: new module

This supports draft C23 <stdckdint.h>.
* doc/posix-headers/stdckdint.texi:
* lib/stdckdint.in.h, modules/stdckdint:
* modules/stdckdint-tests, tests/test-stdckdint.c:
New files.
* MODULES.html.sh, doc/gnulib.texi: Update for new module.
* lib/intprops-internal.h: Include <stdckdint.h> if C23 and
its macros would help and our substitute has not already
started to be included.
(_GL_INT_ADD_WRAPV, _GL_INT_SUBTRACT_WRAPV)
(_GL_INT_MULTIPLY_WRAPV): Use ckd_add, ckd_sub, ckd_mul
if they are defined and would help.
* lib/intprops-internal.h, lib/intprops.h: Improve comments.
The C23 restrictions on stdckdint macros already mostly applied to
intprops.h, so these are clarifications, not further restrictions.
* tests/test-intprops.c: If TEST_STDCKDINT is defined,
include <stdckdint.h> instead of "intprops.h", and test
it instead.
(VERIFY) [TEST_STDCKDINT]: Ignore the arg in this case.
(main) [TEST_STDCKDINT]: Skip tests irrelevant to stdckdint.h.

2 years agointprops: refactor intprops.h into two
Paul Eggert [Wed, 10 Aug 2022 06:20:49 +0000 (23:20 -0700)]
intprops: refactor intprops.h into two

* lib/intprops.h: Include new file intprops-internal.h.
(_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT, _GL_INT_MINIMUM)
(_GL_INT_MAXIMUM, _GL_SIGNED_INT_MAXIMUM, LLONG_MAX, LLONG_MIN)
(_GL_HAVE___TYPEOF__, _GL_SIGNED_TYPE_OR_EXPR)
(_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW)
(_GL_HAS_BUILTIN_OVERFLOW_P, _GL__GENERIC_BOGUS)
(_GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH, _GL_INT_OP_CALC)
(_GL_INT_OP_WRAPV_VIA_UNSIGNED, _GL_INT_ADD_RANGE_OVERFLOW)
(_GL_INT_SUBTRACT_RANGE_OVERFLOW)
(_GL_INT_MULTIPLY_RANGE_OVERFLOW):
Move to intprops-internal.h.
(TYPE_SIGNED, EXPR_SIGNED, TYPE_WIDTH, INT_NEGATE_RANGE_OVERFLOW)
(INT_NEGATE_OVERFLOW, INT_ADD_WRAPV, INT_SUBTRACT_WRAPV)
(INT_MULTIPLY_WRAPV): Rename to _GL_ prefix, move to
intprops-internal.h, and define here in terms of the _GL_ name.
* lib/intprops-internal.h: New file, containing the above.
* modules/intprops (Files): Add lib/intprops-internal.h.

2 years agointprops: refactor _GL_HAS_BUILTIN_OVERFLOW_P
Paul Eggert [Wed, 10 Aug 2022 06:20:49 +0000 (23:20 -0700)]
intprops: refactor _GL_HAS_BUILTIN_OVERFLOW_P

* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P)
[_GL_HAS_BUILTIN_OVERFLOW_P]: Use __builtin_sub_overflow_p
directly rather than indirectly via INT_SUBTRACT_OVERFLOW.
This simplifies future changes, and doesn’t change the generated code.

2 years agoverify: port ‘assume’ to C23 non-GCC
Paul Eggert [Wed, 10 Aug 2022 06:20:48 +0000 (23:20 -0700)]
verify: port ‘assume’ to C23 non-GCC

* lib/verify.h (assume): Use C23's unreachable if available
and if GCC and/or MSC primitives are not available.

2 years agognulib-tool.py: Finish implementing option --conditional-dependencies.
Bruno Haible [Tue, 9 Aug 2022 22:51:59 +0000 (00:51 +0200)]
gnulib-tool.py: Finish implementing option --conditional-dependencies.

* gnulib-tool.py (main) Accept options --conditional-dependencies,
--no-conditional-dependencies.
* pygnulib/GLModuleSystem.py (GLModuleTable.addConditional): Use
str(module), not module, as key. Fix logic bug.
(GLModuleTable.getCondition): Simplify.
(GLModuleTable.transitive_closure): Show a warning when there are
duplicate dependencies. Fix logic bug.
(GLModuleTable.transitive_closure_separately): Simplify.
(GLModuleTable.add_dummy): Ignore tests modules. Cope with multiple
lib_SOURCES augmentation lines. Cope with comments at the end of a
lib_SOURCES augmentation line. Add the dummy module at the end of the
modules list.
* pygnulib/GLTestDir.py (GLTestDir.execute): Remove the code that forces
the dummy module to the end of the list.
* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Add code to
terminate the shell functions. Add code for the dependencies from the
unconditional to the conditional modules. Don't emit AM_CONDITIONAL for
unconditional modules.

2 years agognulib-tool.py: Don't do license replacements in the autoconf snippets.
Bruno Haible [Tue, 9 Aug 2022 21:59:40 +0000 (23:59 +0200)]
gnulib-tool.py: Don't do license replacements in the autoconf snippets.

* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Remove fileassistant
argument. Don't invoke the 'aux' transformer here. Don't produce Windows
CR-LFs on Windows.
(GLEmiter.autoconfSnippets): Remove fileassistant argument.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Update all callers.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.

2 years agognulib-tool.py: Fix some code generation details.
Bruno Haible [Tue, 9 Aug 2022 14:11:09 +0000 (16:11 +0200)]
gnulib-tool.py: Fix some code generation details.

* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): When removing a
lib_LDFLAGS line, remove also the newline. Fix regex that matches
lib_SOMETHING. Add a newline after each '## begin gnulib module' line.
Don't emit 'endif' lines without corresponding 'if'. When emitting a
'+=' augmentation, make sure it does not get emitted a second time.
Don't emit a blank line when there is no AM_CPPFLAGS augmentation.
Update after getLink() changed. In the value of DEFAULT_TEXT_DOMAIN,
backslash-escape the double-quotes. Don't produce Windows CR-LFs on
Windows. Simplify.
(GLEmiter.tests_Makefile_am): When removing a lib_LDFLAGS line, remove
also the newline. Fix regex that matches lib_SOMETHING. Don't remove a
blank line before EXTRA_DIST. Add a newline after each
'## begin gnulib module' line. Set uses_subdirs also when there is a .c
file in a subdir of tests/. When emitting a '+=' augmentation, make sure
it does not get emitted a second time. Don't produce Windows CR-LFs on
Windows. Simplify.
* pygnulib/GLImport.py (GLImport.execute): Update after getLink()
changed.

2 years agognulib-tool.py: Fixes for conditional dependencies.
Bruno Haible [Mon, 8 Aug 2022 19:22:15 +0000 (21:22 +0200)]
gnulib-tool.py: Fixes for conditional dependencies.

* pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): New constant.
(GLModule.getShellFunc): Don't use md5 just because of an '_' character.
(GLModule.getShellVar): Likewise.
(GLModule.getConditionalName): Include a newline in the md5 input.
* pygnulib/constants.py (ALPHANUMERIC): Remove constant.

2 years agognulib-tool.py: Refactor.
Bruno Haible [Mon, 8 Aug 2022 16:42:45 +0000 (18:42 +0200)]
gnulib-tool.py: Refactor.

* pygnulib/GLModuleSystem.py (GLModule.getLicense): Separate the warning
logic from the result logic.

2 years agolargefile, year2038: simplify if Autoconf 2.72
Paul Eggert [Tue, 9 Aug 2022 18:12:05 +0000 (11:12 -0700)]
largefile, year2038: simplify if Autoconf 2.72

* m4/largefile.m4 (gl_SET_LARGEFILE_SOURCE)
(_AC_SYS_LARGEFILE_MACRO_VALUE):
* m4/year2038.m4 (gl_YEAR2038_EARLY, gl_YEAR2038, gl_YEAR2038_BODY):
Adjust to Autoconf 2.72, which should contain the Gnulib
patches in this area and so should not need to be overridden.

2 years agognulib-tool.py: Finish implementing option --extract-test-module.
Bruno Haible [Sun, 7 Aug 2022 22:46:13 +0000 (00:46 +0200)]
gnulib-tool.py: Finish implementing option --extract-test-module.

* gnulib-tool.py (main): Accept option --extract-tests-module.

2 years agognulib-tool.py: Fix handling of nonexistent module names in --extract-*.
Bruno Haible [Sun, 7 Aug 2022 22:43:25 +0000 (00:43 +0200)]
gnulib-tool.py: Fix handling of nonexistent module names in --extract-*.

* gnulib-tool.py (main): To test whether a module exists, just call
GLModuleSystem.find and test its return value.

2 years agognulib-tool.py: Fix --extract-dependencies result.
Bruno Haible [Sun, 7 Aug 2022 22:02:59 +0000 (00:02 +0200)]
gnulib-tool.py: Fix --extract-dependencies result.

* pygnulib/GLModuleSystem.py (GLModule.getDependencies): Return a
snippet, not a list. Implement dependency of ${module}-tests on
${module}.
(GLModule.getDependenciesWithoutConditions,
GLModule.getDependenciesWithConditions): New methods.
(GLModuleTable.transitive_closure): Call getDependenciesWithConditions.
* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Call
getDependenciesWithoutConditions.
* gnulib-tool.py (main) [--extract-dependencies]: Update.

2 years agognulib-tool.py: Rename a method.
Bruno Haible [Sun, 7 Aug 2022 20:59:08 +0000 (22:59 +0200)]
gnulib-tool.py: Rename a method.

* pygnulib/GLModuleSystem.py (GLModule.getAutoconfEarlySnippet): Renamed
from GLModule.getAutoconfSnippet_Early.
* pygnulib/GLImport.py: Update.
* pygnulib/GLTestDir.py: Likewise.

2 years agognulib-tool.py: Fix section extraction from module descriptions.
Bruno Haible [Sun, 7 Aug 2022 20:53:32 +0000 (22:53 +0200)]
gnulib-tool.py: Fix section extraction from module descriptions.

The code with   self.content.split(section)[-1]
was broken because it recognizes an indented section label.
Similar code with   ('\n' + self.content).split('\n' + section)[-1]
would still be broken because it recognizes an indented section label
in the first line of the file.
The code with   section_label_regex
was broken because sometimes it returns the second-to-last section with
the given label, not the last one.
Also, whitespace after the colon was not ignored.

* pygnulib/GLModuleSystem.py (GLModule.__init__): Dissect the module
description's contents immediately, once only, in a reliable way.
(GLModule.getDescription, GLModule.getComment): Simplify.
(GLModule.getStatus): Simplify. Return a string.
(GLModule.getStatuses): New function. Return a list.
(GLModule.getNotice, GLModule.getApplicability, GLModule.getFiles,
GLModule.getDependencies, GLModules.getAutoconfSnippet_Early,
GLModules.getAutoconfSnippet, GLModule.getAutomakeSnippet_Conditional,
GLModule.getInclude, GLModule.getLink, GLModule.getLicense_Raw):
Simplify.
(GLModule.getLicense): Remove whitespace after calling getLicense_Raw.
(GLModule.getMaintainer): Simplify.
(GLModuleTable.transitive_closure): Call getStatuses() instead of
getStatus().
* pygnulib/GLEmiter.py: Likewise.
* gnulib-tool.py (main): For --extract-description, --extract-comment,
--extract-status, --extract-notice, --extract-autoconf-snippet,
--extract-automake-snippet, --extract-include-directive,
--extract-link-directive, --extract-maintainer, don't add an extra
newline after the snippet.

2 years agognulib-tool.py: Improve field naming.
Bruno Haible [Sun, 7 Aug 2022 18:04:56 +0000 (20:04 +0200)]
gnulib-tool.py: Improve field naming.

* pygnulib/GLModuleSystem.py (GLModule): Rename field 'module' to
'path'. Fix a typo in a TypeError message.

2 years agognulib-tool.py: Simplify.
Bruno Haible [Sun, 7 Aug 2022 17:26:51 +0000 (19:26 +0200)]
gnulib-tool.py: Simplify.

* pygnulib/GLModuleSystem.py (GLModule): Convert Windows newlines right
after reading the module description, not in every accessor.

2 years agognulib-tool.py: Reduce code duplication.
Bruno Haible [Sun, 7 Aug 2022 15:29:16 +0000 (17:29 +0200)]
gnulib-tool.py: Reduce code duplication.

* pygnulib/GLModuleSystem.py (GLModule): Declare two regexes are class
variables.

2 years agognulib-tool.py: Implement option --find.
Bruno Haible [Sun, 7 Aug 2022 15:02:21 +0000 (17:02 +0200)]
gnulib-tool.py: Implement option --find.

* pygnulib/GLModuleSystem.py (GLModuleSystem.file_is_module): New
method.
(GLModuleSystem.list): Filter the listing in memory; don't use a 'sed'
subprocess.
* gnulib-tool.py (main): Handle mode 'find'.

2 years agognulib-tool: Fix option --find in combination with option --local-dir.
Bruno Haible [Sun, 7 Aug 2022 12:09:03 +0000 (14:09 +0200)]
gnulib-tool: Fix option --find in combination with option --local-dir.

* gnulib-tool (func_prefixed_modules_in_dir): New function.
(find): Use it, and filter the directory names away after the 'grep'
pass.

2 years agognulib-tool.py: Fix some regexes.
Bruno Haible [Sun, 7 Aug 2022 11:49:49 +0000 (13:49 +0200)]
gnulib-tool.py: Fix some regexes.

* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use an equivalent
regex as gnulib-tool.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.