Bruno Haible [Tue, 31 Dec 2024 18:38:42 +0000 (19:38 +0100)]
getcwd: Return "/bin" instead of "//bin" on Adélie Linux.
Reported by Zach van Rijn <me@zv.io> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00072.html>
and <https://git.adelielinux.org/adelie/packages/-/issues/987>.
* lib/getcwd.c (__getcwd_generic): Remove a trailing slash from the
result of readlink().
Bruno Haible [Wed, 25 Dec 2024 00:34:23 +0000 (01:34 +0100)]
access, euidaccess tests: Avoid test failure in Cygwin 3.5.5.
* tests/test-access.h [__CYGWIN__]: Include <grp.h>, <string.h>,
<unistd.h>.
(is_administrator): New function.
(is_root): New macro.
(test_access): Reenable F_OK test for non-administrators on Cygwin.
Disable X_OK test for administrators on Cygwin.
Bruno Haible [Tue, 24 Dec 2024 10:22:40 +0000 (11:22 +0100)]
threads-h: Support several gnulib-tool invocations better.
* lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
that depends on GUARD_PREFIX.
(struct thrd_with_exitcode): Avoid duplicate definition.
Bruno Haible [Tue, 24 Dec 2024 10:21:51 +0000 (11:21 +0100)]
sys_socket: Support several gnulib-tool invocations better.
* lib/sys_socket.in.h (_GL_ALREADY_INCLUDING_SYS_SOCKET_H): Rename to a
macro that depends on GUARD_PREFIX.
(struct msghdr): Avoid duplicate definition.
Bruno Haible [Tue, 24 Dec 2024 10:19:49 +0000 (11:19 +0100)]
stdio: Support several gnulib-tool invocations better.
* lib/stdio.in.h: Test _GL_SKIP_GNULIB_STDIO_H.
(_GL_ALREADY_INCLUDING_STDIO_H): Rename to a macro that depends on
GUARD_PREFIX.
* lib/fopen.c: Set _GL_SKIP_GNULIB_STDIO_H instead of
_GL_ALREADY_INCLUDING_STDIO_H.
* lib/freopen.c: Likewise.
Paul Eggert [Mon, 23 Dec 2024 20:57:12 +0000 (12:57 -0800)]
stdlib: fix MB_CUR_MAX on older Android
Android NDK r16 MB_CUR_MAX doesn’t link when compiling C.
Problem found in GNU Emacs, which worked around it this way:
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=39a7e6b79fdeafc539a36f6831d922a2622cb679
... but this ran afoul of the recent Gnulib change that
added lib/stdlib.c.
* lib/stdlib.in.h (gl_MB_CUR_MAX): If @REPLACE_MB_CUR_MAX@
is positive, use its value directly.
* m4/stdlib_h.m4 (gl_STDLIB_H): Set REPLACE_MB_CUR_MAX to (-1)
if the Solaris bug, and to 4 if the Android bug.
* tests/test-stdlib.c (main): Check that MB_CUR_MAX compiles
and is nonzero.
Bruno Haible [Mon, 23 Dec 2024 15:57:15 +0000 (16:57 +0100)]
setlocale: Support the UTF-8 environment on native Windows.
* lib/setlocale.c: Include <windows.h>.
(setlocale_unixlike): In the UTF-8 environment, append a suffix ".65001"
to the locale names passed to the native setlocale().
Bruno Haible [Sun, 22 Dec 2024 11:03:22 +0000 (12:03 +0100)]
test-framework-sh: Avoid test suite failures on MSYS2.
* tests/init.sh (compare_) [MSys]: Use a temporary file on MSYS2.
* tests/test-update-copyright.sh: Use the test framework.
(compare): Remove function.
* modules/update-copyright-tests (Depends-on): Add test-framework-sh.
Bruno Haible [Sun, 22 Dec 2024 03:38:48 +0000 (04:38 +0100)]
execl, execle, execlp: Fix compilation error with gcc 14.
* lib/execl.c (execl): Cast second argument of execv.
* lib/execle.c (execle): Cast second argument of execve.
* lib/execlp.c (execlp): Cast second argument of execvp.
Pádraig Brady [Tue, 19 Nov 2024 18:11:21 +0000 (18:11 +0000)]
unicodeio: avoid iconv issues for most ASCII characters
* lib/unicodeio.c (print_unicode_char): Avoid unicode_to_mb()
for most ASCII characters, to avoid iconv() issues
which were seen on macOS.
Addresses https://bugs.gnu.org/74428
* lib/md5-stream.c (GL_OPENSSL_INLINE): Remove definition, that caused
the symbols defined in md5.o to be defined in md5-stream.o as well.
* lib/sha1-stream.c (GL_OPENSSL_INLINE): Likewise.
* lib/sha256-stream.c (GL_OPENSSL_INLINE): Likewise.
* lib/sha512-stream.c (GL_OPENSSL_INLINE): Likewise.
* lib/sm3-stream.c (GL_OPENSSL_INLINE): Likewise.
Bruno Haible [Mon, 11 Nov 2024 08:33:11 +0000 (09:33 +0100)]
getpagesize: Fix use of 'extern inline' (regression 2012-11-20).
* lib/unistd.in.h (_GL_GETPAGESIZE_INLINE): New macro.
(getpagesize): Use it.
* lib/getpagesize.c (_GL_GETPAGESIZE_INLINE): Define.
* modules/getpagesize (configure.ac): Compile getpagesize.c also when
getpagesize is missing.
Bruno Haible [Tue, 29 Oct 2024 12:48:36 +0000 (13:48 +0100)]
assert-h, stdbool: Allow mixed use of gcc/g++ and clang/clang++ again.
* m4/assert_h.m4 (gl_ASSERT_H): Improve indentation. With GCC and clang,
don't use the value of HAVE_C_STATIC_ASSERT.
* m4/c-bool.m4 (gl_C_BOOL): With GCC and clang, don't use the value of
HAVE_C_BOOL.
Bruno Haible [Wed, 9 Oct 2024 15:22:59 +0000 (17:22 +0200)]
csharpcomp: Avoid error on Windows.
Reported by Michele Locati <michele@locati.it>.
* build-aux/csharpcomp.sh.in: Don't produce -reference options for DLLs
whose name starts with a lowercase letter or contains '.Native.'.
* lib/csharpcomp.c (name_is_dll): Filter our file names that start with
a lowercase letter or contain '.Native.'.
Bruno Haible [Wed, 9 Oct 2024 01:14:26 +0000 (03:14 +0200)]
csharpcomp-script: Add support for dotnet.
* m4/csharpcomp.m4 (gt_CSHARPCOMP): Support 'dotnet' as implementation.
Set HAVE_DOTNET_SDK, HAVE_DOTNET_CSC.
* build-aux/csharpcomp.sh.in: Add implementations for the cases
$HAVE_DOTNET_SDK = 1 and $HAVE_DOTNET_CSC = 1.
Bruno Haible [Wed, 9 Oct 2024 01:12:42 +0000 (03:12 +0200)]
csharpexec-script: Add support for dotnet.
* m4/csharpexec.m4 (gt_CSHARPEXEC): Support 'dotnet' as implementation.
Set HAVE_DOTNET.
* build-aux/csharpexec.sh.in (func_tmpdir): New function, copied from
build-aux/csharpcomp.sh.in.
Add implementation for the case $HAVE_DOTNET = 1.
Bruno Haible [Mon, 7 Oct 2024 18:25:06 +0000 (20:25 +0200)]
csharpcomp: Improve Cygwin support.
* lib/csharpcomp.c: Include cygpath.h.
(compile_csharp_using_sscli): Convert the file names passed to 'csc' to
native Windows syntax.
* modules/csharpcomp (Depends-on): Add cygpath.
Bruno Haible [Mon, 7 Oct 2024 18:15:44 +0000 (20:15 +0200)]
csharpexec: Improve Cygwin support.
* lib/csharpexec.c: Include cygpath.h.
(execute_csharp_using_sscli): Convert the first 'clix' argument to
native Windows syntax.
* modules/csharpexec (Depends-on): Add cygpath.
Bruno Haible [Sun, 6 Oct 2024 23:14:20 +0000 (01:14 +0200)]
javacomp, javaversion: Fix resource leak.
* lib/javacomp.c (execute_and_read_line): When fdopen fails, terminate
the program.
* lib/javaversion.c (execute_and_read_line): Likewise. When we can't
read a single line, call fclose and wait_subprocess, to free resources.
Paul Eggert [Sat, 21 Sep 2024 02:24:39 +0000 (19:24 -0700)]
sigsegv-tests: port to GCC 14
GCC 14 on x86-64 with -O2 apparently outsmarts our test for null
pointer dereference, and this is something the C standard allows.
Fix the test by putting ‘volatile’ at the right place.
* tests/test-sigsegv-catch-stackoverflow2.c (null_pointer):
Make it a volatile pointer, not a pointer to volatile.
Also, rename from null_pointer_to_volatile_int; use changed.
Bruno Haible [Fri, 20 Sep 2024 15:17:36 +0000 (17:17 +0200)]
jit/cache tests: Fix crash with clang's UBSAN + ASAN.
* tests/jit/test-cache.c (clang_ubsan_workaround): New variable.
(CODE, SET_CODE): Use it.
(main): Initialize it.
* m4/libdl.m4: New file.
* modules/jit/cache-tests (Files): Add it.
(configure.ac): Invoke gl_LIBDL.
(Makefile.am): Link test-cache with $(LIBDL).
Paul Eggert [Fri, 6 Sep 2024 01:31:29 +0000 (18:31 -0700)]
Fix COPYING.EXCEPTION license notices
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00227.html
* m4/std-gnu11.m4: Fix license notice to use COPYING.EXCEPTION
correctly.
Bruno Haible [Wed, 4 Sep 2024 17:38:52 +0000 (19:38 +0200)]
Resolve conflicts for functions introduced in Android API level 35.
Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00024.html>.
* lib/time.in.h (timezone_t, tzalloc, tzfree): Don't require _GNU_SOURCE
to be defined. Define depending on HAVE_TZALLOC, not HAVE_TIMEZONE_T.
(localtime_rz, mktime_z): Likewise. Override if REPLACE_LOCALTIME_RZ or
REPLACE_MKTIME_Z is 1, respectively.
* lib/time_rz.c: If NEED_TIMEZONE_NULL_SUPPORT, define only localtime_rz
and mktime_z and only as wrappers around the system function.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* m4/time_rz.m4 (gl_TIME_RZ): Conditionally set HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Conditionally define
NEED_TIMEZONE_NULL_SUPPORT.
* modules/time-h (Makefile.am): Substitute HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* modules/time_rz (Depends-on, configure.ac): Consider HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Ignore HAVE_TIMEZONE_T.
Bruno Haible [Sun, 1 Sep 2024 11:09:59 +0000 (13:09 +0200)]
Fix mbscasestr test failure on native Windows with MSVC.
* lib/c32to-impl.h (FUNC): On native Windows, ignore the system's
towlower/towupper function entirely.
* tests/test-c32tolower.c (main): On native Windows, reenable test that
previously failed.
* tests/test-c32toupper.c (main): Likewise. Disable two other tests on
native Windows.
* doc/posix-functions/towlower.texi: Mention bug in the native Windows
UTF-8 locale.
* doc/posix-functions/towupper.texi: Likewise.