]> Savannah Git Hosting - gnulib.git/log
gnulib.git
28 hours agojavacomp: Fix resource leak. stable-202407
Bruno Haible [Thu, 1 May 2025 15:28:06 +0000 (17:28 +0200)]
javacomp: Fix resource leak.

* lib/javacomp.c (execute_and_read_line): Upon failure, close the stream
and wait for the child process to terminate.

28 hours agosigsegv: Fix compilation error on Mac OS X 10.4/powerpc.
Bruno Haible [Mon, 28 Apr 2025 15:47:37 +0000 (17:47 +0200)]
sigsegv: Fix compilation error on Mac OS X 10.4/powerpc.

Patch by Evan Miller <emmiller@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-08/msg00153.html>.

* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER) [macOS/powerpc: On Mac OS X
<= 10.4, assume struct field names without underscores.

28 hours agopselect: Disable signature check on AIX.
Collin Funk [Sat, 26 Apr 2025 01:02:51 +0000 (18:02 -0700)]
pselect: Disable signature check on AIX.

* tests/test-pselect.c [_AIX]: Skip pselect signature check.

28 hours agofbufmode: Don't require peeking into the FILE structure on recent Haiku.
Bruno Haible [Thu, 24 Apr 2025 18:18:59 +0000 (20:18 +0200)]
fbufmode: Don't require peeking into the FILE structure on recent Haiku.

Suggested by Augustin Cavalier <waddlesplash@gmail.com>
in <https://dev.haiku-os.org/ticket/19479#comment:15>.

* lib/fbufmode.c (fbufmode): On Haiku >= hrev58760, use the same
implementation as on musl libc.

28 hours agotsearch tests: Disable tfind signature check on Cygwin.
Collin Funk [Thu, 24 Apr 2025 03:29:25 +0000 (20:29 -0700)]
tsearch tests: Disable tfind signature check on Cygwin.

* tests/test-tsearch.c [__CYGWIN__]: Skip the tfind signature check.
* doc/posix-functions/tfind.texi: Mention the Cygwin signature.

28 hours agorandom_r tests: Disable signature check on Haiku.
Collin Funk [Wed, 23 Apr 2025 01:46:08 +0000 (18:46 -0700)]
random_r tests: Disable signature check on Haiku.

* tests/test-random_r.c [__HAIKU__]: Skip initstate_r and setstate_r
signature check.
* doc/glibc-functions/initstate_r.texi: Remove year.
* doc/glibc-functions/setstate_r.texi: Likewise.

28 hours agostrsignal tests: Disable signature check on Haiku.
Collin Funk [Tue, 22 Apr 2025 03:35:08 +0000 (20:35 -0700)]
strsignal tests: Disable signature check on Haiku.

* tests/test-strsignal.c [__HAIKU__]: Skip signature check.
* doc/posix-functions/strsignal.texi: Document that strsignal returns
'const char *' instead of 'char *' on Haiku.

28 hours agogetloadavg: port to Android 3.1-
Paul Eggert [Mon, 21 Apr 2025 17:58:58 +0000 (10:58 -0700)]
getloadavg: port to Android 3.1-

Problem reported by Po Lu in:
https://lists.gnu.org/r/bug-gnulib/2025-04/msg00172.html
* lib/getloadavg.c (getloadavg): Do not try to use sysinfo on
Android 3.1 Honeycomb (API 12, 2011) and earlier.

28 hours agoEnsure that the configuration cleans up conftest.dSYM directories.
Grisha Levit [Wed, 16 Apr 2025 03:34:11 +0000 (23:34 -0400)]
Ensure that the configuration cleans up conftest.dSYM directories.

* m4/gnulib-common.m4 (gl_CC_ALLOW_WARNINGS, gl_CXX_ALLOW_WARNINGS):
Remove conftest* files and directories recursively.
* m4/asm-underscore.m4 (gl_ASM_SYMBOL_PREFIX, gl_C_ASM): Likewise.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Likewise.
* m4/warnings.m4 (gl_CC_INHIBIT_WARNINGS, gl_CXX_INHIBIT_WARNINGS):
Likewise.

Copyright-paperwork-exempt: Yes

28 hours agognulib-tool.py: Fix exception during --update with changed macro-prefix.
Bruno Haible [Tue, 15 Apr 2025 20:21:04 +0000 (22:21 +0200)]
gnulib-tool.py: Fix exception during --update with changed macro-prefix.

* pygnulib/GLImport.py (GLImport.__init__): Support the case that the
expected ${macro_prefix}_FILE_LIST definition was not found.

28 hours agotrim tests: Avoid test failures on macOS 15.4.
Bruno Haible [Tue, 15 Apr 2025 14:14:07 +0000 (16:14 +0200)]
trim tests: Avoid test failures on macOS 15.4.

* tests/test-trim.c (main): On macOS, disable test cases that fail on
macOS 15.4.

2 weeks agoc32is*, c32to* tests: Avoid test failures on macOS 15.4.
Bruno Haible [Mon, 14 Apr 2025 20:53:12 +0000 (22:53 +0200)]
c32is*, c32to* tests: Avoid test failures on macOS 15.4.

* tests/test-c32isalnum.c (main): On macOS, disable test cases that fail
on macOS 15.4.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32isspace.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.
* tests/test-c32tolower.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.

2 weeks agoc-stack tests: Remove left-over core dump file.
Bruno Haible [Mon, 14 Apr 2025 20:49:55 +0000 (22:49 +0200)]
c-stack tests: Remove left-over core dump file.

Suggested by Eric Blake in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-04/msg00101.html>.

* tests/test-c-stack2.sh: Remove 'core' and 'test-c-stack.core' when
done.

2 weeks agoregex: Fix undefined behaviour.
Bruno Haible [Mon, 14 Apr 2025 14:00:13 +0000 (16:00 +0200)]
regex: Fix undefined behaviour.

* lib/regex.h (_REGEX_NELTS): Define to empty; don't use ISO C99
variable-length arrays.

2 weeks agoselect tests: Work around a Cygwin bug.
Bruno Haible [Mon, 14 Apr 2025 13:15:12 +0000 (15:15 +0200)]
select tests: Work around a Cygwin bug.

* tests/test-select-in.sh: Skip the /dev/null test on Cygwin 3.6.x.

2 weeks agostdlib: Avoid syntax errors in libstdc++ header files on AIX.
Collin Funk [Sat, 12 Apr 2025 20:24:31 +0000 (13:24 -0700)]
stdlib: Avoid syntax errors in libstdc++ header files on AIX.

* lib/stdlib.in.h: Include <string> before strtol, strtoll, strtoul, or
strtoull gets defined as a macro.

2 weeks agofnmatch tests: Avoid test failures on macOS 15.4.
Bruno Haible [Sat, 12 Apr 2025 10:45:40 +0000 (12:45 +0200)]
fnmatch tests: Avoid test failures on macOS 15.4.

Reported by Daniel Collins <solemnwarning@solemnwarning.net>
at <https://savannah.gnu.org/bugs/?67007>.

* tests/test-fnmatch.c (main): On macOS, disable test cases that fail on
macOS 15.4.

2 weeks agovasnprintf: Fix memory size bound for %g with grouping and precision.
Bruno Haible [Fri, 11 Apr 2025 14:45:03 +0000 (16:45 +0200)]
vasnprintf: Fix memory size bound for %g with grouping and precision.

* lib/vasnprintf.c (MAX_ROOM_NEEDED): For %g, consider also the size of
the thousands separators.

2 weeks agovasnprintf: Fix handling of # flag in %b, %B directives.
Bruno Haible [Thu, 10 Apr 2025 08:42:12 +0000 (10:42 +0200)]
vasnprintf: Fix handling of # flag in %b, %B directives.

* lib/vasnprintf.c (VASNPRINTF): In the prec_ourselves code, treat a 0b
prefix like a 0x prefix.

2 weeks agostddef-h: Make a configure test work with upcoming GCC 15.
Bruno Haible [Tue, 8 Apr 2025 09:31:20 +0000 (11:31 +0200)]
stddef-h: Make a configure test work with upcoming GCC 15.

* m4/stddef_h.m4 (gl_STDDEF_H): Replace test "for clean definition" with
one that succeeds in GCC 15.

2 weeks agostdioext: Update comments regarding Haiku.
Bruno Haible [Mon, 7 Apr 2025 08:55:46 +0000 (10:55 +0200)]
stdioext: Update comments regarding Haiku.

* lib/fbufmode.c (fbufmode): Update comment.
* lib/fpending.c: Likewise.
* lib/freadable.c: Likewise.
* lib/freadahead.c: Likewise.
* lib/freadptr.c: Likewise.
* lib/freadseek.c (freadptrinc): Likewise.
* lib/fseterr.c: Likewise.
* lib/fwritable.c: Likewise.
* lib/fwriting.c: Likewise.

2 weeks agomaintainer-makefile: Avoid submodule-checks fail without submodules.
Simon Josefsson [Mon, 7 Apr 2025 06:56:09 +0000 (08:56 +0200)]
maintainer-makefile: Avoid submodule-checks fail without submodules.

* top/maint.mk (no-submodule-changes): Condition on .gitmodules.
(public-submodule-commit): Likewise.

2 weeks agofseterr: Port to recent Haiku snapshots.
Collin Funk [Mon, 7 Apr 2025 03:08:25 +0000 (20:08 -0700)]
fseterr: Port to recent Haiku snapshots.

* lib/fseterr.h (__fseterr): Provide missing declaration.

2 weeks agofflush: Port to recent Haiku snapshots.
Collin Funk [Mon, 7 Apr 2025 02:34:54 +0000 (19:34 -0700)]
fflush: Port to recent Haiku snapshots.

* lib/stdio-impl.h (_IO_IN_BACKUP) [__HAIKU__]: Define macros.
* lib/fflush.c (fp_) [!__HAIKU__]: Define to fp.
(fflush): Use fp_ instead of fp.

2 weeks agofbufmode: Port to recent Haiku snapshots.
Collin Funk [Mon, 7 Apr 2025 02:28:27 +0000 (19:28 -0700)]
fbufmode: Port to recent Haiku snapshots.

* lib/stdio-impl.h (_IO_UNBUFFERED, _IO_LINE_BUF) [__HAIKU__]: Define
macros.
* lib/fbufmode.c (fp_) [!__HAIKU__]: Define to fp.
(fbufmode): Use fp_ instead of fp.

2 weeks agofseeko: Port to recent Haiku snapshots.
Collin Funk [Mon, 7 Apr 2025 02:19:35 +0000 (19:19 -0700)]
fseeko: Port to recent Haiku snapshots.

* lib/stdio-impl.h (fp_) [__HAIKU__]: Define to FILE which is an
incomplete type on Haiku.
(_IO_EOF_SEEN) [__HAIKU__]: Define macro.
* lib/fseeko.c (fp_) [!__HAIKU__]: Define to fp.
(fseeko): Use fp_ instead of fp.

2 weeks agognulib-tool.py: Fix missing space.
Eric Blake [Sat, 5 Apr 2025 20:21:13 +0000 (15:21 -0500)]
gnulib-tool.py: Fix missing space.

* pygnulib/main.py (main_with_exception_handling): Typo fix.

2 weeks agomaintainer-makefile: Work with modern LCOV versions.
Simon Josefsson [Fri, 4 Apr 2025 09:49:13 +0000 (11:49 +0200)]
maintainer-makefile: Work with modern LCOV versions.

* top/maint.mk (gen-coverage): Don't pass --highlight to genhtml.

4 weeks agosame-inode: update now-wrong dependency
Paul Eggert [Tue, 1 Apr 2025 15:07:02 +0000 (17:07 +0200)]
same-inode: update now-wrong dependency

* modules/same-inode (Depends-on): Depend on sys_stat,
not sys_types.

4 weeks agogetloadavg: Improve Linux and Android support.
Bruno Haible [Fri, 21 Mar 2025 15:25:59 +0000 (16:25 +0100)]
getloadavg: Improve Linux and Android support.

* lib/getloadavg.c [__linux__, __ANDROID__]: Include <sys/param.h> and
<sys/sysinfo.h>.
(getloadavg) [__linux__, __ANDROID__]: Use sysinfo() instead of reading
/proc/loadavg.
(LINUX_LDAV_FILE): Remove macro.

4 weeks agosetlocale-null: Fix autoconf warning.
Bruno Haible [Fri, 21 Mar 2025 06:17:53 +0000 (07:17 +0100)]
setlocale-null: Fix autoconf warning.

* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Define through
AC_DEFUN_ONCE.

4 weeks agoFix compilation errors in C++ mode on Android.
Bruno Haible [Thu, 20 Mar 2025 16:35:38 +0000 (17:35 +0100)]
Fix compilation errors in C++ mode on Android.

* lib/string.in.h (memset_explicit, strerrorname_np): Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* lib/time.in.h (timespec_getres): Likewise.
* lib/unistd.in.h (copy_file_range): Likewise.

4 weeks agofutimens: Work around a GNU/Hurd bug.
Collin Funk [Wed, 19 Mar 2025 04:50:00 +0000 (21:50 -0700)]
futimens: Work around a GNU/Hurd bug.

* m4/futimens.m4 (gl_FUNC_FUTIMENS): Check if futimens validates the
tv_nsec values of the timespec argument. Set bits in a return value
instead of exiting early.
* doc/posix-functions/futimens.texi (futimens): Mention the GNU/Hurd
bug. Mention the same bug occurs on NetBSD 10.

4 weeks agoutimensat: Work around a GNU/Hurd bug.
Collin Funk [Tue, 18 Mar 2025 04:16:22 +0000 (21:16 -0700)]
utimensat: Work around a GNU/Hurd bug.

* lib/utimensat.c (rpl_utimensat) [__gnu_hurd__]: Check for out of range
tv_nsec values.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise. Guess that utimensat
doesn't work on GNU/Hurd.
* doc/posix-functions/utimensat.texi: Mention the bug.

4 weeks agovma-iter: Detect executable memory segments on Haiku (regr. 2011-01-25).
Collin Funk [Fri, 14 Mar 2025 02:11:08 +0000 (19:11 -0700)]
vma-iter: Detect executable memory segments on Haiku (regr. 2011-01-25).

* lib/vma-iter.c (vma_iterate) [__BEOS__ || __HAIKU__]: Use the
B_EXECUTE_AREA flag.

4 weeks agodup3: Fix behavior for equal file descriptors on Haiku.
Collin Funk [Thu, 13 Mar 2025 01:55:26 +0000 (18:55 -0700)]
dup3: Fix behavior for equal file descriptors on Haiku.

* lib/dup3.c (dup3) [__HAIKU__]: Set errno to EINVAL and return -1 if
both file descriptors are equal.
* doc/posix-functions/dup3.texi: Document the Haiku bug.

4 weeks agoquotearg: Avoid undefined behaviour.
Bruno Haible [Mon, 10 Mar 2025 16:28:33 +0000 (17:28 +0100)]
quotearg: Avoid undefined behaviour.

Reported by Kirill Furman <kfurman@astralinux.ru> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-03/msg00037.html>.

* lib/quotearg.c (set_char_quoting): Use 'unsigned int', not 'int', for
doing bit mask operations.

8 weeks agovasprintf-posix, vasprintf-gnu: Fix module description.
Bruno Haible [Mon, 3 Mar 2025 19:41:41 +0000 (20:41 +0100)]
vasprintf-posix, vasprintf-gnu: Fix module description.

Reported by Vivien Kraus <vivien@planete-kraus.eu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-03/msg00009.html>.

* modules/vasprintf-posix (Include): Change to <stdio.h>.
* modules/vasprintf-gnu (Include): Likewise.

8 weeks agohost-cpu-c-abi: Improve support for loongarch32.
Bruno Haible [Fri, 21 Feb 2025 10:38:35 +0000 (11:38 +0100)]
host-cpu-c-abi: Improve support for loongarch32.

Reported by <wuruilong@loongson.cn>
in <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098478>
via Simon Josefsson.

* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Prepare template for
__loongarch32__ in config.h.
(gl_HOST_CPU_C_ABI_32BIT): Speed up the configure test on loongarch*.

8 weeks agoreadutmp: Let callers distinguish LOGINs from USERs.
Bruno Haible [Wed, 19 Feb 2025 22:46:37 +0000 (23:46 +0100)]
readutmp: Let callers distinguish LOGINs from USERs.

Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00123.html>.

* lib/readutmp.h (LOGIN_PROCESS, UT_TYPE_LOGIN_PROCESS): New macros.
* lib/readutmp.c (read_utmp_from_systemd): Possibly use LOGIN_PROCESS
instead of USER_PROCESS, depending on the session's class.

8 weeks agosetlocale: Update info about Galician and Tamil.
Bruno Haible [Thu, 13 Feb 2025 01:18:05 +0000 (02:18 +0100)]
setlocale: Update info about Galician and Tamil.

* lib/setlocale.c (locales_with_principal_territory): Galician is
mostly spoken in Spain, not Portugal. Tamil is mostly spoken in India,
not Sri Lanka.

8 weeks agogettext-h: Fix compilation error on native Windows.
Bruno Haible [Wed, 12 Feb 2025 22:43:21 +0000 (23:43 +0100)]
gettext-h: Fix compilation error on native Windows.

* modules/gettext-h (Depends-on): Add locale-h.

8 weeks agopopen: Set gl_cv_func_popen_works to "guessing no" on OS/2.
KO Myung-Hun [Mon, 10 Feb 2025 11:35:00 +0000 (20:35 +0900)]
popen: Set gl_cv_func_popen_works to "guessing no" on OS/2.

* doc/posix-functions/popen.texi: List OS/2 kLIBC case.
* m4/popen.m4 (gl_FUNC_POPEN): Set gl_cv_func_popen_works to
"guessing no" on OS/2.

Copyright-paperwork-exempt: Yes

8 weeks agognulib-tool: Apply libgnu.{,l}a specific CFLAGS to all its object files.
Bruno Haible [Mon, 3 Feb 2025 22:55:39 +0000 (23:55 +0100)]
gnulib-tool: Apply libgnu.{,l}a specific CFLAGS to all its object files.

* gnulib-tool.sh (func_emit_initmacro_end): Define
${macro_prefix}_${libname}_{LIBOBJS,LTLIBOBJS,LIBOBJDEPS} macros, that
include libname in the base name of the object files.
(func_emit_lib_Makefile_am): Use ${macro_prefix}_${libname}_*LIBOBJS
values instead of ${macro_prefix}_*LIBOBJS values.
* pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Define
{macro_prefix_arg}_{libname}_{LIBOBJS,LTLIBOBJS,LIBOBJDEPS} macros, that
include libname in the base name of the object files.
(GLEmiter.lib_Makefile_am):Use {macro_prefix}_{libname}_*LIBOBJS
values instead of {macro_prefix}_*LIBOBJS values.

3 months agoptsname_r: Work around ptsname_r bug on Solaris 11 OmniOS.
Collin Funk [Sat, 25 Jan 2025 05:36:11 +0000 (21:36 -0800)]
ptsname_r: Work around ptsname_r bug on Solaris 11 OmniOS.

* lib/ptsname_r.c (ptsname_r): Ensure the resulting buffer is not
clobbered if it is too small on Solaris 11 OmniOS.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): On Solaris 11 OmniOS, arrange to
override ptsname_r.

3 months agostrerrorname_np: Work around a bug on Solaris 11 OmniOS.
Collin Funk [Sat, 25 Jan 2025 04:38:54 +0000 (20:38 -0800)]
strerrorname_np: Work around a bug on Solaris 11 OmniOS.

* m4/strerrorname_np.m4 (gl_CHECK_STRERRORNAME_NP): Test if
strerrorname_np returns NULL when given ERESTART or ESTRPIPE.
* doc/glibc-functions/strerrorname_np.texi: Document the bug.

3 months agotests: Fix a few compilation errors on Solaris 11 OmniOS with gcc 14.
Bruno Haible [Fri, 24 Jan 2025 19:06:06 +0000 (20:06 +0100)]
tests: Fix a few compilation errors on Solaris 11 OmniOS with gcc 14.

* tests/test-accept.c: Omit the signature check on Solaris.
* tests/test-gethostname.c: Likewise.
* tests/test-getpeername.c: Likewise.
* tests/test-getsockname.c: Likewise.
* tests/test-getsockopt.c: Likewise.
* tests/test-recvfrom.c: Likewise.
* doc/posix-functions/accept.texi: Mention the Solaris 11 OmniOS
problem.
* doc/posix-functions/gethostname.texi: Likewise.
* doc/posix-functions/getpeername.texi: Likewise.
* doc/posix-functions/getsockname.texi: Likewise.
* doc/posix-functions/getsockopt.texi: Likewise.
* doc/posix-functions/recvfrom.texi: Likewise.

3 months agouchar-h-c23: Fix compilation error on OmniOS.
Collin Funk [Fri, 24 Jan 2025 05:14:43 +0000 (21:14 -0800)]
uchar-h-c23: Fix compilation error on OmniOS.

* lib/lc-charset-unicode.c (locale_encoding_to_unicode)
(unicode_to_locale_encoding): Cast the argument to iconv with
ICONV_CONST.

3 months agoflexmember: port to IBM XL C 16.1
Paul Eggert [Sun, 19 Jan 2025 07:02:09 +0000 (23:02 -0800)]
flexmember: port to IBM XL C 16.1

* lib/flexmember.h (FLEXALIGNOF): Use the conservative definition
if _Alignof is a macro, to avoid a C99 conformance issue exposed
by IBM XL C 16.1 which otherwise complains "An aggregate
containing a flexible array member cannot be used as a member of a
structure or as an array element."

3 months agoalignasof: port to IBM XL C 16.1
Paul Eggert [Sun, 19 Jan 2025 06:06:55 +0000 (22:06 -0800)]
alignasof: port to IBM XL C 16.1

* doc/gnulib.texi (alignof):
Improve doc to match implementation better.
* m4/stdalign.m4 (alignas): Do not define to _Alignas
if __xlC__ claims to conform to C11, because _Alignas fails with
weird diagnostics "Unexpected text %1$s encountered."
* tests/test-alignasof.c (TEST_ALIGNMENT, alignas):
Follow doc advice.

3 months agorenameatu: Work around a GNU/Hurd bug.
Collin Funk [Sun, 19 Jan 2025 05:06:49 +0000 (21:06 -0800)]
renameatu: Work around a GNU/Hurd bug.

* m4/renameat.m4 (gl_FUNC_RENAMEAT): Check if renameat2 handles trailing
slashes.

3 months agoalignasof: port to IBM XL C V16.1
Paul Eggert [Sat, 18 Jan 2025 06:11:54 +0000 (22:11 -0800)]
alignasof: port to IBM XL C V16.1

* m4/stdalign.m4 (gl_ALIGNASOF):
Work around similar bug in IBM XL C V16.1.0 cc (non-clang).
Since this is the last version of this obsolescent compiler,
assume the bug is in earlier versions.

3 months agoAvoid -Wformat=security failures with --disable-nls
Pádraig Brady [Fri, 17 Jan 2025 13:01:40 +0000 (13:01 +0000)]
Avoid -Wformat=security failures with --disable-nls

This was noticed with GCC 14.

* lib/xmemcoll.c: Always use format arguments.
* lib/xprintf.c: Likewise.

3 months agogetopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).
Bruno Haible [Thu, 16 Jan 2025 22:10:10 +0000 (23:10 +0100)]
getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).

Reported by G. Branden Robinson <g.branden.robinson@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00135.html>.

* lib/getopt-pfx-core.h: On several platforms, include <unistd.h> first.
* modules/getopt-posix (Files): Add m4/musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.

3 months agowchar_h: Fix for glibc 2.5.
Bruno Haible [Thu, 16 Jan 2025 20:14:45 +0000 (21:14 +0100)]
wchar_h: Fix for glibc 2.5.

* lib/wchar.in.h (__need_wint_t): Clean up after including glibc's
<wchar.h>.

3 months agoassert-h: Fix compilation error with gcc >= 13 on Solaris 11.
Bruno Haible [Tue, 14 Jan 2025 21:47:43 +0000 (22:47 +0100)]
assert-h: Fix compilation error with gcc >= 13 on Solaris 11.

Reported by Pádraig Brady <P@draigBrady.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00120.html>.

* m4/assert_h.m4 (gl_ASSERT_H): Don't assume that on Solaris with gcc or
clang, static_assert works: /usr/include/assert.h is in the way.

3 months agoprogname: also set program_invocation_short_name
Pádraig Brady [Sun, 12 Jan 2025 16:47:57 +0000 (16:47 +0000)]
progname: also set program_invocation_short_name

* lib/progname.c (set_program_name): Keep program_invocation_name
and program_invocation_short_name consistent.

3 months agoeealloc, malloca: Fix module dependencies.
Bruno Haible [Sat, 11 Jan 2025 14:20:48 +0000 (15:20 +0100)]
eealloc, malloca: Fix module dependencies.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>.

* modules/eealloc (Depends-on): Add stdlib-h.
* modules/malloca (Depends-on): Likewise.

3 months agocanonicalize: Fix module dependencies.
Bruno Haible [Sat, 11 Jan 2025 14:19:57 +0000 (15:19 +0100)]
canonicalize: Fix module dependencies.

Reported by Miro Palmu <email@miropalmu.cc> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00077.html>.

* modules/canonicalize (Depends-on): Add stdlib.

3 months agofcntl-h: port better to musl on GNU/Linux
Paul Eggert [Wed, 8 Jan 2025 08:32:23 +0000 (00:32 -0800)]
fcntl-h: port better to musl on GNU/Linux

* lib/fcntl.in.h (O_SEARCH): Redefine to O_RDONLY on musl,
which mistakenly defines it to be O_PATH on GNU/Linux.
Problem reported by Lasse Collin in:
https://bugs.gnu.org/75405

3 months agosigsegv tests: Work around a longjmp bug on GNU/Hurd.
Bruno Haible [Mon, 6 Jan 2025 00:16:11 +0000 (01:16 +0100)]
sigsegv tests: Work around a longjmp bug on GNU/Hurd.

* tests/test-sigsegv-catch-stackoverflow1.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Undefine, as a workaround to the Hurd longjmp bug.
* tests/test-sigsegv-catch-stackoverflow2.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Likewise.
* doc/posix-functions/longjmp.texi: Document the Hurd bug.

3 months agotests: Don't use module 'getcwd' as dependency.
Bruno Haible [Sun, 5 Jan 2025 12:21:35 +0000 (13:21 +0100)]
tests: Don't use module 'getcwd' as dependency.

* modules/getcwd (Comment): New section.
* modules/xgetcwd (Comment): Likewise.
* modules/xgetcwd-lgpl: New file, based on modules/xgetcwd.
* modules/chown-tests (Depends-on): Add xgetcwd-lgpl. Remove xgetcwd.
* modules/fchownat-tests (Depends-on): Likewise.
* modules/fdutimensat-tests (Depends-on): Likewise.
* modules/futimens-tests (Depends-on): Likewise.
* modules/lchown-tests (Depends-on): Likewise.
* modules/stat-time-tests (Depends-on): Likewise.
* modules/utime-tests (Depends-on): Likewise.
* modules/utimens-tests (Depends-on): Likewise.
* modules/utimensat-tests (Depends-on): Likewise.

4 months agogetcwd: Return "/bin" instead of "//bin" on Adélie Linux.
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().

4 months agoendian: Fix link error on CentOS 5.
Bruno Haible [Sat, 28 Dec 2024 17:39:24 +0000 (18:39 +0100)]
endian: Fix link error on CentOS 5.

* m4/endian_h.m4 (gl_ENDIAN_H): Use AC_LINK_IFELSE, not
AC_COMPILE_IFELSE.

4 months agoassert-h, verify: Make static_assert work in C++ mode on FreeBSD 11.
Bruno Haible [Sat, 28 Dec 2024 16:40:44 +0000 (17:40 +0100)]
assert-h, verify: Make static_assert work in C++ mode on FreeBSD 11.

* lib/verify.h (static_assert): Override when using old versions of
clang++.

4 months agoendian: Fix compilation error on NetBSD 7.1.
Bruno Haible [Sat, 28 Dec 2024 15:47:16 +0000 (16:47 +0100)]
endian: Fix compilation error on NetBSD 7.1.

* m4/endian_h.m4 (gl_ENDIAN_H): Test for <sys/endian.h>. Set
HAVE_SYS_ENDIAN_H.
* lib/endian.in.h: Test HAVE_SYS_ENDIAN_H as an alternative to
HAVE_ENDIAN_H.
* modules/endian (Makefile.am): Substitute HAVE_SYS_ENDIAN_H.

4 months agowchar: Fix wcrtomb prototype conflict in C++ mode on OpenBSD 6.0.
Bruno Haible [Sat, 28 Dec 2024 15:38:23 +0000 (16:38 +0100)]
wchar: Fix wcrtomb prototype conflict in C++ mode on OpenBSD 6.0.

* lib/wchar.in.h (rpl_mbstate_t): Don't define on OpenBSD.

4 months agoaccess, euidaccess tests: Avoid test failure in Cygwin 3.5.5.
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.

4 months agowchar: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:23:45 +0000 (11:23 +0100)]
wchar: Support several gnulib-tool invocations better.

* lib/wchar.in.h (_GL_ALREADY_INCLUDING_WCHAR_H): Rename to a macro that
depends on GUARD_PREFIX.
(mbszero): Avoid duplicate definition.

4 months agothreads-h: Support several gnulib-tool invocations better.
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.

4 months agosys_socket: Support several gnulib-tool invocations better.
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.

4 months agostring: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:20:52 +0000 (11:20 +0100)]
string: Support several gnulib-tool invocations better.

* lib/string.in.h (_GL_ALREADY_INCLUDING_STRING_H): Rename to a macro
that depends on GUARD_PREFIX.

4 months agostdio: Support several gnulib-tool invocations better.
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.

4 months agospawn: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:17:31 +0000 (11:17 +0100)]
spawn: Support several gnulib-tool invocations better.

* lib/spawn.in.h (_GL_ALREADY_INCLUDING_SPAWN_H): Rename to a macro that
depends on GUARD_PREFIX.

4 months agosignal-h: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:25:01 +0000 (11:25 +0100)]
signal-h: Support several gnulib-tool invocations better.

* lib/signal.in.h (_GL_ALREADY_INCLUDING_SIGNAL_H): Rename to a macro
that depends on GUARD_PREFIX.

4 months agopthread-h: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:16:25 +0000 (11:16 +0100)]
pthread-h: Support several gnulib-tool invocations better.

* lib/pthread.in.h (_GL_ALREADY_INCLUDING_PTHREAD_H): Rename to a macro
that depends on GUARD_PREFIX.

4 months agomalloc-h: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:15:25 +0000 (11:15 +0100)]
malloc-h: Support several gnulib-tool invocations better.

* lib/malloc.in.h (_GL_ALREADY_INCLUDING_MALLOC_H): Rename to a macro
that depends on GUARD_PREFIX.

4 months agolocale: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:14:20 +0000 (11:14 +0100)]
locale: Support several gnulib-tool invocations better.

* lib/locale.in.h (_GL_ALREADY_INCLUDING_LOCALE_H): Rename to a macro
that depends on GUARD_PREFIX.
(struct lconv): Avoid duplicate definition.

4 months agolimits-h: Support several gnulib-tool invocations better.
Bruno Haible [Tue, 24 Dec 2024 10:13:16 +0000 (11:13 +0100)]
limits-h: Support several gnulib-tool invocations better.

* lib/limits.in.h (_GL_ALREADY_INCLUDING_LIMITS_H): Rename to a macro
that depends on GUARD_PREFIX.

4 months agostdlib: fix MB_CUR_MAX on older Android
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.

4 months agostdlib: MB_CUR_MAX is type size_t
Paul Eggert [Mon, 23 Dec 2024 20:23:22 +0000 (12:23 -0800)]
stdlib: MB_CUR_MAX is type size_t

* lib/stdlib.in.h (gl_MB_CUR_MAX): Return size_t, not int,
to conform to POSIX.

4 months agosetlocale: Support the UTF-8 environment on native Windows.
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().

4 months agolocalename-unsafe: Support the UTF-8 environment on native Windows.
Bruno Haible [Mon, 23 Dec 2024 15:56:57 +0000 (16:56 +0100)]
localename-unsafe: Support the UTF-8 environment on native Windows.

* lib/localename-unsafe.c (gl_locale_name_from_win32_LANGID): Append a
suffix ".UTF-8" to the result if GetACP() is UTF-8.

4 months agolocalcharset: Support the UTF-8 environment on native Windows.
Bruno Haible [Mon, 23 Dec 2024 15:56:15 +0000 (16:56 +0100)]
localcharset: Support the UTF-8 environment on native Windows.

* lib/localcharset.c (locale_charset): Recognize also the special case
of a setlocale() result that ends in ".UTF-8".

4 months agosetlocale: Handle LC_MESSAGES correctly on native Windows.
Bruno Haible [Mon, 23 Dec 2024 15:43:17 +0000 (16:43 +0100)]
setlocale: Handle LC_MESSAGES correctly on native Windows.

* lib/setlocale.c (setlocale_improved): Revamp the LC_ALL case if
LC_MESSAGES is 1729.

4 months agoc32isprint tests: Avoid test failure on mingw/ucrt.
Bruno Haible [Sun, 22 Dec 2024 13:34:29 +0000 (14:34 +0100)]
c32isprint tests: Avoid test failure on mingw/ucrt.

* tests/test-c32isprint.c (main): Disable test that fails on mingw/ucrt.

4 months agobtowc: Fix declaration on mingw/ucrt.
Bruno Haible [Sun, 22 Dec 2024 11:40:17 +0000 (12:40 +0100)]
btowc: Fix declaration on mingw/ucrt.

* m4/btowc.m4 (gl_FUNC_BTOWC): Require gt_TYPE_WINT_T. If gnulib
overrides wint_t, set REPLACE_BTOWC to 1.

4 months agoposix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2.
Bruno Haible [Sun, 22 Dec 2024 11:10:14 +0000 (12:10 +0100)]
posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2.

* tests/test-posix_spawn-chdir.c (test): Recognize also the 'pwd' output
for root on MSYS2.

4 months agotest-framework-sh: Avoid test suite failures on MSYS2.
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.

4 months agotest-framework-sh: Avoid test suite failures on MSYS2.
Bruno Haible [Sun, 22 Dec 2024 07:11:59 +0000 (08:11 +0100)]
test-framework-sh: Avoid test suite failures on MSYS2.

* tests/init.sh (mkdir) [MSys]: New function.

4 months agoexecl, execle, execlp: Fix compilation error with gcc 14.
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.

4 months agoxstdopen: Improve error message.
Bruno Haible [Tue, 17 Dec 2024 17:21:03 +0000 (18:21 +0100)]
xstdopen: Improve error message.

* lib/xstdopen.c (xstdopen): Improve error message. Ignore the errno
value.

4 months agoopenat-die: Fix a gcc -Wformat -Wformat-security warning.
Bruno Haible [Tue, 10 Dec 2024 20:19:17 +0000 (21:19 +0100)]
openat-die: Fix a gcc -Wformat -Wformat-security warning.

* lib/openat-die.c (openat_save_fail, openat_restore_fail): Put the
internationalized error message into non-format-string position.

4 months agoUpdate dependencies of modules that include "gettext.h".
Bruno Haible [Sun, 8 Dec 2024 14:24:13 +0000 (15:24 +0100)]
Update dependencies of modules that include "gettext.h".

* modules/closein (Depends-on): Add gettext-h.
* modules/dfa (Depends-on): Likewise.
* modules/error (Depends-on): Likewise.
* modules/xfreopen (Depends-on): Likewise.
* modules/xstrerror (Depends-on): Likewise.

4 months agosignbit: Fix compilation error with g++ 5.5 on Solaris 10.
Bruno Haible [Fri, 6 Dec 2024 19:48:06 +0000 (20:48 +0100)]
signbit: Fix compilation error with g++ 5.5 on Solaris 10.

Reported by G. Branden Robinson <g.branden.robinson@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00180.html>.

* lib/math.in.h (signbit): In C++ 11 or newer, assume that <math.h> or
<cmath> may define signbit through three inline functions.

4 months agostrerror_r-posix: Silence gcc 14 warning.
Bruno Haible [Tue, 3 Dec 2024 19:38:12 +0000 (20:38 +0100)]
strerror_r-posix: Silence gcc 14 warning.

* lib/strerror_r.c (strerror_r): Silence -Wformat-truncation warning.

4 months agoannounce-gen: Fix bug when accessing symlinks.
Bruno Haible [Sun, 1 Dec 2024 12:49:03 +0000 (13:49 +0100)]
announce-gen: Fix bug when accessing symlinks.

* build-aux/announce-gen (sizes): Pass the option -L to 'du'.

5 months agofpurge: Improve configure test.
Bruno Haible [Tue, 26 Nov 2024 08:38:42 +0000 (09:38 +0100)]
fpurge: Improve configure test.

Reported by Eli Schwartz <eschwartz@gentoo.org>.

* m4/fpurge.m4 (gl_FUNC_FPURGE): If fpurge is not declared, don't test
whether it works. Remove now-redundant cross-compilation guess.

5 months agogettext-h: Fix compilation error when pgettext is used.
Bruno Haible [Sun, 24 Nov 2024 14:15:37 +0000 (15:15 +0100)]
gettext-h: Fix compilation error when pgettext is used.

Reported by Friedrich Beckmann <friedrich.beckmann@posteo.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00189.html>.

* lib/gettext.h: Include <locale.h>.

5 months agoc-stack: Avoid a busy-looping test on macOS.
Bruno Haible [Wed, 20 Nov 2024 07:50:42 +0000 (08:50 +0100)]
c-stack: Avoid a busy-looping test on macOS.

* lib/c-stack.c: Undefine abort.