Bruno Haible [Tue, 5 Aug 2025 21:16:15 +0000 (23:16 +0200)]
git-merge-changelog: Remove module.
It is now available through
$ git clone https://git.savannah.gnu.org/git/vc-changelog.git
see https://gitweb.git.savannah.gnu.org/gitweb/?p=vc-changelog.git .
Paul Eggert [Fri, 1 Aug 2025 23:01:13 +0000 (16:01 -0700)]
copy-file-range: work around glibc bug 33245
Problem reported by Leah Neukirchen <https://bugs.gnu.org/79139>.
* lib/copy-file-range.c: Include sys-limits.h.
(copy_file_range) [glibc 2.42 and earlier]:
Copy at most SYS_BUFSIZE_MAX bytes.
* m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE):
Replace on glibc platforms, as well as on Linux platforms.
* modules/copy-file-range (Files): Add lib/sys-limits.h.
Paul Eggert [Fri, 1 Aug 2025 21:46:51 +0000 (14:46 -0700)]
copy-file-range: tune for more-modern kernels
* lib/copy-file-range.c [__linux__ && HAVE_COPY_FILE_RANGE]:
Include <linux/version.h>. Include <sys/utsname.h>
only for kernel 5.2 and earlier.
(CHECK_LINUX_KERNEL_VERSION): New macro.
(copy_file_range) [__linux__ && HAVE_COPY_FILE_RANGE]:
Call utsname only when built for kernel 5.2 and earlier.
(copy_file_range) [!__linux__ && HAVE_COPY_FILE_RANGE]:
Use underlying copy_file_range. This doesn’t change
behavior since the code is not compiled in this case,
but it makes the code a bit cleaner.
* modules/copy-file-range (Depends-on): Add bool.
Bruno Haible [Fri, 1 Aug 2025 20:44:39 +0000 (22:44 +0200)]
sigsegv: Use new ioctl available in Linux >= 6.11.
* lib/stackvma.c: On Linux, include <sys/ioctl.h>, <linux/fs.h>.
(vma_iterate_procmap_query): New function.
(vma_iterate): Try vma_iterate_procmap_query first.
Bruno Haible [Fri, 1 Aug 2025 20:38:44 +0000 (22:38 +0200)]
vma-iter: Use new ioctl available in Linux >= 6.11.
* lib/vma-iter.c: On Linux, include <sys/ioctl.h>, <linux/fs.h>.
(vma_iterate_procmap_query): New function.
(vma_iterate): Try vma_iterate_procmap_query first.
Bruno Haible [Tue, 29 Jul 2025 20:31:13 +0000 (22:31 +0200)]
nstrftime: Handle non-Gregorian calendars the same way on all platforms.
Suggested by Collin Funk.
* modules/nstrftime-limited: New file, based on modules/nstrftime.
* modules/nstrftime (Depends-on): Add nstrftime-limited.
Add localename-unsafe. Remove localename-unsafe-limited.
(configure.ac): Invoke gl_MODULE_INDICATOR.
(Makefile.am): Don't add nstrftime.c to lib_SOURCES; this would conflict
with modules/nstrftime-limited.
(Link): Add $(LIBTHREAD).
* lib/strftime.c (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): Don't force
to false if GNULIB_NSTRFTIME is defined.
* modules/nstrftime-tests (Makefile.am): Link test-nstrftime,
test-nstrftime-?? with $(LIBTHREAD).
Bruno Haible [Tue, 29 Jul 2025 14:28:48 +0000 (16:28 +0200)]
git-merge-changelog: Fix upstream/downstream heuristic for "git pull".
* lib/git-merge-changelog.c: Suggest to pass %Y as 4th parameter.
Include <errno.h>, spawn-pipe.h, wait-process.h, xvasprintf.h,
c-ctype.h.
(_): New macro.
(execute_and_read_line): New function, from lib/javacomp.c.
(is_all_hex_digits): New function.
(long_options): Moved into 'main'.
(usage): Document the --debug option.
(main): Accept a --debug option and turn on debugging at runtime instead
of compile-time. Accept an optional other_conflict_label parameter.
Improve 'downstream' determination using two heuristics.
* modules/git-merge-changelog (Depends-on): Add spawn-pipe,
wait-process, xvasprintf, c-ctype.
Paul Eggert [Tue, 29 Jul 2025 00:50:30 +0000 (17:50 -0700)]
float-h: change IBM long double to match GCC 15
This is in response to the GCC developers;
see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120993>.
* lib/float.c (gl_LDBL_MAX): Remove the implementation for PowerPC,
as it should no longer be needed.
* lib/float.in.h (LDBL_MIN_EXP, LDBL_MIN_10_EXP, LDBL_MIN)
(LDBL_MAX, LDBL_EPSILON, LDBL_NORM_MAX): On PowerPC with IBM long
double, simplify by using the GCC 15 values unconditionally.
These are the correct values according to the GCC developers
and there seems little point to disagreeing with current GCC
about obsolescent arithmetic that is so problematic in practice.
* tests/test-float-h.c (test_long_double): Relax tests of LDBL_MAX
when !LDBL_IS_IEC_60559, as the tests would now fail on PowerPC and
they were not portable in that case anyway.
Bruno Haible [Wed, 23 Jul 2025 07:12:55 +0000 (09:12 +0200)]
thrd: Avoid conversion between different function pointer types.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-07/msg00170.html>.
* m4/thrd.m4 (gl_FUNC_THRD_JOIN): Define BROKEN_THRD_START_T or
BROKEN_THRD_JOIN. Don't define BROKEN_THRD_START_T_OR_JOIN.
* lib/thrd.c (thrd_main_func): Define with the right return type,
depending on BROKEN_THRD_START_T.
Paul Eggert [Tue, 22 Jul 2025 19:12:22 +0000 (12:12 -0700)]
mkdir-p: ENOENT/ENOTDIR safety and consistency
* lib/mkdir-p.c (make_dir_parents): If mkdir fails with ENOENT or
ENOTDIR, do not attempt anything else since the file does not exist.
Treat ENOENT and ENOTDIR consistently later, too.
Paul Eggert [Tue, 22 Jul 2025 19:09:28 +0000 (12:09 -0700)]
mkdir-p: better diagnostics
Problem reported by Lauri Tirkkonen <https://bugs.gnu.org/79072>.
* lib/mkdir-p.c (make_dir_parents):
If savewd_chdir fails due to anything other than EACCES, do
not attempt to preserve permissions; instead, fail with mkdir’s
errno if nonzero, and with savewd_chdir’s errno otherwise.
stdioext: Port to recent OpenBSD snapshots with an incomplete FILE type.
* lib/fbufmode.c (fbufmode): Check for __OpenBSD__ definition since
__sferror is no longer defined publicly on this platform.
* lib/fflush.c (clear_ungetc_buffer, update_fpos_cache, rpl_fflush):
Likewise.
* lib/fpending.c (__fpending): Likewise.
* lib/fpurge.c (fpurge): Likewise.
* lib/freadable.c (freadable): Likewise.
* lib/freadahead.c (freadahead): Likewise.
* lib/freading.c (freading): Likewise.
* lib/freadptr.c (freadptr): Likewise.
* lib/freadseek.c (freadptrinc): Likewise.
* lib/fseeko.c (fseeko): Likewise.
* lib/fseterr.c (fseterr): Likewise.
* lib/fwritable.c (fwritable): Likewise.
* lib/fwriting.c (fwriting): Likewise.
* lib/stdio-impl.h: Likewise.
(_gl_flags_file_t): Define to 'short'.
(_gl_file_offset_t): Define to 'fpos_t'.
(fp_): Define this macro using the one already written for Android.
(struct __sfileext): Define the same way as Android which does not rely
on a public 'struct __sbuf' definition.
(__SLBF, __SNBF, __SRD, __SWR, __SRW, __SEOF, __SERR, __SOFF): Define
macros to the same value as on Android.
* doc/parse-datetime.texi (General date syntax): Mention that date
syntax should use the Gregorian calendar. Change examples that use %Y
to use LC_ALL=C, so that they work even for users in Thailand, Iran, or
Ethiopia.
Bruno Haible [Tue, 15 Jul 2025 09:19:10 +0000 (11:19 +0200)]
nstrftime: Add support for non-Gregorian calendars.
* lib/calendars.h: New file.
* lib/calendar-thai.h: New file.
* lib/calendar-persian.h: New file.
* lib/calendar-ethiopian.h: New file.
* lib/strftime.h (nstrftime): Document which directives don't work with
non-Gregorian calendars.
* lib/strftime.c (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): New macro.
Include localcharset.h, localename.h, calendars.h.
(CAL_ARGS): New macro.
(my_strftime): Recognize locales with non-Gregorian calendars. Pass cal
and caldate down to __strftime_internal.
(__strftime_internal): Accept additional parameters cal, caldate.
Remove rejection of modifier 'O' for directive 'Y' and allow a non-ASCII
alternate digits base. Produce calendar-aware output for the directives
'b', 'h', 'B', 'x', 'd', 'e', 'm', 'Y'.
* modules/nstrftime (Files): Add the calendar files.
(Depends-on): Add localcharset.
(Link): New section.
* modules/fprintftime (Link): New section.
* tests/test-nstrftime-DE.c: New file.
* tests/test-nstrftime-TH.c: New file.
* tests/test-nstrftime-IR.c: New file.
* tests/test-nstrftime-ET.c: New file.
* modules/nstrftime-tests (Files): Add them.
(Depends-on): Add localcharset, setenv.
(Makefile.am): Link test-nstrftime with $(INTL_MACOSX_LIBS). Arrange to
compile and run test-nstrftime-DE, test-nstrftime-TH, test-nstrftime-IR,
test-nstrftime-ET.
Bruno Haible [Tue, 15 Jul 2025 08:39:37 +0000 (10:39 +0200)]
localename-unsafe: Reduce dependencies.
* lib/localename-unsafe.c: Include windows-mutex.h instead of
glthread/lock.h.
(get_lcid_lock): Change type to glwthread_mutex_t.
(get_lcid): Use glwthread_mutex_* functions.
* modules/localename-unsafe (Depends-on): Add windows-mutex. Remove
lock.
Bruno Haible [Sun, 13 Jul 2025 05:36:50 +0000 (07:36 +0200)]
javacomp-script, javacomp: Remove support for javac versions < 1.8.
* m4/javacomp.m4 (gt_JAVACOMP): State that the minimum source_version
and the minimum target_version are 1.8. Map smaller values to 1.8.
Complain if the java version is < 1.8. Use 1.8 as default, instead of
1.6.
* lib/javacomp.h (compile_java_class): State that the minimum
source_version and the minimum target_version are 1.8.
* lib/javacomp.c (default_target_version): Complain if the java version
is < 1.8. Use 1.8 as default, instead of 1.6.
(SOURCE_VERSION_BOUND, source_version_index): Adjust to the new minimum
source_version = 1.8.
(TARGET_VERSION_BOUND, target_version_index): Adjust to the new minimum
target_version = 1.8.
(get_compiler_version): Update comment.
(is_envjavac_usable, is_javac_usable): Update.
(compile_java_class): Map source_version < 1.8 to 1.8. Map
target_version < 1.8 to 1.8.
Paul Eggert [Sun, 13 Jul 2025 07:43:36 +0000 (00:43 -0700)]
safe-alloc: make obsolete and remove REALLOC_N
Problem reported by Vivien Kraus in:
https://lists.gnu.org/r/bug-gnulib/2025-07/msg00073.html
This module never caught on.
* lib/safe-alloc.h (REALLOC_N): Remove.
* modules/safe-alloc: Now obsolete.
* tests/test-safe-alloc.c (main): Remove REALLOC_N test.
Bruno Haible [Sat, 12 Jul 2025 11:50:24 +0000 (13:50 +0200)]
obstack-printf: Fix memory overrun on glibc systems.
* m4/obstack.m4 (gl_FUNC_OBSTACK): Define through AC_DEFUN_ONCE.
* m4/obstack-printf.m4 (gl_FUNC_OBSTACK_PRINTF): Require
gl_FUNC_OBSTACK. Invoke gl_REPLACE_OBSTACK_PRINTF when using the
'obstack' replacement code.
* doc/regexprops-generic.texi: Re-generate by running the 'regexprops'
binary from GNU findutils:
./regexprops "Regular Expressions" generic
At least the recent(ish) change (efd5c380ff) to regex.h aligning
gnulib with Emacs behavior had made this document out-of-date.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-07/msg00037.html>.
Additionally, today's findutils commit c9c2c51175 fixed the sort order
of the Texinfo nodes.
Paul Eggert [Wed, 9 Jul 2025 00:34:25 +0000 (17:34 -0700)]
float-h: work around GCC bug 120993
Also, fix a too-low LDBL_MAX on this platform, a problem that
contributed to LDBL_NORM_MAX test failures with C23 PowerPC GCC
with ibmlongdouble.
* lib/float.c (gl_LDBL_MAX): On PowerPC with ibmlongdouble, the
correct value is 2**1024 - 2**918, not 2**1024 - 2**971. Also,
use C99 hex double notation for the divisor, as it’s clearer and
should work nowadays.
* lib/float.in.h: Simplify by not worring whether it’s AIX or
GNU/Linux when redefining LDBL_* macros on PowerPC GCC with
ibmlongdouble, as the problem seems to be universal then.
(LDBL_NORM_MAX): On PowerPC GCC with ibmlongdouble, define to be
LDBL_MAX, so that it’s 2**1024 - 2**918, doubling GCC’s value
if supplied.
* modules/float-h-tests (Depends-on): Remove floorl, ldexpl.
Add truncl.
(test_float_h_LDADD): Likewise for libraries.
* tests/test-float-h.c (test_isfinitel): New static function,
so that we need not rely on isfinitel.
(normalize_long_double): Work even if X is negative or not finite.
Do not rely on frexpl or ldexpl. Use truncl instead of floorl
so that the negative results are consistent with positive.
Defend against fritzy PowerPC long double arithmetic.
Paul Eggert [Sun, 6 Jul 2025 23:22:05 +0000 (16:22 -0700)]
float-h: port to C23 PowerPC GCC
* lib/float.in.h (LDBL_MAX) [__LDBL_NORM_MAX__]: Do not override, as
GCC versions defining __LDBL_NORM_MAX__ surely have LDBL_MAX right.
(LDBL_NORM_MAX): Prefer __LDBL_NORM_MAX__ if defined.
Otherwise, hardcode PowerPC value if applicable.
* tests/test-float-h.c (normalize_long_double):
Fix typo that broke this function when given large numbers.
(test_long_double): Normalize LDBL_MAX before comparing it
to LDBL_NORM_MAX.
Paul Eggert [Sun, 6 Jul 2025 19:33:06 +0000 (12:33 -0700)]
float-h-tests: port to C23 PowerPC GCC
Problem reported by C. Neidhal
<https://lists.gnu.org/r/bug-gnulib/2025-07/msg00021.html>.
* modules/float-h-tests (Depends-on): Add floorl, frexpl, ldexpl.
(test_float_h_LDADD): Link the resulting libms too.
* tests/test-float-h.c: Include math.h.
(normalize_long_double): New function.
(test_long_double): Use it.
* lib/strptime.c (LOCALE_PARAM) [_LIBC]: Adjust to match glibc, not
relevant for Gnulib.
(LOCALE_PARAM_PROTO, LOCALE_PARAM_DECL): Remove definitions.
(__strptime_internal, strptime): Convert K&R definition to ANSI C.
Bruno Haible [Sun, 29 Jun 2025 15:45:24 +0000 (17:45 +0200)]
options: Support use in a shared library on mingw.
* lib/options.h (_gl_get_next_option): New declaration.
(get_next_option): On mingw, define in terms of _gl_get_next_option.
* lib/options.c (_gl_get_next_option): On mingw, define this function
instead of get_next_option.
Suggested by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2025-06/msg00310.html>.
* build-aux/gnupload: Remove misleading year comment. Mention that
Slackware requires 'gpg2' instead of 'gpg' instead of Ubuntu where they
are now the same.
Paul Eggert [Sat, 28 Jun 2025 01:56:28 +0000 (18:56 -0700)]
_Noreturn: pacify gcc -std=gnu99 -Wpedantic
Problem reported by Helmut Eller <https://bugs.gnu.org/78903>.
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY): Prefer __attribute__
((__noreturn__)) to _Noreturn if __STDC_VERSION__ < 201112, to
pacify gcc -std=gnu99 -Wpedantic. Simplify. Do not bother
suggesting -D_GL_WORK_AROUND_LLVM_BUG_59792; suggest the
equivalent -D_Noreturn= instead, and remove the test on
_GL_WORK_AROUND_LLVM_BUG_59792.
Paul Eggert [Thu, 26 Jun 2025 17:54:14 +0000 (10:54 -0700)]
regex: fix parse_bracket_exp double-free
Problem reported by Anastasia Belova in:
https://sourceware.org/pipermail/libc-alpha/2025-June/168231.html
* lib/regcomp.c (parse_bracket_exp): Avoid double-free
when storage allocation fails in create_token_tree.