]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agolargefile: sync from Autoconf master stable-202201
Paul Eggert [Sun, 25 Dec 2022 19:41:57 +0000 (11:41 -0800)]
largefile: sync from Autoconf master

* m4/largefile.m4 (gl_SET_LARGEFILE_SOURCE): Test whether
AC_SYS_YEAR2038 is defined when this macro is defined, not when it
is used, as we now define AC_SYS_YEAR2038 later.
(_AC_SYS_LARGEFILE_MACRO_VALUE): Remove.
(_AC_SYS_YEAR2038_TEST_CODE, _AC_SYS_YEAR2038_OPTIONS)
(_AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE)
(_AC_SYS_YEAR2038_OPT_IN, AC_SYS_YEAR2038)
(_AC_SYS_LARGEFILE_TEST_CODE, _AC_SYS_LARGEFILE_OPTIONS)
(_AC_SYS_LARGEFILE_PROBE, _AC_SYS_LARGEFILE_ENABLE): New macros.
(AC_SYS_LARGEFILE): Use them.
* m4/year2038.m4: Remove.  All mentions removed.
* modules/largefile, modules/year2038 (configure.ac-early):
Do not require gl_YEAR2038_EARLY.
* modules/year2038 (Depends-on): Depend on largefile.
(configure.ac): Require AC_SYS_YEAR2038, not gl_YEAR2038.

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 agoassert-h: port static_assert to strict C99
Paul Eggert [Wed, 28 Dec 2022 22:15:43 +0000 (14:15 -0800)]
assert-h: port static_assert to strict C99

* lib/verify.h (_GL_VERIFY): Port MSVC hack back to C99.
Problem found when testing bleeding-edge gzip on IBM XL C for AIX,
V12.1 (5765-J02, 5725-C72), which complained ‘"malloca.c", line
42.56: 1506-041 (E) The invocation of macro _Static_assert
contains fewer arguments than are required by the macro
definition.’  This diagnostic is valid because C99 requires
that if you #define _Static_assert(R, ...) you must call
_Static_assert with at least two arguments.  I found a similar
problem with Sun C 5.9 SunOS_sparc Patch 124867-12 2009/11/22.

2 years agoFix compilation errors in C++ mode on Solaris 11 OpenIndiana.
Bruno Haible [Tue, 27 Dec 2022 10:21:45 +0000 (11:21 +0100)]
Fix compilation errors in C++ mode on Solaris 11 OpenIndiana.

* m4/gnulib-common.m4 (gl_COMMON_BODY): In _GL_ATTRIBUTE_DEALLOC_FREE,
with GNU C++, cast the 'free' function.
* lib/string.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): With GNU C++, cast the
'free' function.
* lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): Likewise.

2 years agostdbool-c99: fix typo
Paul Eggert [Mon, 26 Dec 2022 18:17:17 +0000 (10:17 -0800)]
stdbool-c99: fix typo

Reported against Autoconf by Todd C. Miller in:
https://lists.gnu.org/r/autoconf/2022-12/msg00001.html
* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Sync from Autoconf master.

2 years agoposix_spawnp-tests: fix filename typo
Paul Eggert [Fri, 23 Dec 2022 05:19:34 +0000 (21:19 -0800)]
posix_spawnp-tests: fix filename typo

Problem reported for GNU m4 by Mitchell Dorrell in:
https://lists.gnu.org/r/bug-m4/2022-12/msg00000.html
* tests/test-posix_spawnp-script.c (DATA_FILENAME):
Fix typo in file name that caused race with
test-posix_spawn-script.c.

2 years agoexplicit_bzero: add poison
Paul Eggert [Mon, 28 Nov 2022 01:15:24 +0000 (17:15 -0800)]
explicit_bzero: add poison

* m4/string_h.m4 (gl_STRING_H): Poison explicit_bzero.
This was inadvertently omitted when explicit_bzero was added.

2 years agoexplicit_bzero: work with gcc -std=c99
Paul Eggert [Sun, 27 Nov 2022 17:59:32 +0000 (09:59 -0800)]
explicit_bzero: work with gcc -std=c99

* lib/explicit_bzero.c (explicit_bzero) [__GNUC__ && !__clang__]:
Use __asm__ instead of asm.

2 years agoposix_spawn tests: Fix compilation error (regression 2022-09-14).
Bruno Haible [Sun, 20 Nov 2022 10:09:19 +0000 (11:09 +0100)]
posix_spawn tests: Fix compilation error (regression 2022-09-14).

* modules/posix_spawn-tests (Makefile.am): Augment DEFS, to define
EXEEXT.

2 years agovc-list-files-tests: Avoid OpenPGP private key operations.
Simon Josefsson [Sun, 13 Nov 2022 10:50:51 +0000 (11:50 +0100)]
vc-list-files-tests: Avoid OpenPGP private key operations.

* tests/test-vc-list-files-git.sh (GIT_CONFIG_GLOBAL): Set it to /dev/null.

2 years agomaintainer-makefile: Fix last sc_indent commit.
Simon Josefsson [Tue, 1 Nov 2022 08:09:02 +0000 (09:09 +0100)]
maintainer-makefile: Fix last sc_indent commit.

* top/maint.mk (sc_indent): Don't use grep -q.
Suggested by Bruno Haible.

2 years agomaintainer-makefile: Fix Apple Xcode 'make syntax-check'.
Simon Josefsson [Mon, 31 Oct 2022 08:42:42 +0000 (09:42 +0100)]
maintainer-makefile: Fix Apple Xcode 'make syntax-check'.

* top/maint.mk (sc_indent): Don't use non-GNU indent.

2 years agogetdelim: Work around buggy implementation on macOS 10.13.
Bruno Haible [Mon, 17 Oct 2022 00:44:54 +0000 (02:44 +0200)]
getdelim: Work around buggy implementation on macOS 10.13.

* doc/posix-functions/getdelim.texi: Mention the macOS bug.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Let the "checking for working
getdelim function" test answer 'no' on macOS.

2 years agoautoupdate
Karl Berry [Sat, 8 Oct 2022 15:10:14 +0000 (08:10 -0700)]
autoupdate

2 years agolargefile: fix detection of time_t size on mingw32
Daiki Ueno [Mon, 26 Sep 2022 04:48:42 +0000 (13:48 +0900)]
largefile: fix detection of time_t size on mingw32

* modules/largefile (configure.ac-early): Ensure gl_YEAR2038_EARLY
is invoked before gl_YEAR2038_BODY.

2 years agofts: fix errno handling if dirfd fails
Paul Eggert [Mon, 26 Sep 2022 01:33:49 +0000 (18:33 -0700)]
fts: fix errno handling if dirfd fails

* lib/fts.c (fts_build): Use proper errno if dirfd failed.
Although I don’t know of any platform where dirfd can fail here,
we might as well get it right.

2 years agostdalign: Fix compilation error with MSVC in C++ mode.
Bruno Haible [Sun, 1 Jan 2023 09:01:19 +0000 (10:01 +0100)]
stdalign: Fix compilation error with MSVC in C++ mode.

* lib/stdalign.in.h: Treat MSVC in C++ mode like C++11 compliant
compilers.

2 years agoautoupdate
Karl Berry [Sun, 11 Sep 2022 14:56:05 +0000 (07:56 -0700)]
autoupdate

2 years agosnippet/warn-on-use: Don't cause wrong AC_CHECK_DECL results with clang.
Bruno Haible [Tue, 20 Sep 2022 21:31:19 +0000 (23:31 +0200)]
snippet/warn-on-use: Don't cause wrong AC_CHECK_DECL results with clang.

* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Use the clang command-line
option that disables implicit built-in function declarations in clang.

2 years agostdbool tests: Fix compilation error with clang/MSVC.
Bruno Haible [Tue, 20 Sep 2022 21:57:06 +0000 (23:57 +0200)]
stdbool tests: Fix compilation error with clang/MSVC.

* tests/test-stdbool.c (WORKING_BOOL): Define to 0 on compilers that
define _MSC_VER.

2 years agostdbool: Ensure that 'true' can be used in the preprocessor.
Bruno Haible [Sun, 18 Sep 2022 16:45:39 +0000 (18:45 +0200)]
stdbool: Ensure that 'true' can be used in the preprocessor.

* lib/stdbool.in.h (true): Redefine if it does not evaluate to 1 in the
preprocessor.

2 years agosignal: Fix a C++ compilation error due to sched_yield on OpenBSD 6.0.
Bruno Haible [Sun, 18 Sep 2022 12:41:20 +0000 (14:41 +0200)]
signal: Fix a C++ compilation error due to sched_yield on OpenBSD 6.0.

* lib/signal.in.h: On OpenBSD, include <sys/param.h>. Don't include
<pthread.h> on OpenBSD ≥ 5.1.

2 years agowchar: Fix compilation errors in C++ mode on Solaris 11.3.
Bruno Haible [Sun, 18 Sep 2022 01:05:21 +0000 (03:05 +0200)]
wchar: Fix compilation errors in C++ mode on Solaris 11.3.

* lib/wchar.in.h (wcsnlen, wcpcpy, wcpncpy, wcscasecmp, wcsncasecmp,
wcsdup): Force declaration in C++ mode on Solaris (which does not
declare these functions in the global namespace).

2 years agoswab: Fix compilation error with Sun C++ on Solaris 11.3.
Bruno Haible [Sun, 18 Sep 2022 00:32:13 +0000 (02:32 +0200)]
swab: Fix compilation error with Sun C++ on Solaris 11.3.

* lib/unistd.in.h (swab): For the C++ declaration, under Solaris 11 but
not under Solaris 10, test also __XOPEN_OR_POSIX.

2 years agotime C++ tests: Fix link error on CentOS 5.
Bruno Haible [Sat, 17 Sep 2022 19:31:53 +0000 (21:31 +0200)]
time C++ tests: Fix link error on CentOS 5.

* modules/time-c++-tests (Makefile.am): Link test-time-c++ against
$(LIB_CLOCK_GETTIME).

2 years agotime: Fix compilation errors with clang/MSVC.
Bruno Haible [Wed, 14 Sep 2022 22:50:41 +0000 (00:50 +0200)]
time: Fix compilation errors with clang/MSVC.

* m4/time_h.m4 (gl_TIME_H): Test whether asctime_r and ctime_r are
declared.
* lib/time.in.h (asctime_r, ctime_r): Skip _GL_WARN_ON_USE invocations
when these functions are not declared.

2 years agoverify: Avoid syntax error due to static_assert with clang in C++ mode.
Bruno Haible [Sun, 18 Sep 2022 19:19:56 +0000 (21:19 +0200)]
verify: Avoid syntax error due to static_assert with clang in C++ mode.

* lib/verify.h (static_assert): Don't define in clang C++ 6 or newer.

2 years agoverify: Avoid syntax error due to static_assert with MSVC 14 in C++.
Bruno Haible [Sun, 18 Sep 2022 19:17:11 +0000 (21:17 +0200)]
verify: Avoid syntax error due to static_assert with MSVC 14 in C++.

* lib/verify.h (static_assert): For MSVC in C++ mode, use a definition
that supports both the two-arguments and the one-argument syntax.

2 years agoposix_spawn-* tests: Fix test failure on mingw when libtool is in use.
Bruno Haible [Wed, 14 Sep 2022 13:12:18 +0000 (15:12 +0200)]
posix_spawn-* tests: Fix test failure on mingw when libtool is in use.

* tests/test-posix_spawn-inherit0.c (CHILD_PROGRAM_FILENAME): Add the
EXEEXT suffix.
* tests/test-posix_spawn-inherit1.c (CHILD_PROGRAM_FILENAME): Likewise.
* tests/test-posix_spawn-open1.c (CHILD_PROGRAM_FILENAME): Likewise.
* tests/test-posix_spawn-open2.c (CHILD_PROGRAM_FILENAME): Likewise.

2 years agoverify: Avoid syntax error due to static_assert with MSVC 14.
Bruno Haible [Sun, 18 Sep 2022 19:14:35 +0000 (21:14 +0200)]
verify: Avoid syntax error due to static_assert with MSVC 14.

* lib/verify.h (_Static_assert): Pass only the first argument to
_GL_VERIFY.

2 years agoverify: Avoid syntax error due to static_assert with GNU C++ 6.x.
Bruno Haible [Sun, 18 Sep 2022 19:12:52 +0000 (21:12 +0200)]
verify: Avoid syntax error due to static_assert with GNU C++ 6.x.

* lib/verify.h (static_assert): Don't define in GNU C++ 6 or newer.

2 years agosupersede: Avoid a failure when writing to /dev/null in Solaris zones.
Bruno Haible [Mon, 12 Sep 2022 08:49:25 +0000 (10:49 +0200)]
supersede: Avoid a failure when writing to /dev/null in Solaris zones.

* lib/supersede.c (open_supersede): Treat EACCES (seen on Solaris 11.3)
like EINVAL (seen on Illumos).

2 years agoRevert two "Sync with GNU gettext" commits.
Bruno Haible [Sun, 11 Sep 2022 13:22:21 +0000 (15:22 +0200)]
Revert two "Sync with GNU gettext" commits.

2 years agopipe-filter-gi: Fix test failure on native Windows.
Bruno Haible [Sun, 11 Sep 2022 00:53:07 +0000 (02:53 +0200)]
pipe-filter-gi: Fix test failure on native Windows.

* lib/pipe-filter-aux.h (write): Redefine on native Windows.

2 years agostdbool C++ tests: Fix for C++20.
Bruno Haible [Sat, 10 Sep 2022 17:18:05 +0000 (19:18 +0200)]
stdbool C++ tests: Fix for C++20.

* tests/test-stdbool-c++2.cc: Don't include <cstdbool> in C++20 or
newer.

2 years agouchar: Work around error in C++ mode on AIX 7.2 with xlclang.
Bruno Haible [Sat, 10 Sep 2022 16:56:14 +0000 (18:56 +0200)]
uchar: Work around error in C++ mode on AIX 7.2 with xlclang.

* lib/uchar.in.h (char16_t, char32_t): On AIX with xlclang++, define
these as macros.
* doc/posix-headers/uchar.texi: Document the AIX + xlclang++ bug.

2 years agostring: Fix compilation error in C++ mode on AIX 7.2 with xlclang.
Bruno Haible [Sat, 10 Sep 2022 16:20:58 +0000 (18:20 +0200)]
string: Fix compilation error in C++ mode on AIX 7.2 with xlclang.

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

2 years agomath: Fix compilation error in C++ mode on AIX 7.2 with xlclang.
Bruno Haible [Sat, 10 Sep 2022 16:03:02 +0000 (18:03 +0200)]
math: Fix compilation error in C++ mode on AIX 7.2 with xlclang.

* lib/math.in.h (cbrtl, copysignl, exp2l, expm1l, fmal, ilogbl, log1pl,
log2l, logbl, remainderl, rintl, roundl, truncl): Enable the C++ alias
warning only on glibc systems.

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 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 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 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 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 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 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 agoFix mistake in backporting "chmod: New module.".
Bruno Haible [Thu, 1 Sep 2022 01:46:05 +0000 (03:46 +0200)]
Fix mistake in backporting "chmod: New module.".

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 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 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 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 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 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 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 agogendocs.sh: Fix error when invoking 'perl' (regression 2022-07-23).
Bruno Haible [Sun, 31 Jul 2022 05:16:34 +0000 (07:16 +0200)]
gendocs.sh: Fix error when invoking 'perl' (regression 2022-07-23).

* build-aux/gendocs.sh (PERL): Use double-quotes, not single-quotes.

2 years agoautoupdate
Karl Berry [Tue, 26 Jul 2022 14:55:39 +0000 (07:55 -0700)]
autoupdate

2 years agoAvoid DoS vulnerability through unsafe default assignment.
Bruno Haible [Sat, 23 Jul 2022 10:01:35 +0000 (12:01 +0200)]
Avoid DoS vulnerability through unsafe default assignment.

See https://www.shellcheck.net/wiki/SC2223 .

* MODULES.html.sh (func_tmpdir): Surround default assignment with
double-quotes.
* build-aux/bootstrap: Likewise.
* build-aux/csharpcomp.sh.in (func_tmpdir): Likewise.
* build-aux/gendocs.sh: Likewise.
* build-aux/libtool-next-version (func_tmpdir): Likewise.
* config/srclist-update: Likewise.
* gnulib-tool (func_tmpdir): Likewise.
* posix-modules (func_tmpdir): Likewise.
* tests/test-atexit.sh: Likewise.
* tests/test-btoc32-1.sh: Likewise.
* tests/test-btoc32-2.sh: Likewise.
* tests/test-btowc1.sh: Likewise.
* tests/test-btowc2.sh: Likewise.
* tests/test-c-dtoastr.sh: Likewise.
* tests/test-c-ldtoastr.sh: Likewise.
* tests/test-c-snprintf.sh: Likewise.
* tests/test-c-strcase.sh: Likewise.
* tests/test-c-vasprintf.sh: Likewise.
* tests/test-c-vsnprintf.sh: Likewise.
* tests/test-c-xvasprintf.sh: Likewise.
* tests/test-c32isalnum.sh: Likewise.
* tests/test-c32isalpha.sh: Likewise.
* tests/test-c32isblank.sh: Likewise.
* tests/test-c32iscntrl.sh: Likewise.
* tests/test-c32isdigit.sh: Likewise.
* tests/test-c32isgraph.sh: Likewise.
* tests/test-c32islower.sh: Likewise.
* tests/test-c32isprint.sh: Likewise.
* tests/test-c32ispunct.sh: Likewise.
* tests/test-c32isspace.sh: Likewise.
* tests/test-c32isupper.sh: Likewise.
* tests/test-c32isxdigit.sh: Likewise.
* tests/test-c32rtomb.sh: Likewise.
* tests/test-c32snrtombs-1.sh: Likewise.
* tests/test-c32snrtombs-2.sh: Likewise.
* tests/test-c32snrtombs-3.sh: Likewise.
* tests/test-c32snrtombs-4.sh: Likewise.
* tests/test-c32srtombs-1.sh: Likewise.
* tests/test-c32srtombs-2.sh: Likewise.
* tests/test-c32srtombs-3.sh: Likewise.
* tests/test-c32srtombs-4.sh: Likewise.
* tests/test-c32stombs-1.sh: Likewise.
* tests/test-c32stombs-2.sh: Likewise.
* tests/test-c32stombs-3.sh: Likewise.
* tests/test-c32stombs-4.sh: Likewise.
* tests/test-closein.sh: Likewise.
* tests/test-copy-acl.sh (func_tmpdir): Likewise.
* tests/test-copy-file.sh (func_tmpdir): Likewise.
* tests/test-dprintf-posix.sh: Likewise.
* tests/test-execl.sh: Likewise.
* tests/test-execle.sh: Likewise.
* tests/test-execlp.sh: Likewise.
* tests/test-execv.sh: Likewise.
* tests/test-execve.sh: Likewise.
* tests/test-execvp.sh: Likewise.
* tests/test-execvpe.sh: Likewise.
* tests/test-file-has-acl.sh (func_tmpdir): Likewise.
* tests/test-fprintf-posix.sh: Likewise.
* tests/test-init.sh: Likewise.
* tests/test-iswdigit.sh: Likewise.
* tests/test-iswxdigit.sh: Likewise.
* tests/test-mbmemcasecmp1.sh: Likewise.
* tests/test-mbmemcasecmp2.sh: Likewise.
* tests/test-mbmemcasecmp3.sh: Likewise.
* tests/test-mbmemcasecoll1.sh: Likewise.
* tests/test-mbmemcasecoll2.sh: Likewise.
* tests/test-mbmemcasecoll3.sh: Likewise.
* tests/test-mbrtoc32-1.sh: Likewise.
* tests/test-mbrtoc32-2.sh: Likewise.
* tests/test-mbrtoc32-3.sh: Likewise.
* tests/test-mbrtoc32-4.sh: Likewise.
* tests/test-mbrtowc1.sh: Likewise.
* tests/test-mbrtowc2.sh: Likewise.
* tests/test-mbrtowc3.sh: Likewise.
* tests/test-mbrtowc4.sh: Likewise.
* tests/test-mbscasecmp.sh: Likewise.
* tests/test-mbscasestr2.sh: Likewise.
* tests/test-mbscasestr3.sh: Likewise.
* tests/test-mbscasestr4.sh: Likewise.
* tests/test-mbschr.sh: Likewise.
* tests/test-mbscspn.sh: Likewise.
* tests/test-mbsinit.sh: Likewise.
* tests/test-mbsncasecmp.sh: Likewise.
* tests/test-mbsnrtoc32s-1.sh: Likewise.
* tests/test-mbsnrtoc32s-2.sh: Likewise.
* tests/test-mbsnrtoc32s-3.sh: Likewise.
* tests/test-mbsnrtoc32s-4.sh: Likewise.
* tests/test-mbsnrtowcs1.sh: Likewise.
* tests/test-mbsnrtowcs2.sh: Likewise.
* tests/test-mbsnrtowcs3.sh: Likewise.
* tests/test-mbsnrtowcs4.sh: Likewise.
* tests/test-mbspbrk.sh: Likewise.
* tests/test-mbspcasecmp.sh: Likewise.
* tests/test-mbsrchr.sh: Likewise.
* tests/test-mbsrtoc32s-1.sh: Likewise.
* tests/test-mbsrtoc32s-2.sh: Likewise.
* tests/test-mbsrtoc32s-3.sh: Likewise.
* tests/test-mbsrtoc32s-4.sh: Likewise.
* tests/test-mbsrtowcs1.sh: Likewise.
* tests/test-mbsrtowcs2.sh: Likewise.
* tests/test-mbsrtowcs3.sh: Likewise.
* tests/test-mbsrtowcs4.sh: Likewise.
* tests/test-mbsspn.sh: Likewise.
* tests/test-mbsstr2.sh: Likewise.
* tests/test-mbsstr3.sh: Likewise.
* tests/test-mbstoc32s-1.sh: Likewise.
* tests/test-mbstoc32s-2.sh: Likewise.
* tests/test-mbstoc32s-3.sh: Likewise.
* tests/test-mbstoc32s-4.sh: Likewise.
* tests/test-nl_langinfo.sh: Likewise.
* tests/test-parse-duration.sh (func_tmpdir): Likewise.
* tests/test-perror.sh: Likewise.
* tests/test-printf-posix.sh: Likewise.
* tests/test-set-mode-acl.sh (func_tmpdir): Likewise.
* tests/test-setlocale1.sh: Likewise.
* tests/test-strtod1.sh: Likewise.
* tests/test-strtold1.sh: Likewise.
* tests/test-unicodeio2.sh: Likewise.
* tests/test-unicodeio3.sh: Likewise.
* tests/test-vasnprintf-posix2.sh: Likewise.
* tests/test-vc-list-files-cvs.sh: Likewise.
* tests/test-vc-list-files-git.sh: Likewise.
* tests/test-vdprintf-posix.sh: Likewise.
* tests/test-vfprintf-posix.sh: Likewise.
* tests/test-vprintf-posix.sh: Likewise.
* tests/test-wcrtomb.sh: Likewise.
* tests/test-wcsnrtombs1.sh: Likewise.
* tests/test-wcsnrtombs2.sh: Likewise.
* tests/test-wcsnrtombs3.sh: Likewise.
* tests/test-wcsnrtombs4.sh: Likewise.
* tests/test-wcsrtombs1.sh: Likewise.
* tests/test-wcsrtombs2.sh: Likewise.
* tests/test-wcsrtombs3.sh: Likewise.
* tests/test-wcsrtombs4.sh: Likewise.
* tests/test-xprintf-posix.sh: Likewise.
* tests/test-xstrtoimax.sh: Likewise.
* tests/test-xstrtol.sh: Likewise.
* tests/test-xstrtoll.sh: Likewise.
* tests/test-xstrtoumax.sh: Likewise.
* tests/test-yesno.sh: Likewise.
* tests/unicase/test-locale-language.sh: Likewise.
* tests/unicase/test-ulc-casecmp1.sh: Likewise.
* tests/unicase/test-ulc-casecmp2.sh: Likewise.
* tests/unicase/test-ulc-casecoll1.sh: Likewise.
* tests/unicase/test-ulc-casecoll2.sh: Likewise.
* tests/unigbrk/test-ulc-grapheme-breaks.sh: Likewise.
* tests/unistdio/test-u16-vasnprintf2.sh: Likewise.
* tests/unistdio/test-u16-vasnprintf3.sh: Likewise.
* tests/unistdio/test-u32-vasnprintf2.sh: Likewise.
* tests/unistdio/test-u32-vasnprintf3.sh: Likewise.
* tests/unistdio/test-u8-vasnprintf2.sh: Likewise.
* tests/unistdio/test-u8-vasnprintf3.sh: Likewise.
* tests/unistdio/test-ulc-vasnprintf2.sh: Likewise.
* tests/unistdio/test-ulc-vasnprintf3.sh: Likewise.
* tests/uniwbrk/test-ulc-wordbreaks.sh: Likewise.
* tests/uniwidth/test-uc_width2.sh: Likewise.

2 years agodoc: Update README.
Bruno Haible [Sun, 17 Jul 2022 10:55:05 +0000 (12:55 +0200)]
doc: Update README.

* doc/README: Fix stale links (reported by Tzvetelin Katchov). Clarify
the relation to build-aux/gnu-web-doc-update.

2 years agodoc: Fix typo.
Bruno Haible [Thu, 14 Jul 2022 19:57:16 +0000 (21:57 +0200)]
doc: Fix typo.

Reported by Eric Gallager <egall@gwmail.gwu.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-07/msg00045.html>.

* doc/posix-functions/mmap.texi: Add parenthesis.

2 years agosigsegv: Optimize stackvma implementation for AIX 7.
Bruno Haible [Sun, 10 Jul 2022 21:19:03 +0000 (23:19 +0200)]
sigsegv: Optimize stackvma implementation for AIX 7.

Reported by Neha Jain <nehajain29@in.ibm.com> in
<https://lists.gnu.org/archive/html/bug-m4/2022-06/msg00005.html>
via Eric Blake.

* lib/stackvma.c: For AIX, add implementation that uses /proc/$pid/map,
based on lib/vma-iter.c.
(sigsegv_get_vma): Use it on AIX 7 or higher.

2 years agovma-iter: Add support for AIX 7.
Bruno Haible [Sun, 10 Jul 2022 19:52:11 +0000 (21:52 +0200)]
vma-iter: Add support for AIX 7.

* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on AIX.
* lib/vma-iter.c (vma_iterate): Add code for AIX, known to work on
AIX 7.
* lib/get-rusage-as.c: Update comments.
* lib/get-rusage-data.c: Likewise.
* tests/test-get-rusage-as.c (main): Take into account the special
address space organization on AIX in 32-bit mode.

2 years agohavelib: Fix 'configure --help' output.
Bruno Haible [Mon, 4 Jul 2022 22:48:36 +0000 (00:48 +0200)]
havelib: Fix 'configure --help' output.

* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Fix m4 quoting bug.

2 years agosupersede: Support the file name "/dev/null" on native Windows.
Bruno Haible [Sun, 3 Jul 2022 09:58:03 +0000 (11:58 +0200)]
supersede: Support the file name "/dev/null" on native Windows.

* lib/supersede.c (open_supersede): On native Windows, map "/dev/null"
to "NUL".

2 years agomaint.mk: fix syntax-check for unnecessary hash.h header use
Jim Meyering [Thu, 23 Jun 2022 15:12:44 +0000 (08:12 -0700)]
maint.mk: fix syntax-check for unnecessary hash.h header use

* top/maint.mk (_hash_re): Correct the regexp. It had two problems:
- lacked the "hash_" prefix, so would match non-uses
- failed to detect uses of the hash_x?initialize functions
The former led to an excess/unneeded use of hash.h in coreutils' cut.c.
The latter would have led to a FP "not needed" report for copy.c.

2 years agofchmodat: Fix test failure on native Windows.
Bruno Haible [Tue, 21 Jun 2022 23:46:37 +0000 (01:46 +0200)]
fchmodat: Fix test failure on native Windows.

* modules/fchmodat (Depends-on): Add 'chmod'.

2 years agochmod: Add tests.
Bruno Haible [Tue, 21 Jun 2022 23:45:33 +0000 (01:45 +0200)]
chmod: Add tests.

* tests/test-chmod.c: New file, based on tests/test-lchmod.c.
* modules/chmod-tests: New file.

2 years agochmod: New module.
Bruno Haible [Tue, 21 Jun 2022 23:43:52 +0000 (01:43 +0200)]
chmod: New module.

* lib/sys_stat.in.h (chmod): Declare when GNULIB_CHMOD is 1.
* lib/chmod.c: New file, based on lib/lchmod.c.
* m4/chmod.m4: New file, based on m4/fchmodat.m4.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H): Test whether chmod is declared.
(gl_SYS_STAT_H_REQUIRE_DEFAULTS): Initialize GNULIB_CHMOD.
(gl_SYS_STAT_H_DEFAULTS): Initialize REPLACE_CHMOD.
* modules/sys_stat (Makefile.am): Substitute GNULIB_CHMOD,
REPLACE_CHMOD.
* modules/chmod: New file, based on modules/lchmod.
* doc/posix-functions/chmod.texi: Mention the new module and the
problems on IRIX and Windows.

2 years agolchmod: Simplify.
Bruno Haible [Tue, 21 Jun 2022 21:19:07 +0000 (23:19 +0200)]
lchmod: Simplify.

* lib/lchmod.c: Remove unnecessary include, obsolete since 2020-02-23.

2 years agolchmod: port back to AIX 7.2
Paul Eggert [Mon, 20 Jun 2022 04:30:01 +0000 (23:30 -0500)]
lchmod: port back to AIX 7.2

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00075.html
* lib/lchmod.c: Include string.h, for strlen.
(lchmod): Do not depend on HAVE_READLINK since we now depend on
the readlink module.  Check for AIX 7.2 bug.
* m4/lchmod.m4 (gl_PREREQ_LCHMOD): Do not check for readlink
since we now depend on the readlink module.
* modules/lchmod (Depends-on): Depend on readlink.

2 years agofchmodat: pacify gcc -Wunused-variable
Paul Eggert [Mon, 20 Jun 2022 04:29:07 +0000 (23:29 -0500)]
fchmodat: pacify gcc -Wunused-variable

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00075.html
* lib/fchmodat.c (fchmodat): Remove unused local.

2 years agogetlogin, getlogin_r tests: Really avoid test failure.
Bruno Haible [Sun, 19 Jun 2022 14:14:19 +0000 (16:14 +0200)]
getlogin, getlogin_r tests: Really avoid test failure.

Reported by Letu Ren <fantasquex@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-06/msg00037.html>.

* tests/test-getlogin.h (test_getlogin_result): Parse the contents of
/proc/self/loginuid as an unsigned integer.

2 years agofchmodat: port better to MS-Windows etc.
Paul Eggert [Sun, 12 Jun 2022 20:46:52 +0000 (13:46 -0700)]
fchmodat: port better to MS-Windows etc.

MS-Windows problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00041.html
Although I don’t use MS-Windows I see some related fstatat etc.
problems and am trying to fix them with this further patch.
* lib/fchmodat.c (fchmodat):
* lib/lchmod.c (lchmod):
* lib/lchown.c (lchown)
[!HAVE_LCHOWN && HAVE_CHOWN && !CHOWN_MODIFIES_SYMLINK]:
* lib/renameatu.c (renameatu)
[HAVE_RENAME && RENAME_TRAILING_SLASH_SOURCE_BUG]:
Use readlinkat/readlink instead of fstatat/lstat to test merely
whether a string names a symlink, as this avoids problems
with EOVERFLOW.  Also, I hope it works around the MS-Windows
issues that Bruno noted.
* m4/fchmodat.m4 (gl_PREREQ_FCHMODAT):
Check for readlinkat, not lchmod.
* m4/lchmod.m4 (gl_FUNC_LCHMOD): Do not require AC_CANONICAL_HOST
or check for lstat.
(gl_PREREQ_LCHMOD): Check for readlink.
* modules/lchown (Depends-on): Add readlink.  Do not depend on
lstat merely because !HAVE_LCHOWN.
* modules/renameatu (Depends-on): Add fstatat, readlinkat.