]> Savannah Git Hosting - gnulib.git/log
gnulib.git
23 months agoerror: Avoid implicit-fallthrough warnings with -O0 (regr. 2023-05-30).
Bruno Haible [Fri, 2 Jun 2023 18:02:45 +0000 (20:02 +0200)]
error: Avoid implicit-fallthrough warnings with -O0 (regr. 2023-05-30).

* lib/error.in.h (__gl_error_call): Parenthesize status. When not
optimizing, expand to code without compound statements.

23 months agogetprogname: Add support for ASCII-compatible environments in z/OS.
Bruno Haible [Thu, 1 Jun 2023 14:18:02 +0000 (16:18 +0200)]
getprogname: Add support for ASCII-compatible environments in z/OS.

Reported by Mike Fulton <mikefultonpersonal@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00198.html>.

* lib/getprogname.c (getprogname): On z/OS, when compiling for an
ASCII-compatible environment, convert the result from EBCDIC to ASCII.

23 months agognulib-tool.py: Fix a format string mistake.
Mitch Capper [Thu, 1 Jun 2023 13:50:56 +0000 (15:50 +0200)]
gnulib-tool.py: Fix a format string mistake.

* pygnulib/GLImport.py (GLImport.execute): Fix a typo in a format
string.

Copyright-paperwork-exempt: Yes

23 months agoAdd info for maintainers and contributors.
Bruno Haible [Thu, 1 Jun 2023 13:11:35 +0000 (15:11 +0200)]
Add info for maintainers and contributors.

* HACKING: New file.

23 months agoreadline: fix memory leak in replacement readline.
Nick Bowler [Wed, 31 May 2023 01:26:19 +0000 (21:26 -0400)]
readline: fix memory leak in replacement readline.

* lib/readline.c (readline): Free memory after getline failure.
Copyright-paperwork-exempt: true

23 months agoerror: fix typo in previous patch
Paul Eggert [Tue, 30 May 2023 22:12:43 +0000 (15:12 -0700)]
error: fix typo in previous patch

* lib/error.in.h (error): Fix __VA_ARGS__ typo noted by
Bruno Haible.

23 months agoerror: don’t call ‘exit’
Paul Eggert [Tue, 30 May 2023 21:38:41 +0000 (14:38 -0700)]
error: don’t call ‘exit’

Let the underlying functions call ‘exit’, instead of having the
Gnulib replacement macros do it.  Use ‘unreachable’ to tell the
compiler that those functions exit when the status is nonzero.
This saves a function call.
* lib/error.in.h: Include stddef.h, not stdlib.h.
(__gl_error_call): Rely on the function to exit, using
‘unreachable’ to tell the compiler that the function does not return.
* modules/error (Depends-on): Add stddef.

23 months agoerror: don’t evaluate status arg twice
Paul Eggert [Tue, 30 May 2023 19:49:20 +0000 (12:49 -0700)]
error: don’t evaluate status arg twice

This avoids potential issues if the first argument has a side effect.
* lib/error.in.h (__gl_error_call): New macro, which evaluates its
status arg only once, by using a statement expression if GNU C -
the only platform we need to worry about pacifying - and by simply
calling ‘error’ otherwise.
(error, error_at_line): Use it.

23 months agowarnings, manywarnings: Assume autoconf >= 2.64.
Bruno Haible [Sun, 28 May 2023 17:00:34 +0000 (19:00 +0200)]
warnings, manywarnings: Assume autoconf >= 2.64.

* m4/warnings.m4 (gl_AS_VAR_APPEND): Remove macro.
(gl_COMPILER_OPTION_IF, gl_WARN_ADD): Use AS_VAR_APPEND instead of
gl_AS_VAR_APPEND.
* m4/manywarnings.m4: Likewise.

23 months agofile-has-acl: avoid warning from bleeding-edge GCC
Jim Meyering [Sun, 28 May 2023 16:41:08 +0000 (09:41 -0700)]
file-has-acl: avoid warning from bleeding-edge GCC

* lib/file-has-acl.c: Include attribute.h.
(have_xattr): Declare with ATTRIBUTE_PURE,
to avoid new warning from GCC14-to-be.
* modules/file-has-acl (Depends-on): Add attribute.
Spotted while building coreutils with this:
gcc version 14.0.0 20230526 (experimental)

23 months agoerror: Avoid -Wint-in-bool-context warning.
Bruno Haible [Sun, 28 May 2023 13:18:06 +0000 (15:18 +0200)]
error: Avoid -Wint-in-bool-context warning.

Reported by Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00178.html>.

* lib/error.in.h (error, error_at_line): Use 'status != 0', since status
is expected to be an int, not a bool value.

23 months agoerror: Support the compiler's control flow analysis better.
Bruno Haible [Sat, 27 May 2023 20:39:59 +0000 (22:39 +0200)]
error: Support the compiler's control flow analysis better.

* lib/error.in.h: Remove @PRAGMA_SYSTEM_HEADER@. Include <stdlib.h>.
(error): Define as a macro that explicitly invokes exit().
(error_at_line): Likewise.
* lib/error.c (_GL_NO_INLINE_ERROR): Define before including error.h.
* modules/error-h (configure.ac): Don't invoke gl_CONDITIONAL_HEADER.
(Makefile.am): Generate error.h always. Don't substitute
PRAGMA_SYSTEM_HEADER.
* m4/error_h.m4 (gl_ERROR_H): Set COMPILE_ERROR_C instead of
GL_GENERATE_ERROR_H.
* modules/error (configure.ac, Depends-on): Test COMPILE_ERROR_C instead
of GL_GENERATE_ERROR_H.
* lib/copy-file.c: Revert the last change.

23 months agoflexmember: Make it easier to use.
Bruno Haible [Fri, 26 May 2023 22:18:57 +0000 (00:18 +0200)]
flexmember: Make it easier to use.

* lib/flexmember.h (FLEXNSIZEOF): New macro.
* lib/hamt.c (alloc_bucket, alloc_subtrie): Fix FLEXSIZEOF invocation.
Use FLEXNSIZEOF instead of FLEXSIZEOF.
* lib/ssfmalloc.h (init_small_block_page_pool): Use FLEXNSIZEOF instead
of FLEXSIZEOF.

23 months agodiffseq: Silence another gcc warning.
Bruno Haible [Fri, 26 May 2023 19:37:42 +0000 (21:37 +0200)]
diffseq: Silence another gcc warning.

* lib/diffseq.h (compareseq): Move into the scope of the '#pragma GCC
diagnostic'.

23 months agocopy-file: Silence gcc warnings.
Bruno Haible [Fri, 26 May 2023 17:27:09 +0000 (19:27 +0200)]
copy-file: Silence gcc warnings.

* lib/copy-file.c: Add #pragma GCC diagnostic.

23 months agodiffseq: Silence gcc warning.
Bruno Haible [Fri, 26 May 2023 12:39:01 +0000 (14:39 +0200)]
diffseq: Silence gcc warning.

* lib/diffseq.h: Add #pragma GCC diagnostic.

23 months agomanywarnings: speed up nomfi test
Paul Eggert [Wed, 24 May 2023 17:10:18 +0000 (10:10 -0700)]
manywarnings: speed up nomfi test

* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Simplify and speed up
on current platforms, by seeing first whether
-Wno-missing-field-initializers is needed (it isn’t), so that
later we don’t need to determine whether it’s supported.

23 months agoSimplify -Wno-missing-field-initializers checking
Paul Eggert [Wed, 24 May 2023 16:23:01 +0000 (09:23 -0700)]
Simplify -Wno-missing-field-initializers checking

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Don’t worry about
-Wmissing-field-initializers, as this is no longer needed now that
gl_MANYWARN_ALL_GCC is fixed.

23 months agomanywarnings: port better to GCC 11.2 and earlier
Paul Eggert [Wed, 24 May 2023 16:20:48 +0000 (09:20 -0700)]
manywarnings: port better to GCC 11.2 and earlier

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-diffutils/2023-05/msg00015.html
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Also test for GCC bug 82283
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283>.

23 months agoasyncsafe-spin, simple-atomic: Don't use -mcpu-v9 on NetBSD/sparc.
Bruno Haible [Wed, 24 May 2023 08:17:30 +0000 (10:17 +0200)]
asyncsafe-spin, simple-atomic: Don't use -mcpu-v9 on NetBSD/sparc.

Reported by Brandon Applegate in
<https://lists.gnu.org/archive/html/bug-gettext/2023-05/msg00042.html>.

* lib/asyncsafe-spin.c: Limit the SPARC workaround to Solaris.
* lib/simple-atomic.c: Likewise.
* m4/sparcv8+.m4 (gl_SPARC_V8PLUS): Likewise.

23 months agonstrftime: wmemmove → __wmemmove in glibc part
Paul Eggert [Tue, 23 May 2023 19:56:40 +0000 (12:56 -0700)]
nstrftime: wmemmove → __wmemmove in glibc part

https://sourceware.org/pipermail/libc-alpha/2023-May/148435.html
* lib/nstrftime.c (__strftime_internal) [COMPILE_WIDE]:
Use __wmemmove, not wmemmove, to keep in better sync with draft glibc.

23 months agogit-merge-changelog: Code style changes.
Bruno Haible [Mon, 22 May 2023 12:32:42 +0000 (14:32 +0200)]
git-merge-changelog: Code style changes.

* lib/git-merge-changelog.c: Don't make side effects to variables
inside parenthesized expressions. Write (size_t)(-1), for consistency
with gl_list.h.
(compute_mapping): Rename variable in2 to jrev.

23 months agostrtol: match 'configure' to 'make check'
Paul Eggert [Mon, 22 May 2023 01:25:45 +0000 (18:25 -0700)]
strtol: match 'configure' to 'make check'

Inferred from report by Tomasz Kłoczko <https://bugs.gnu.org/63632>.
* m4/strtol.m4 (gl_FUNC_STRTOL):
* m4/strtoll.m4 (gl_FUNC_STRTOLL):
Also test "0b", since the test cases check it.

23 months agogit-merge-changelog: port to size_t padding
Paul Eggert [Sun, 21 May 2023 20:45:12 +0000 (13:45 -0700)]
git-merge-changelog: port to size_t padding

* lib/git-merge-changelog (entry_hashcode):
As a nicety, Prefer SIZE_WIDTH to computing it ourselves.

23 months agogit-merge-changelog: prefer idx_t
Paul Eggert [Sun, 21 May 2023 20:25:25 +0000 (13:25 -0700)]
git-merge-changelog: prefer idx_t

* lib/git-merge-changelog.c: Include idx.h.
(struct entry, entry_create, entry_hashcode)
(struct changelog_file, read_changelog_file)
(entries_mapping_get, entries_mapping_reverse_get)
(compute_mapping, struct edit, struct differences)
(compute_differences, find_paragraph_end)
(try_split_merged_entry, struct conflict, conflict_write, main):
Prefer idx_t to ptrdiff_t and size_t when the value is a
nonnegative index or size.  Change a few for-loops so that
the index never goes negative.
* modules/git-merge-changelog (Depends-on): Add idx.

23 months agogit-merge-changelog: ssize_t → ptrdiff_t
Paul Eggert [Sun, 21 May 2023 20:05:30 +0000 (13:05 -0700)]
git-merge-changelog: ssize_t → ptrdiff_t

Prefer ptrdiff_t to ssize_t, as per
<https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00019.html>.
* lib/git-merge-changelog.c (struct entries_mapping)
(entries_mapping_get, entries_mapping_reverse_get)
(compute_mapping, struct edit, struct differences, OFFSET)
(OFFSET_MAX, EXTRA_CONTEXT_FIELDS, compute_differences, main):
Use ptrdiff_t, not ssize_t.
* modules/git-merge-changelog (Depends-on): Add stdint for PTRDIFF_MAX.

23 months agogit-merge-changelog: port to ssize_t padding
Paul Eggert [Sun, 21 May 2023 18:38:50 +0000 (11:38 -0700)]
git-merge-changelog: port to ssize_t padding

* lib/git-merge-changelog.c (OFFSET_MAX): New macro, as a nicety.

23 months agolimits-h tests: Check the value of SSIZE_MAX.
Bruno Haible [Sun, 21 May 2023 12:42:27 +0000 (14:42 +0200)]
limits-h tests: Check the value of SSIZE_MAX.

* tests/test-limits-h.c (limits12): New variable.
Include <sys/types.h> and check the value of SSIZE_MAX.
* modules/limits-h-tests (Depends-on): Add sys_types.

23 months agossize_t: Fix replacement on 64-bit Windows.
Bruno Haible [Sun, 21 May 2023 12:40:04 +0000 (14:40 +0200)]
ssize_t: Fix replacement on 64-bit Windows.

* m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Use prefix 'gl_' instead of 'gt_'.
Define ssize_t to 'long long' or 'long', depending on the width of
'size_t'.

23 months agoregex: use limits-h SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 22:24:05 +0000 (15:24 -0700)]
regex: use limits-h SSIZE_MAX

23 months agogetndelim2: use limits-h SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 22:23:16 +0000 (15:23 -0700)]
getndelim2: use limits-h SSIZE_MAX

23 months agogetdelim: use limits-h SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 22:22:32 +0000 (15:22 -0700)]
getdelim: use limits-h SSIZE_MAX

23 months agocareadlinkat: use limits-h SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 22:21:40 +0000 (15:21 -0700)]
careadlinkat: use limits-h SSIZE_MAX

This also adds a dependency of relocatable-prog-wrapper on
limits-h, since relocatable-prog-wrapper also contains
lib/careadlinkat.c.

23 months agoareadlinkat-with-size: use limits-h SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 22:20:14 +0000 (15:20 -0700)]
areadlinkat-with-size: use limits-h SSIZE_MAX

23 months agolimits-h: other modules can rely on SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 20:48:00 +0000 (13:48 -0700)]
limits-h: other modules can rely on SSIZE_MAX

* lib/areadlink-with-size.c (SSIZE_MAX):
Do not define.
* modules/areadlink-with-size (Depends-on):
Add limits-h.

23 months agolimits-h: define SSIZE_MAX
Paul Eggert [Sat, 20 May 2023 20:46:19 +0000 (13:46 -0700)]
limits-h: define SSIZE_MAX

* doc/posix-headers/limits.texi (limits.h): Document this.
* lib/limits.in.h (SSIZE_MAX): Define if not already defined.
* m4/limits-h.m4 (gl_LIMITS_H): Also generate limits.h
if <limits.h> does not define SSIZE_MAX.

23 months agodiffseq: backward compatibility for OFFSET_MAX
Paul Eggert [Sat, 20 May 2023 19:11:54 +0000 (12:11 -0700)]
diffseq: backward compatibility for OFFSET_MAX

* lib/diffseq.h (OFFSET_MAX): Define only if not already defined.

23 months agocareadlinkat: Silence gcc warning for GCC ≥ 12.
Bruno Haible [Fri, 19 May 2023 21:55:34 +0000 (23:55 +0200)]
careadlinkat: Silence gcc warning for GCC ≥ 12.

* lib/careadlinkat.c: For GCC 12 or newer, use
"#pragma GCC diagnostic ignored" to silence the warning.

23 months agomodechange: pacify gcc -Wsuggest-attribute=pure
Pádraig Brady [Fri, 19 May 2023 09:34:44 +0000 (10:34 +0100)]
modechange: pacify gcc -Wsuggest-attribute=pure

* lib/modechange.h (mode_adjust): Add _GL_ATTRIBUTE_PURE
suggested with GCC 12 with -flto.

23 months agodiffseq: don’t assume integers lack padding
Paul Eggert [Fri, 19 May 2023 15:57:29 +0000 (08:57 -0700)]
diffseq: don’t assume integers lack padding

* NEWS: Mention this.
* lib/diffseq.h (OFFSET_MAX): Don’t define;
this is now the user’s responsibility.
* lib/fstrcmp.c (OFFSET_MAX): Define to PTRDIFF_MAX.

23 months agogetndelim2: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 22:45:50 +0000 (00:45 +0200)]
getndelim2: Silence gcc warning.

* lib/getndelim2.c: Add #pragma GCC diagnostic.
(IF_LINT): Remove macro.
(getndelim2): Remove use of IF_LINT.

23 months agocanonicalize: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 22:45:46 +0000 (00:45 +0200)]
canonicalize: Silence gcc warning.

* lib/canonicalize.c: Add #pragma GCC diagnostic.
(IF_LINT): Remove macro.
(canonicalize_filename_mode_stk): Remove use of IF_LINT.

23 months agovasnprintf, c-vasnprintf: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:58:23 +0000 (22:58 +0200)]
vasnprintf, c-vasnprintf: Silence gcc warning.

* lib/vasnprintf.c: Add #pragma GCC diagnostic.

23 months agonstrftime: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:46:47 +0000 (22:46 +0200)]
nstrftime: Silence gcc warning.

* lib/nstrftime.c: Add #pragma GCC diagnostic.

23 months agoastrxfrm: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:37:20 +0000 (22:37 +0200)]
astrxfrm: Silence gcc warning.

* lib/astrxfrm.c: Add #pragma GCC diagnostic.

23 months agovasnprintf, c-vasnprintf: Silence gcc warnings.
Bruno Haible [Thu, 18 May 2023 20:51:17 +0000 (22:51 +0200)]
vasnprintf, c-vasnprintf: Silence gcc warnings.

* lib/vasnprintf.c (scale10_round_decimal_decoded): Remove memory==NULL
test.
(scale10_round_decimal_long_double, scale10_round_decimal_double): Test
for memory==NULL here. Remove use of IF_LINT.

23 months agobitset: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:40:12 +0000 (22:40 +0200)]
bitset: Silence gcc warning.

* lib/bitset/list.c (lbitset_copy_): Remove redundant test from the
loop's first iteration.

23 months agostack: Silence gcc warning in tests.
Bruno Haible [Thu, 18 May 2023 20:48:54 +0000 (22:48 +0200)]
stack: Silence gcc warning in tests.

* lib/stack.h (init, destroy, empty, current_base, push, pop, discard,
top, size): Mark as possibly unused.

23 months agohamt: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:45:45 +0000 (22:45 +0200)]
hamt: Silence gcc warning.

* lib/hamt.c (init_element): Mark as possibly unused.

23 months agoget-rusage-data: Silence gcc warning.
Bruno Haible [Thu, 18 May 2023 20:43:14 +0000 (22:43 +0200)]
get-rusage-data: Silence gcc warning.

* lib/get-rusage-data.c (get_rusage_data_via_iterator): Mark as possibly
unused.

23 months agoastrxfrm: Fix use-after-free bug.
Bruno Haible [Thu, 18 May 2023 16:01:06 +0000 (18:01 +0200)]
astrxfrm: Fix use-after-free bug.

* lib/astrxfrm.c (astrxfrm): Don't use memcpy after realloc succeeded.

23 months agognulib-tool: Ignore .orig and .rej files under modules/.
Bruno Haible [Thu, 18 May 2023 20:38:30 +0000 (22:38 +0200)]
gnulib-tool: Ignore .orig and .rej files under modules/.

23 months agognulib-tool: Ignore .orig and .rej files under modules/.
Bruno Haible [Thu, 18 May 2023 14:03:00 +0000 (16:03 +0200)]
gnulib-tool: Ignore .orig and .rej files under modules/.

* gnulib-tool (func_sanitize_modulelist): Exclude also files whose name
ends in .orig or .rej.
* pygnulib/GLModuleSystem.py (GLModuleSystem.file_is_module): Likewise.

23 months agouchar: Fix error when <uchar.h> is included twice.
Bruno Haible [Thu, 18 May 2023 13:39:19 +0000 (15:39 +0200)]
uchar: Fix error when <uchar.h> is included twice.

* lib/uchar.in.h: Fix double-inclusion guard.

23 months agostdckdint: use in parse-datetime
Paul Eggert [Wed, 17 May 2023 19:38:28 +0000 (12:38 -0700)]
stdckdint: use in parse-datetime

* lib/parse-datetime.y (apply_relative_time, zone, date)
(iso_8601_date, relunit, relunit_snumber, time_zone_hhmm)
(to_tm_year, yylex, parse_datetime_body):
Prefer ckd_add to INT_ADD_WRAPV etc., and include stdckdint.h.
* modules/parse-datetime (Depends-on): Add stdckdint.

23 months agostdckdint: use in more modules
Paul Eggert [Wed, 17 May 2023 19:24:07 +0000 (12:24 -0700)]
stdckdint: use in more modules

* lib/nstrftime.c (__strftime_internal):
* lib/timespec-add.c (timespec_add):
* lib/timespec-sub.c (timespec_sub):
* lib/xstrtol.c (bkm_scale):
Prefer ckd_add to INT_ADD_WRAPV etc., and include stdckdint.h.
* modules/nstrftime, modules/timespec-add, modules/timespec-sub:
* modules/xstrtol:
(Depends-on): Add stdckdint.

23 months agonstrftime: suggest to glibc how to avoid alloca
Paul Eggert [Wed, 17 May 2023 17:27:40 +0000 (10:27 -0700)]
nstrftime: suggest to glibc how to avoid alloca

* lib/nstrftime.c (widen) [COMPILE_WIDE]: Remove.
(__strftime_internal) [COMPILE_WIDE): Instead of converting the
multibyte time zone abbreviation into a potentially unbounded
alloca buffer, convert it directly into the output buffer.
Although this code is not used in Gnulib, this can help the glibc
developers avoid the problem on the glibc side.

23 months agodoc: New chapter "Strings and Characters".
Bruno Haible [Tue, 16 May 2023 00:02:13 +0000 (02:02 +0200)]
doc: New chapter "Strings and Characters".

* doc/strings.texi: New file.
* doc/gnulib.texi (POSIXURL): New variable.
(posixheader, posixfunc, func): New macros, from GNU libunistring's
documentation.
Include strings.texi.
(Particular Modules): Don't include c-locale.texi here.
* doc/c-locale.texi: Sections become subsections, subsections become
subsubsections.
* doc/posix-functions/isalnum.texi: Mention c32isalnum.
* doc/posix-functions/isalpha.texi: Mention c32isalpha.
* doc/posix-functions/isblank.texi: Mention c32isblank.
* doc/posix-functions/iscntrl.texi: Mention c32iscntrl.
* doc/posix-functions/isdigit.texi: Mention c32isdigit.
* doc/posix-functions/isgraph.texi: Mention c32isgraph.
* doc/posix-functions/islower.texi: Mention c32islower.
* doc/posix-functions/isprint.texi: Mention c32isprint.
* doc/posix-functions/ispunct.texi: Mention c32ispunct.
* doc/posix-functions/isspace.texi: Mention c32isspace.
* doc/posix-functions/isupper.texi: Mention c32isupper.
* doc/posix-functions/isxdigit.texi: Mention c32isxdigit.
* doc/posix-functions/tolower.texi: Mention alternative APIs.
* doc/posix-functions/toupper.texi: Likewise.
* doc/posix-functions/towlower.texi: Mention c32tolower.
* doc/posix-functions/towupper.texi: Mention c32toupper.
* doc/posix-functions/wcswidth.texi: Mention c32swidth.
* doc/posix-functions/wcwidth.texi: Mention c32width.

23 months agosigsegv: Add tentative support for Hurd/x86_64.
Bruno Haible [Mon, 15 May 2023 16:33:47 +0000 (18:33 +0200)]
sigsegv: Add tentative support for Hurd/x86_64.

Based on explanations by Sergey Bugaev <bugaevc@gmail.com>.

* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386-old.h.

23 months agofile-has-acl: improve port to Fedora 39
Paul Eggert [Mon, 15 May 2023 15:40:27 +0000 (08:40 -0700)]
file-has-acl: improve port to Fedora 39

Problem reported by Ondrej Valousek in:
https://lists.gnu.org/r/bug-gnulib/2023-05/msg00078.html
* lib/file-has-acl.c: Include minmax.h.
[USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR]: Include stdckdint.h.
(file_has_acl) [USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR]:
If the file has NFSv4 ACLs, ignore any POSIX ACLs, for Fedora 39.
Return a bit faster when listxattr returns 0.
Don’t loop forever if an attacker is fiddling with ACLs.
* modules/file-has-acl (Depends-on): Add minmax, stdckdint.

23 months agoWork around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283 .
Bruno Haible [Mon, 15 May 2023 12:56:52 +0000 (14:56 +0200)]
Work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283 .

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

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Add
-Wno-missing-field-initializers for GCC < 11.

23 months agogettimeofday, pthread-*, thread, thrd: Don't omit intended initializers.
Bruno Haible [Mon, 15 May 2023 12:36:17 +0000 (14:36 +0200)]
gettimeofday, pthread-*, thread, thrd: Don't omit intended initializers.

* lib/gettimeofday.c (gettimeofday): List the initializers of both
tv_sec and tv_usec.
* lib/glthread/thread.c (gl_thread_self): List the initializers of both
tv_sec and tv_nsec.
* lib/pthread-cond.c (pthread_cond_wait): Likewise.
* lib/thrd.c (rpl_thrd_current): Likewise.
* lib/pthread-rwlock.c (MIN): New macro.
(pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): List the
initializers of both tv_sec and tv_nsec. Don't modify the duration after
having initialized it.
* lib/pthread_mutex_timedlock.c (MIN): New macro.
(pthread_mutex_timedlock): List the initializers of both tv_sec and
tv_nsec. Don't modify the duration after having initialized it.

23 months agoselect: Fix compilation error (regression from yesterday).
Bruno Haible [Mon, 15 May 2023 09:19:16 +0000 (11:19 +0200)]
select: Fix compilation error (regression from yesterday).

* lib/select.c (rpl_select): Revert last change.

23 months agopoll: Fix syntax error (regression from yesterday).
Bruno Haible [Mon, 15 May 2023 09:13:08 +0000 (11:13 +0200)]
poll: Fix syntax error (regression from yesterday).

* lib/poll.c (poll): Remove semicolon inside braces.

23 months agotimespec: fill in other members
Paul Eggert [Mon, 15 May 2023 06:27:51 +0000 (23:27 -0700)]
timespec: fill in other members

This problem was found when compiling GNU Emacs with
--enable-gcc-warnings on a platform where tv_sec is 64 bits and
tv_nsec is 32 bits, and struct timespec has padding.  GCC
-Wuse-of-uninitialized-value complained when a struct timespec
initialized only via assigning to tv_sec and tv_nsec was copied
via assignment (this was in lib/timespec.h’s make_timespec).
Although behavior is well-defined on this platform, the warning is
annoying and the behavior might not be well-defined on theoretical
platforms where struct timespec has other members.  To work around
this, initialize all the struct’s members.
* lib/getsockopt.c (rpl_getsockopt):
* lib/gettime.c (gettime):
* lib/gettimeofday.c (gettimeofday):
* lib/glthread/thread.c (gl_thread_self):
* lib/nanosleep.c (nanosleep):
* lib/parse-datetime.y (digits_to_date_time, set_hhmmss)
(signed_seconds, unsigned_seconds, yylex, parse_datetime_body):
* lib/poll.c (poll):
* lib/pselect.c (pselect):
* lib/pthread-cond.c (endlessly, pthread_cond_timedwait):
* lib/pthread-rwlock.c (pthread_rwlock_timedrdlock)
(pthread_rwlock_timedwrlock):
* lib/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
* lib/select.c (rpl_select):
* lib/settime.c (settime):
* lib/stat-time.h (get_stat_atime, get_stat_ctime)
(get_stat_mtime, get_stat_birthtime):
* lib/thrd.c (rpl_thrd_current):
* lib/timespec.h (make_timespec):
* lib/timespec_getres.c (timespec_getres):
* lib/utimecmp.c (utimecmpat):
* lib/utimens.c (fdutimens):
When filling in a struct timespec or similar time-related structure
that might be copied elsewhere, also assign to any storage other
than tv_sec and tv_nsec, to avoid undefined behavior on (likely
theoretical) platforms where struct timespec has other members,
and also to avoid warnings from GCC and/or valgrind.

23 months agoyear2038-recommended: Improve failure diagnostic.
Paul Eggert [Sun, 14 May 2023 10:17:46 +0000 (12:17 +0200)]
year2038-recommended: Improve failure diagnostic.

* m4/largefile.m4 (AC_SYS_YEAR2038_RECOMMENDED): Sync from Autoconf.

23 months agostdio: use _GL_ATTRIBUTE_MALLOC
Paul Eggert [Sun, 14 May 2023 04:47:10 +0000 (21:47 -0700)]
stdio: use _GL_ATTRIBUTE_MALLOC

* lib/stdio.in.h (fdopen, fopen, popen, tmpfile): Declare with
_GL_ATTRIBUTE_MALLOC, for consistency with glibc, and so that
building the fopen module with ‘gcc -O2 -Wsuggest-attribute=malloc
-Wsystem-headers -Werror’ does not fail with “stdio.h: In function
‘rpl_fopen’: stdio.h:970:1: error: function might be candidate for
attribute ‘malloc’ [-Werror=suggest-attribute=malloc]”, a problem
I noticed on both Fedora 38 and Ubuntu 23.04.

sigsegv: Add tentative support for Hurd/x86_64.  Reported by
Samuel Thibault <samuel.thibault@ens-lyon.org>.

23 months agosigsegv: Add tentative support for Hurd/x86_64.
Bruno Haible [Fri, 12 May 2023 19:28:47 +0000 (21:28 +0200)]
sigsegv: Add tentative support for Hurd/x86_64.

Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.

* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

23 months agofile-has-acl: don’t access freed storage
Paul Eggert [Fri, 12 May 2023 19:23:49 +0000 (12:23 -0700)]
file-has-acl: don’t access freed storage

Fix typo in previous patch, by not accessing freed storage
in the unusual case where the statck buffer is not large enough.

23 months agofile-has-acl: port to Fedora 39
Paul Eggert [Fri, 12 May 2023 18:56:17 +0000 (11:56 -0700)]
file-has-acl: port to Fedora 39

Fedora 39 getxattr with XATTR_NAME_POSIX_ACL_ACCESS either
succeeds or fails with ENODATA, so it is no longer possible to
detect from its failure that the filesystem might support NFSv4 ACLs.
Problem reported by Ondrej Valousek in:
https://lists.gnu.org/r/bug-gnulib/2023-04/msg00228.html
Instead, use listxattr to determine whether NFSv4 ACLs are in play.
This typically saves syscalls anyway.
* lib/file-has-acl.c: In #if, use (HAVE_LINUX_XATTR_H &&
HAVE_LISTXATTR) instead of GETXATTR_WITH_POSIX_ACLS.
The following changes apply when (USE_ACL && HAVE_LINUX_XATTR_H &&
HAVE_LISTXATTR):
Include minmax.h.
(have_xattr): New function.
(file_has_acl): Try listxattr first; typically this means we need
to do no other syscall.  Call getxattr only if there are NFSv4
ACLs but not POSIX ACLs.
* m4/acl.m4 (gl_FILE_HAS_ACL): Simplify by merely testing for
linux/xattr.h and listxattr.  All uses changed.

23 months agobootstrap: spelling/grammar fix in comment
Josh Soref [Wed, 10 May 2023 20:17:45 +0000 (13:17 -0700)]
bootstrap: spelling/grammar fix in comment

* build-aux/bootstrap: As above.

23 months agoWarn against bogus TZ settings
Paul Eggert [Sun, 7 May 2023 16:28:57 +0000 (09:28 -0700)]
Warn against bogus TZ settings

* doc/parse-datetime.texi (Specifying time zone rules):
Warn against TZ="UTC=5".

2 years agodirfd: Add tests.
Bruno Haible [Fri, 5 May 2023 10:07:22 +0000 (12:07 +0200)]
dirfd: Add tests.

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

2 years agodirfd: Fix bogus override (regression 2023-04-26).
Bruno Haible [Fri, 5 May 2023 10:02:49 +0000 (12:02 +0200)]
dirfd: Fix bogus override (regression 2023-04-26).

Reported by Bjarni Ingi Gislason <bjarniig@simnet.is> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00040.html>.

* m4/dirfd.m4 (gl_FUNC_DIRFD): Fix mistake in last change.

2 years agoc32swidth: Add tests.
Bruno Haible [Thu, 4 May 2023 21:27:16 +0000 (23:27 +0200)]
c32swidth: Add tests.

* tests/test-c32swidth.c: New file, based on tests/test-c32width.c.
* modules/c32swidth-tests: New file.

2 years agoc32swidth: New module.
Bruno Haible [Thu, 4 May 2023 21:27:12 +0000 (23:27 +0200)]
c32swidth: New module.

* lib/uchar.in.h (c32swidth): New declaration.
* lib/wcswidth-impl.h: Use macros FUNC, UNIT, CHARACTER_WIDTH.
* lib/wcswidth.c: Define FUNC, UNIT, CHARACTER_WIDTH before including
wcswidth-impl.h.
* lib/c32swidth.c: New file.
* modules/c32swidth: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32SWIDTH.
* modules/uchar (Makefile.am): Substitute GNULIB_C32SWIDTH.

2 years agowcswidth: Fix result in case of overflow.
Bruno Haible [Thu, 4 May 2023 21:22:14 +0000 (23:22 +0200)]
wcswidth: Fix result in case of overflow.

* lib/wcswidth-impl.h (wcswidth): Continue searching for a non-printing
wide character after the total width has become > INT_MAX.

2 years agowcswidth: Relax license.
Bruno Haible [Thu, 4 May 2023 21:13:27 +0000 (23:13 +0200)]
wcswidth: Relax license.

* modules/wcswidth (License): Change to LGPLv2+.
* lib/wcswidth.c: Update license notice.
* lib/wcswidth-impl.h: Likewise.

2 years agoc32width: Relax license.
Bruno Haible [Thu, 4 May 2023 21:13:22 +0000 (23:13 +0200)]
c32width: Relax license.

* modules/c32width (License): Change to LGPLv2+.
* lib/c32width.c: Update license notice.

2 years agoc32to*: Relax license.
Bruno Haible [Thu, 4 May 2023 21:13:01 +0000 (23:13 +0200)]
c32to*: Relax license.

* modules/c32tolower (License): Change to LGPLv2+.
* modules/c32toupper (License): Likewise.
* lib/c32tolower.c: Update license notice.
* lib/c32toupper.c: Likewise.
* lib/c32to-impl.h: Likewise.

2 years agounicase/tolower, unicase/toupper: Relax license.
Bruno Haible [Thu, 4 May 2023 21:12:42 +0000 (23:12 +0200)]
unicase/tolower, unicase/toupper: Relax license.

* lib/gen-uni-tables.c (output_simple_mapping): Bump copyright year. For
unicase/tolower.h and unicase/toupper.h, use the LGPLv2+.
* lib/unicase/tolower.h: Regenerated.
* lib/unicase/toupper.h: Likewise.
* lib/unicase/simple-mapping.h: Update license notice.
* lib/unicase/tolower.c: Likewise.
* lib/unicase/toupper.c: Likewise.
* modules/unicase/tolower (License): Change to LGPLv2+.
* modules/unicase/toupper (License): Likewise.

2 years agounicase/base: Relax license.
Bruno Haible [Thu, 4 May 2023 21:12:37 +0000 (23:12 +0200)]
unicase/base: Relax license.

* modules/unicase/base (License): Change to LGPLv2+.
* lib/unicase.in.h: Update license notice.

2 years agoc32is*: Relax license.
Bruno Haible [Thu, 4 May 2023 21:11:59 +0000 (23:11 +0200)]
c32is*: Relax license.

* modules/c32isalnum (License): Change to LGPLv2+.
* modules/c32isalpha (License): Likewise.
* modules/c32isblank (License): Likewise.
* modules/c32iscntrl (License): Likewise.
* modules/c32isdigit (License): Likewise.
* modules/c32isgraph (License): Likewise.
* modules/c32islower (License): Likewise.
* modules/c32isprint (License): Likewise.
* modules/c32ispunct (License): Likewise.
* modules/c32isspace (License): Likewise.
* modules/c32isupper (License): Likewise.
* modules/c32isxdigit (License): Likewise.
* lib/c32isalnum.c: Update license notice.
* lib/c32isalpha.c: Likewise.
* lib/c32isblank.c: Likewise.
* lib/c32iscntrl.c: Likewise.
* lib/c32isdigit.c: Likewise.
* lib/c32isgraph.c: Likewise.
* lib/c32islower.c: Likewise.
* lib/c32isprint.c: Likewise.
* lib/c32ispunct.c: Likewise.
* lib/c32isspace.c: Likewise.
* lib/c32isupper.c: Likewise.
* lib/c32isxdigit.c: Likewise.
* lib/c32is-impl.h: Likewise.

2 years agounictype/ctype-*: Relax license.
Bruno Haible [Thu, 4 May 2023 21:11:54 +0000 (23:11 +0200)]
unictype/ctype-*: Relax license.

* lib/gen-uni-tables.c (output_predicate): Bump copyright year. For
unictype/ctype_*, use the LGPLv2+.
* lib/unictype/ctype_*.h: Regenerated.
* lib/unictype/ctype_*.c: Update license notice.
* modules/unictype/ctype-alnum (License): Change to LGPLv2+.
* modules/unictype/ctype-alpha (License): Likewise.
* modules/unictype/ctype-blank (License): Likewise.
* modules/unictype/ctype-cntrl (License): Likewise.
* modules/unictype/ctype-digit (License): Likewise.
* modules/unictype/ctype-graph (License): Likewise.
* modules/unictype/ctype-lower (License): Likewise.
* modules/unictype/ctype-print (License): Likewise.
* modules/unictype/ctype-punct (License): Likewise.
* modules/unictype/ctype-space (License): Likewise.
* modules/unictype/ctype-upper (License): Likewise.
* modules/unictype/ctype-xdigit (License): Likewise.

2 years agoc32width: Add tests.
Bruno Haible [Thu, 4 May 2023 11:53:41 +0000 (13:53 +0200)]
c32width: Add tests.

* tests/test-c32width.c: New file, based on tests/test-wcwidth.c.
* modules/c32width-tests: New file.

2 years agoc32width: New module.
Bruno Haible [Thu, 4 May 2023 11:52:42 +0000 (13:52 +0200)]
c32width: New module.

* lib/uchar.in.h (c32width): New declaration.
* lib/c32width.c: New file, based on lib/c32is-impl.h.
* modules/c32width: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32WIDTH.
* modules/uchar (Makefile.am): Substitute GNULIB_C32WIDTH.

2 years agodoc: Mention macOS wcwidth bug.
Bruno Haible [Thu, 4 May 2023 11:29:49 +0000 (13:29 +0200)]
doc: Mention macOS wcwidth bug.

* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Mention macOS bugs.
* doc/posix-functions/wcwidth.texi: Update regarding macOS.

2 years agovasnprintf, vasnwprintf: Make '0' flag handling more ISO C compliant.
Bruno Haible [Wed, 3 May 2023 15:09:20 +0000 (17:09 +0200)]
vasnprintf, vasnwprintf: Make '0' flag handling more ISO C compliant.

* lib/vasnprintf.c (VASNPRINTF): When doing the padding ourselves,
ignore the '0' flag if a precision is specified and the conversion is
one of d, i, o, u, x, X, b, B.
* tests/test-vasnprintf-posix.c (test_function): Update expected results
accordingly.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.

2 years agomktime: include <intprops.h>
Paul Eggert [Tue, 2 May 2023 20:18:52 +0000 (13:18 -0700)]
mktime: include <intprops.h>

* lib/mktime.c: Include <intprops.h> again,
fixing a typo noted by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-05/msg00014.html

2 years agofopen: Silence a gcc warning.
Bruno Haible [Tue, 2 May 2023 18:50:05 +0000 (20:50 +0200)]
fopen: Silence a gcc warning.

* lib/fopen.c (rpl_fopen): Mark open_direction as used.

2 years agoextern-inline: port to pcc
Paul Eggert [Mon, 1 May 2023 18:19:05 +0000 (11:19 -0700)]
extern-inline: port to pcc

* m4/extern-inline.m4 (gl_EXTERN_INLINE): Port to pcc
1.2.0.DEVEL 20220331, which doesn’t support extern inline
even though it claims to be GCC 4.3 and to support C11.

2 years agoregex: prefer C23 style overflow checking
Paul Eggert [Mon, 1 May 2023 16:10:17 +0000 (09:10 -0700)]
regex: prefer C23 style overflow checking

* lib/regex_internal.h: Include stdckdint.h.
* lib/regexec.c (re_search_2_stub):
* modules/regex (Depends-on): Add stdckdint.
Prefer stdckdint.h to intprops.h macros.

2 years agodynarray: prefer C23 style overflow checking
Paul Eggert [Mon, 1 May 2023 16:06:57 +0000 (09:06 -0700)]
dynarray: prefer C23 style overflow checking

* lib/malloc/dynarray_emplace_enlarge.c, lib/malloc/dynarray_resize.c:
Include stdckdint.h, not intprops.h.
* lib/malloc/dynarray_emplace_enlarge.c:
(__libc_dynarray_emplace_enlarge):
* lib/malloc/dynarray_resize.c (__libc_dynarray_resize):
Prefer stdckdint.h to intprops.h macros.
* modules/glibc-internal/dynarray (Depends-on):
Depend on stdckdint, not intprops.

2 years agomktime: prefer C23 style overflow checking
Paul Eggert [Mon, 1 May 2023 16:04:15 +0000 (09:04 -0700)]
mktime: prefer C23 style overflow checking

Prefer stdckdint.h macros to intprops.h macros where either will do,
as this is the C23 standard.  Also, it ports around a pcc bug.
* config/srclist.txt: Comment out mktime.c.
* lib/mktime.c: Include stdckdint.h, not intprops.h.
(__mktime_internal): Prefer stdckdint.h to intprops.h macros.
* modules/mktime (Depends-on): Add stdckdint.

2 years agolimits-h: port to pcc
Paul Eggert [Mon, 1 May 2023 15:11:12 +0000 (08:11 -0700)]
limits-h: port to pcc

* doc/posix-headers/limits.texi: Document the issue.
* lib/limits.in.h (MB_LEN_MAX): New macro, if not already defined.
* m4/limits-h.m4 (gl_LIMITS_H): Test for MB_LEN_MAX.
* tests/test-limits-h.c: Check that it’s positive.

2 years agoyear2038-recommended: new module
Paul Eggert [Sat, 29 Apr 2023 18:44:13 +0000 (11:44 -0700)]
year2038-recommended: new module

Remove year2038-required and largefile-required, replacing
the former with year2038-recommended and simply removing
the latter.  This syncs with Autoconf master.
* MODULES.html.sh, NEWS, doc/largefile.texi:
* all-modules (exclude): Exclude year2038-recommended, not -required.
* doc/posix-headers/sys_types.texi, doc/posix-headers/time.texi:
* doc/year2038.texi: Mention this.
* m4/largefile.m4: Sync from Autoconf.  Override existing macros
if AC_SYS_YEAR2038_RECOMMENDED is not defined, rather than if
AC_SYS_LARGEFILE_REQUIRED is not defined.
* modules/largefile-required, modules/year2038-required: Removed.
* modules/year2038: Do not depend on largefile; simply
use m4/largefile.m4, since we shouldn’t need the extra goodies
largefile supplies.
* modules/year2038-recommended: New module.

2 years agostdio: Avoid different configure results in different testdirs.
Bruno Haible [Sat, 29 Apr 2023 01:24:43 +0000 (03:24 +0200)]
stdio: Avoid different configure results in different testdirs.

* m4/stdio_h.m4 (gl_STDIO_H_EARLY): New macro, extracted from
gl_STDIO_H.
(gl_STDIO_H): Move the code that sets __USE_MINGW_ANSI_STDIO to
gl_STDIO_H_EARLY.
* modules/stdio (configure.ac-early): New section.

2 years agostdbool tests: Avoid compilation error with Sun C on Solaris 10.
Bruno Haible [Sat, 29 Apr 2023 01:18:17 +0000 (03:18 +0200)]
stdbool tests: Avoid compilation error with Sun C on Solaris 10.

* tests/test-stdbool.c (WORKING_BOOL): Set to 0 on Sun C.

2 years agohamt tests: Fix test failure with Sun C on Solaris 10/SPARC.
Bruno Haible [Sat, 29 Apr 2023 01:13:52 +0000 (03:13 +0200)]
hamt tests: Fix test failure with Sun C on Solaris 10/SPARC.

* tests/test-hamt.c (main): Finish with exit code 0.

2 years agolocaleconv: Work around a mingw bug.
Bruno Haible [Thu, 27 Apr 2023 23:12:16 +0000 (01:12 +0200)]
localeconv: Work around a mingw bug.

* m4/localeconv.m4 (gl_FUNC_LOCALECONV): Test whether fields of type
'char' are filled correctly.
(gl_PREREQ_LOCALECONV): Test whether 'struct lconv' has the int_{p,n}_*
members.
* lib/localeconv.c (FIX_CHAR_VALUE): New macro.
(localeconv): Replace negative field values with CHAR_MAX.
* doc/posix-functions/localeconv.texi: Mention the mingw bug.