]> Savannah Git Hosting - gnulib.git/log
gnulib.git
5 months agoopenat: don’t lose track of save_cwd errno
Paul Eggert [Mon, 18 Nov 2024 15:54:54 +0000 (07:54 -0800)]
openat: don’t lose track of save_cwd errno

* lib/openat.c (openat_permissive): When ‘close’ is called
after save_cwd failed, don’t lose track of save_cwd’s errno.
This fixes a recently-introduced unlikely bug.

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.

5 months agotests: Silence some more -Wdeprecated-declarations warnings.
Bruno Haible [Wed, 20 Nov 2024 07:24:31 +0000 (08:24 +0100)]
tests: Silence some more -Wdeprecated-declarations warnings.

* tests/test-execute-child.c: Silence warning about sprintf.
* tests/test-fstatat.c: Silence warnings about statat and lstatat.
* tests/test-statat.c: Add comment.

5 months agosavewd: remove O_SEARCH optimization
Paul Eggert [Wed, 20 Nov 2024 02:29:57 +0000 (18:29 -0800)]
savewd: remove O_SEARCH optimization

* lib/savewd.c (savewd_save): Remove recently-added optimization
for platforms with O_SEARCH, as it does not work on macOS 12.6
due to what seems to be a bug there.

5 months agostrerror, vasnprintf: pacify clang 14 on macOS
Paul Eggert [Tue, 19 Nov 2024 23:48:02 +0000 (15:48 -0800)]
strerror, vasnprintf: pacify clang 14 on macOS

* lib/strerror.c, lib/vasnprintf.c: Pacify clang 14 on macOS 12.6.

5 months agodoc: nullptr_t bug fixed in GCC 15
Paul Eggert [Tue, 19 Nov 2024 21:57:36 +0000 (13:57 -0800)]
doc: nullptr_t bug fixed in GCC 15

5 months agounicodeio: avoid iconv issues for most ASCII characters
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

5 months agodoc: mention strtol no-conversion + EINVAL
Paul Eggert [Tue, 19 Nov 2024 17:11:22 +0000 (09:11 -0800)]
doc: mention strtol no-conversion + EINVAL

5 months agostdlib: Adjust warning about function 'free'.
Bruno Haible [Tue, 19 Nov 2024 15:03:01 +0000 (16:03 +0100)]
stdlib: Adjust warning about function 'free'.

Reported by Simon Josefsson in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00158.html>.

* lib/stdlib.in.h (free): Talk about POSIX:2024, not future POSIX.
Recommend module 'free-posix'.

5 months agomaint: avoid sc_prohibit_undesirable_word_seq failure
Pádraig Brady [Mon, 18 Nov 2024 16:20:22 +0000 (16:20 +0000)]
maint: avoid sc_prohibit_undesirable_word_seq failure

* build-aux/bootstrap: s/can not/cannot/

5 months agosavewd: set errnum for FINAL_STATE too
Paul Eggert [Mon, 18 Nov 2024 06:58:13 +0000 (22:58 -0800)]
savewd: set errnum for FINAL_STATE too

Problem reported by Grisha Levit in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00137.html
* lib/savewd.c (savewd_finish):
Set errnum to 0 unless we were in an error state.
* lib/savewd.h (savewd_errno): Report final state errnum too.

5 months agodoc: Prefer https urls where possible.
Collin Funk [Sun, 17 Nov 2024 21:05:55 +0000 (13:05 -0800)]
doc: Prefer https urls where possible.

* doc/gnulib.texi (POSIXURL): Use https url.
* doc/multithread.texi: Use https instead of http where possible.
* doc/glibc-functions/*.texi: Likewise.
* doc/posix-functions/*.texi: Likewise.
* lib/glthread/lock.c: Likewise.
* lib/hamt.h: Likewise.
* lib/localcharset.c: Likewise.
* lib/pipe2.c: Likewise.
* lib/pipe.c: Likewise.
* lib/sigsegv.c: Likewise.
* lib/sigsegv.in.h: Likewise.
* lib/sm3.c: Likewise.
* lib/sm3.h: Likewise.
* lib/sm3-stream.c: Likewise.
* lib/stackvma.c: Likewise.
* lib/stdio-impl.h: Likewise.
* lib/stdnoreturn.in.h: Likewise.
* m4/getopt.m4: Likewise.
* m4/largefile.m4: Likewise.
* m4/stdalign.m4: Likewise.
* STATUS-libposix: Likewise.
* tests/test-float.c: Likewise.
* tests/test-getopt.h: Likewise.
* tests/test-setenv.c: Likewise.
* tests/test-spawn-pipe-child.c: Likewise.
* tests/test-strerror.c: Likewise.
* tests/test-strerror_r.c: Likewise.
* tests/test-unsetenv.c: Likewise.
* users.txt: Likewise.

5 months agomd5-stream, sha*-stream, sm3-stream: Avoid duplicate symbols.
Jan Palus [Sun, 17 Nov 2024 17:58:42 +0000 (18:58 +0100)]
md5-stream, sha*-stream, sm3-stream: Avoid duplicate symbols.

* 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.

Copyright-paperwork-exempt: Yes

5 months agostd-gnu23: fix ChangeLog typo
Paul Eggert [Sun, 17 Nov 2024 17:37:12 +0000 (09:37 -0800)]
std-gnu23: fix ChangeLog typo

5 months agostd-gnu23: sync from Autoconf
Paul Eggert [Sun, 17 Nov 2024 17:30:24 +0000 (09:30 -0800)]
std-gnu23: sync from Autoconf

This fixes a problem reported from Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00145.html
* m4/std-gnu23.m4 (_AC_C_C23_TEST_MAIN): Use null_ptr.

5 months agoRemove .cvsignore files.
Collin Funk [Sun, 17 Nov 2024 04:54:10 +0000 (20:54 -0800)]
Remove .cvsignore files.

* .cvsignore: Remove file.
* doc/.cvsignore: Likewise.
* lib/.cvsignore: Likewise.
* m4/.cvsignore: Likewise.

5 months agostd-gnu23: don’t test stdbit.h
Paul Eggert [Sat, 16 Nov 2024 20:07:34 +0000 (12:07 -0800)]
std-gnu23: don’t test stdbit.h

Although freestanding C23 compilers must support <stdbit.h>,
some current sort-of-C23 environments lack it.
We still want to use options like -std=gnu23 on such platforms.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00141.html
* m4/std-gnu23.m4 (_AC_C_C23_TEST_GLOBALS): Do not test stdbit.h.

5 months agostd-gnu23: pacify GCC 15
Paul Eggert [Sat, 16 Nov 2024 19:51:23 +0000 (11:51 -0800)]
std-gnu23: pacify GCC 15

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00140.html
* m4/std-gnu23.m4 (_AC_C_C23_TEST_GLOBALS): Add parens.
While we’re at it, use sizeof so that the expression is a
conforming integer constant expression.

5 months agocalloc-gnu: Fix bug on 32-bit AIX (regression 2024-11-04).
Bruno Haible [Sat, 16 Nov 2024 14:16:05 +0000 (15:16 +0100)]
calloc-gnu: Fix bug on 32-bit AIX (regression 2024-11-04).

* lib/stdlib.in.h (calloc): Consider _GL_USE_STDLIB_ALLOC.
* lib/calloc.c: Define _GL_USE_STDLIB_ALLOC. Don't undefine calloc.
* lib/malloc.c: Add comment.
* lib/realloc.c: Likewise.

5 months agomktime: don’t consult daylight
Paul Eggert [Thu, 14 Nov 2024 17:40:24 +0000 (10:40 -0700)]
mktime: don’t consult daylight

* lib/mktime.c (__mktime_internal): Do not consult __daylight
as it has unreliable contents - among other things, the user
can set it.  It also wasn’t being configured properly for
mingw-w64; this problem was reported by Markus Muetzel in
<https://lists.gnu.org/r/bug-gnulib/2024-11/msg00126.html>.
* m4/mktime.m4 (gl_PREREQ_MKTIME): Do not check for ‘daylight’;
no longer needed.

5 months agoEliminate gcc -Wzero-as-null-pointer-constant warnings.
Bruno Haible [Thu, 14 Nov 2024 14:56:50 +0000 (15:56 +0100)]
Eliminate gcc -Wzero-as-null-pointer-constant warnings.

* lib/argp-help.c: Use NULL, not 0, to denote a null pointer.
* lib/argp-parse.c: Likewise.
* lib/backup-find.c (get_version): Likewise.
* lib/bitset/list.c: Likewise.
* lib/bitset/stats.c (bitset_stats_init): Likewise.
* lib/bitset/table.c: Likewise.
* lib/bitsetv.c (bitsetv_alloc): Likewise.
* lib/error.c (print_errno_message): Likewise.
* lib/exclude.c (new_exclude_segment): Likewise.
* lib/getopt.c (GETOPT_ENTRY): Likewise.
* lib/human.c (block_size_args): Likewise.
* lib/obstack.c (_obstack_begin_worker, _obstack_newchunk,
_obstack_allocated_p, _obstack_free, _obstack_memory_used): Likewise.
* lib/quotearg.c (quoting_style_args, quotearg_buffer_restyled,
quotearg_alloc_mem): Likewise.
* lib/readutmp.c (read_utmp_from_file): Likewise.
* lib/savedir.c (comparison_function_table): Likewise.
* lib/settime.c (settime): Likewise.
* tests/nap.h (nap_works): Likewise.
* tests/test-fts.c (argv, fts_dealloc, remove_tree, main): Likewise.
* tests/test-getaddrinfo.c (simple): Likewise.
* tests/test-nstrftime.h (posixtm_test, TZ, quarter_test, errno_test,
locales_test): Likewise.
* tests/test-parse-datetime.c (main): Likewise.
* tests/test-regex.c (main): Likewise.

5 months agoautoupdate
Karl Berry [Thu, 14 Nov 2024 15:10:02 +0000 (07:10 -0800)]
autoupdate

5 months agoftruncate, ftello: Make them work again for large files on MSVC.
Bruno Haible [Thu, 14 Nov 2024 06:43:00 +0000 (07:43 +0100)]
ftruncate, ftello: Make them work again for large files on MSVC.

* lib/ftruncate.c: Test _GL_WINDOWS_64_BIT_OFF_T again.
* lib/ftello.c: Likewise.

5 months agopthread-rwlock tests: Fix compilation error on AIX with xlc.
Bruno Haible [Thu, 14 Nov 2024 06:06:25 +0000 (07:06 +0100)]
pthread-rwlock tests: Fix compilation error on AIX with xlc.

* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Cast the NULL pointer.
* tests/test-pthread-rwlock-waitqueue.c (do_test): Likewise.

5 months agoftello: Add tests for large files.
Bruno Haible [Thu, 14 Nov 2024 04:22:06 +0000 (05:22 +0100)]
ftello: Add tests for large files.

* tests/test-ftello-largefile.c: New file.
* modules/ftello-extra-tests: New file.
* modules/ftello-tests (Depends-on): Add ftello-extra-tests.

5 months agofseeko: Add tests for large files.
Bruno Haible [Thu, 14 Nov 2024 04:20:33 +0000 (05:20 +0100)]
fseeko: Add tests for large files.

* tests/test-fseeko-largefile.c: New file.
* modules/fseeko-extra-tests: New file.
* modules/fseeko-tests (Depends-on): Add fseeko-extra-tests.

5 months agoftello: Fix override on mingw.
Bruno Haible [Thu, 14 Nov 2024 04:18:00 +0000 (05:18 +0100)]
ftello: Fix override on mingw.

Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00108.html>.

* lib/ftello.c: Test whether module 'largefile' is in use, not
whether it had to override 'off_t'.

5 months agofseeko: Fix potentially wrong override.
Bruno Haible [Thu, 14 Nov 2024 03:51:23 +0000 (04:51 +0100)]
fseeko: Fix potentially wrong override.

* m4/fseeko.m4 (gl_PREREQ_FSEEKO): Define the C macro HAVE_FSEEKO.

5 months agoftello: Fix override on mingw and 32-bit Solaris OpenIndiana.
Bruno Haible [Thu, 14 Nov 2024 03:42:45 +0000 (04:42 +0100)]
ftello: Fix override on mingw and 32-bit Solaris OpenIndiana.

Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00108.html>.

* m4/ftello.m4 (gl_PREREQ_FTELLO): Define the C macro HAVE_FTELLO.

5 months agoftruncate: Accept lengths > 2 GiB on 32-bit mingw.
Bruno Haible [Thu, 14 Nov 2024 03:32:09 +0000 (04:32 +0100)]
ftruncate: Accept lengths > 2 GiB on 32-bit mingw.

* lib/ftruncate.c: Test whether module 'largefile' is in use, not
whether it had to override 'off_t'.

5 months agognulib-tool.py: Fix logic of --remove-import option.
Bruno Haible [Wed, 13 Nov 2024 01:36:11 +0000 (02:36 +0100)]
gnulib-tool.py: Fix logic of --remove-import option.

Reported by Gavin Smith <gavinsmith0123@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00101.html>.

* pygnulib/GLImport.py (GLImport.__init__): Compute the modules to keep
correctly.

5 months agobootstrap: Tweak GNULIB_REFDIR related changes.
Bruno Haible [Wed, 13 Nov 2024 00:25:26 +0000 (01:25 +0100)]
bootstrap: Tweak GNULIB_REFDIR related changes.

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Improve if/else
structure and comments. When cloning GNULIB_REFDIR and no submodule
'gnulib' is configured, switch to the default branch.
* top/bootstrap (usage):  Update documentation.
* build-aux/bootstrap: Regenerated.

5 months agobootstrap: avoid "cd"
Paul Eggert [Tue, 12 Nov 2024 21:13:47 +0000 (13:13 -0800)]
bootstrap: avoid "cd"

* top/bootstrap-funclib.sh: Avoid "cd".  This saves a few
subprocesses and is more likely to yield diagnostics that make
sense to the user.
* build-aux/bootstrap: Regenerate.

5 months agobootstrap: go back to old non-submodule semantics
Paul Eggert [Tue, 12 Nov 2024 21:00:10 +0000 (13:00 -0800)]
bootstrap: go back to old non-submodule semantics

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR):
When cloning GNULIB_REFDIR and no submodule 'gnulib' is configured,
set the origin’s URL to $gnulib_url and fetch from remote,
so that GNULIB_REFDIR is merely an accelerant rather than
having different semantics.
* build-aux/bootstrap: Regenerate.

5 months agognulib-tool: Fix comment.
Bruno Haible [Tue, 12 Nov 2024 19:22:38 +0000 (20:22 +0100)]
gnulib-tool: Fix comment.

Reported by Gavin Smith <gavinsmith0123@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-11/msg00101.html>.

* gnulib-tool: Fix comment.

5 months agobootstrap: tune Octave bootstrap --gnulib-refdir
Paul Eggert [Tue, 12 Nov 2024 17:28:55 +0000 (09:28 -0800)]
bootstrap: tune Octave bootstrap --gnulib-refdir

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR):
Use GNULIB_REFDIR also when a submodule 'gnulib' is not configured.
This greatly speeds up bootstrapping Octave when using
‘./bootstrap --gnulib-refdir=...’.
* build-aux/bootstrap: Regenerate.

5 months agoopenat: port lowest-fd to native MS-Windows
Paul Eggert [Tue, 12 Nov 2024 00:25:50 +0000 (16:25 -0800)]
openat: port lowest-fd to native MS-Windows

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00081.html
* lib/openat.c (openat_permissive): When save_cwd allocates an FD,
allocate another one DFD and then close FD so that the later
open returns FD (the lowest available fd), as POSIX requires.

5 months agofts: Fix dependencies (regression 2024-11-06).
Bruno Haible [Mon, 11 Nov 2024 19:03:31 +0000 (20:03 +0100)]
fts: Fix dependencies (regression 2024-11-06).

* modules/fts (Depends-on): Add fcntl-safer.

5 months agomalloca: pacify CHERI clang
Paul Eggert [Mon, 11 Nov 2024 18:59:16 +0000 (10:59 -0800)]
malloca: pacify CHERI clang

* lib/malloca.c (freea) [__CHERI_PURE_CAPABILITY__]:
Add a cast as the code otherwise doesn’t conform to C.

5 months agofile-has-acl: another nofollow fix for FreeBSD
Paul Eggert [Mon, 11 Nov 2024 18:57:35 +0000 (10:57 -0800)]
file-has-acl: another nofollow fix for FreeBSD

* lib/file-has-acl.c (file_has_aclinfo): On FreeBSD, NetBSD >= 10,
if we don’t follow symlinks the first time, also don’t follow
them the second time, when it is typically a directory - so it
doesn’t matter whether symlinks are followed - but it might not be.

5 months agofile-has-acl: _GL_UNUSED → MAYBE_UNUSED
Paul Eggert [Mon, 11 Nov 2024 05:18:02 +0000 (21:18 -0800)]
file-has-acl: _GL_UNUSED → MAYBE_UNUSED

5 months agofile-has-acl: minor refactor of acl_get_link_np fix
Paul Eggert [Mon, 11 Nov 2024 15:52:32 +0000 (07:52 -0800)]
file-has-acl: minor refactor of acl_get_link_np fix

* lib/file-has-acl.c (file_has_aclinfo): Redo to avoid ‘else #endif’.

5 months agofile-has-acl: scontext even if --disable-acl
Paul Eggert [Mon, 11 Nov 2024 15:35:50 +0000 (07:35 -0800)]
file-has-acl: scontext even if --disable-acl

Be able to get the security context even if configured with
--disable-acl, as security contexts are not ACLs, and the
main reason for --disable-acl was for efficiency with GNU ls -l,
a concern that does not apply to security contexts (which are
needed only with ls -Z).  Problem reported by Pádraig Brady
<https://bugs.gnu.org/73418#52>.
* lib/acl.h (ACL_GET_SCONTEXT): New constant.
(aclinfo_free, aclinfo_scontext_free): Declare even if !USE_ACL.
* lib/file-has-acl.c (USE_LINUX_XATTR): No longer false merely
because !USE_ACL, because we need xattr to get scontext.
(get_aclinfo): Support new ACL_GET_SCONTEXT flag.

5 months agonproc: Use affinity mask even in out-of-memory situations.
Bruno Haible [Mon, 11 Nov 2024 14:40:52 +0000 (15:40 +0100)]
nproc: Use affinity mask even in out-of-memory situations.

* lib/nproc.c (num_processors_via_affinity_mask): Use a stack-allocated
cpu_set_t as fallback. Add comments.

5 months agonproc: Use affinity mask even on systems with more than 1024 CPUs.
Florian Weimer [Mon, 11 Nov 2024 13:05:53 +0000 (14:05 +0100)]
nproc: Use affinity mask even on systems with more than 1024 CPUs.

* lib/nproc.c (num_processors_via_affinity_mask): Retry
with larger affinity masks if CPU_ALLOC_SIZE is available.

5 months agoacl-permissions: Define the inline functions in this module.
Bruno Haible [Mon, 11 Nov 2024 08:53:23 +0000 (09:53 +0100)]
acl-permissions: Define the inline functions in this module.

* lib/acl-internal.c (ACL_INTERNAL_INLINE): Define here.
* lib/qset-acl.c (ACL_INTERNAL_INLINE): Don't define here.

5 months agogetpagesize: Fix use of 'extern inline' (regression 2012-11-20).
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.

5 months agorealloc-posix: Fix link error (regression 2024-11-04).
Bruno Haible [Mon, 11 Nov 2024 08:02:23 +0000 (09:02 +0100)]
realloc-posix: Fix link error (regression 2024-11-04).

* doc/extern-inline.texi (extern inline): Mention that one needs a
*_INLINE macro per compilation unit.
* lib/stdlib.in.h (_GL_REALLOC_INLINE): New macro.
(rpl_realloc): Use it. Don't test IN_GNULIB_TESTS.
* lib/realloc.c (_GL_REALLOC_INLINE): Define.

5 months agoUpdate .gitignore after 2024-10-27 change.
Bruno Haible [Mon, 11 Nov 2024 08:05:12 +0000 (09:05 +0100)]
Update .gitignore after 2024-10-27 change.

5 months agofile-has-acl: Fix compilation errors on macOS et al. (regr. 2024-11-09).
Bruno Haible [Mon, 11 Nov 2024 06:25:00 +0000 (07:25 +0100)]
file-has-acl: Fix compilation errors on macOS et al. (regr. 2024-11-09).

* m4/acl.m4 (gl_FUNC_ACL): Test whether acl_get_link_np exists.
* lib/file-has-acl.c (file_has_aclinfo): Use ACL_SYMLINK_FOLLOW, not
AC_SYMLINK_FOLLOW. Don't use acl_get_link_np if this function does not
exist.

5 months agorelocatable-prog-wrapper: Fix compilation error on NetBSD 7.
Bruno Haible [Sun, 10 Nov 2024 23:56:15 +0000 (00:56 +0100)]
relocatable-prog-wrapper: Fix compilation error on NetBSD 7.

Reported by Ionut Cosmin Mihai <ionut.cosmin.mihai@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnu-libiconv/2024-11/msg00000.html>.

* lib/relocwrapper.c: Fix dependency tree.
* modules/relocatable-prog-wrapper (Files): Add lib/stat-time.h,
lib/stat-time.c.
* build-aux/install-reloc (func_create_wrapper): Compile also
stat-time.c.

5 months agofile-has-acl: avoid -Werror=unused-variable with --disable-acl
Pádraig Brady [Sun, 10 Nov 2024 12:56:10 +0000 (12:56 +0000)]
file-has-acl: avoid -Werror=unused-variable with --disable-acl

* lib/file-has-acl.c (file_has_aclinfo): Mark D_TYPE as unused
in certain configurations.

5 months agofile-has-acl: symlinks can have scontext
Paul Eggert [Sat, 9 Nov 2024 22:52:05 +0000 (14:52 -0800)]
file-has-acl: symlinks can have scontext

Problem reported by Pádraig Brady <https://bugs.gnu.org/73418#35>.
* lib/file-has-acl.c (file_has_aclinfo):
With SELinux, symbolic links can have security contexts,
so omit incorrect optimizations assuming that they lack them.
When ! (flags & AC_SYMLINK_FOLLOW), prefer acl_get_link_np to
acl_get_file on platforms that have both APIs,
as this can avoid some races.

5 months agoautoupdate
Karl Berry [Fri, 8 Nov 2024 15:38:10 +0000 (07:38 -0800)]
autoupdate

5 months agofile-has-acl: minor ENOMEM fixes
Paul Eggert [Thu, 7 Nov 2024 17:37:17 +0000 (09:37 -0800)]
file-has-acl: minor ENOMEM fixes

* lib/file-has-acl.c: Include limits.h.
(get_aclinfo): Use a saturating add rather than reporting
overflow, in the very unlikely case that the size overflows.
This is simpler and is good enough here.
Also, defend against implausible system that fails with ERANGE
even when the buffer size is SSIZE_MAX.
(file_has_aclinfo): Since we already assume elsewhere that
malloc sets errno, rely on that here too.
* modules/file-has-acl (Depends-on): Add limits.h.
Also add malloc-posix, since we rely on malloc errno.

5 months agofile-has-acl: remove __gl_acl_alloc member
Paul Eggert [Thu, 7 Nov 2024 17:25:43 +0000 (09:25 -0800)]
file-has-acl: remove __gl_acl_alloc member

It may have been needed in earlier versions of this code,
but it is no longer needed.
* lib/acl.h (struct aclinfo): Remove __gl_acl_alloc.  All uses removed.
* lib/file-has-acl.c (get_aclinfo):
Use local, not the removed struct aclinfo slot.

5 months agoopendirat: don’t depend on openat-safer
Paul Eggert [Wed, 6 Nov 2024 21:33:27 +0000 (13:33 -0800)]
opendirat: don’t depend on openat-safer

* lib/opendirat.c: Include fcntl.h.
[!GNULIB_OPENAT_SAFER]: Don’t include fcntl--.h.
* modules/opendirat (Depends-on): Depend on openat, not openat-safer.

5 months agogetusershell: don’t depend on fopen-safer
Paul Eggert [Wed, 6 Nov 2024 21:27:08 +0000 (13:27 -0800)]
getusershell: don’t depend on fopen-safer

* lib/getusershell.c: Include stdio.h.
[!GNULIB_FOPEN_SAFER]: Don’t include stdio--.h.
* modules/getusershell (Depends-on): Depend on fopen, not fopen-safer.

5 months agosavewd: don’t depend on fcntl-safer
Paul Eggert [Wed, 6 Nov 2024 21:22:32 +0000 (13:22 -0800)]
savewd: don’t depend on fcntl-safer

* lib/savewd.c: Don’t include fcntl-safer.
[GNULIB_FCNTL_SAFER]: Include fcntl--.h.
(savewd_save): Use open, not open_safer.
* modules/savewd (Depends-on): Remove fcntl-safer.

5 months agosavedir: don’t depend on dirent-safer
Paul Eggert [Wed, 6 Nov 2024 21:03:19 +0000 (13:03 -0800)]
savedir: don’t depend on dirent-safer

* lib/savedir.c [!GNULIB_DIRENT_SAFER]: Don't include dirent--.h.
* modules/savedir (Depends-on): Depend on dirent, not dirent-safer.

5 months agosave-cwd: don’t depend on fd-safer-flag, unistd-safer
Paul Eggert [Wed, 6 Nov 2024 21:00:52 +0000 (13:00 -0800)]
save-cwd: don’t depend on fd-safer-flag, unistd-safer

They aren’t needed in packages that use xstdopen
* lib/save-cwd.c: Do not include unistd--.h.
(GNULIB_FCNTL_SAFER): Do not define.
(save_cwd): Do not use fd_safer_flag, as the package should use
either fcntl-safer+unistd-safer or xstdopen if it cares about
closed stdin.
* modules/save-cwd (Depends-on): Remove fd-safer-flag, unistd-safer.

5 months agoerror: tune a bit for xstdopen
Paul Eggert [Wed, 6 Nov 2024 20:51:38 +0000 (12:51 -0800)]
error: tune a bit for xstdopen

* lib/error.c (flush_stdout): Also optimize if GNULIB_XSTDOPEN.

5 months agounistd-safer indicate presence
Paul Eggert [Wed, 6 Nov 2024 20:48:38 +0000 (12:48 -0800)]
unistd-safer indicate presence

modules/unistd-safer (configure.ac): Add module indicator.

5 months agoxstdopen: indicate presence
Paul Eggert [Wed, 6 Nov 2024 20:43:26 +0000 (12:43 -0800)]
xstdopen: indicate presence

* modules/xstdopen (configure.ac): Add module indicator.

5 months agoDocument xstdopen vs *-safer better
Paul Eggert [Wed, 6 Nov 2024 20:32:27 +0000 (12:32 -0800)]
Document xstdopen vs *-safer better

5 months agomemset_explicit: Guarantee N3322 functionality.
Bruno Haible [Wed, 6 Nov 2024 12:02:09 +0000 (13:02 +0100)]
memset_explicit: Guarantee N3322 functionality.

* m4/memset_explicit.m4 (gl_PREREQ_MEMSET_EXPLICIT): Require
AC_CANONICAL_HOST. Test whether memset_s supports zero-length
operations.
* lib/memset_explicit.c (memset_explicit): Don't invoke memset_s with
argument 0 if memset_s does not support this.

5 months agowcsncat: Fix configure test.
Bruno Haible [Wed, 6 Nov 2024 11:44:26 +0000 (12:44 +0100)]
wcsncat: Fix configure test.

* m4/wcsncat.m4 (gl_FUNC_WCSNCAT): Fix wrong cache variable name.

5 months agostrncat, wcsncat tests: Fix test.
Bruno Haible [Wed, 6 Nov 2024 11:34:18 +0000 (12:34 +0100)]
strncat, wcsncat tests: Fix test.

* tests/test-strncat.c (main): Change y to a valid string.
* tests/test-wcsncat.c (main): Change y to a valid wide string.

5 months agoeealloc: deprecate
Paul Eggert [Wed, 6 Nov 2024 07:07:09 +0000 (23:07 -0800)]
eealloc: deprecate

Now that malloc-gnu and realloc-posix arrange for the
various memory allocators to return non-null on success,
should be no need for the eealloc module.
* NEWS, modules/eealloc: Mention this.

5 months agorelocatable-prog-wrapper: remove eealloc.m4
Paul Eggert [Wed, 6 Nov 2024 06:48:53 +0000 (22:48 -0800)]
relocatable-prog-wrapper: remove eealloc.m4

* modules/relocatable-prog-wrapper (Files): Remove m4/eealloc.m4.
It wasn’t being used and evidently was listed only because
a previous version needed it.

5 months agoregex: port better to AIX extensions
Paul Eggert [Wed, 6 Nov 2024 06:20:45 +0000 (22:20 -0800)]
regex: port better to AIX extensions

Also, switch from eealloc.m4 to malloc.m4 to determine
whether malloc (0) returns nonnull.
* lib/regex_internal.c (re_node_set_alloc):
Remove special case for malloc (0).
* lib/regex_internal.h (MALLOC_0_IS_NONNULL): Remove.
* m4/regex.m4 (gl_PREREQ_REGEX): Do not require gl_EEMALLOC.
* modules/regex (Files): Remove m4/eealloc.m4, m4/malloc.m4.
(Depends-on): Add malloc-gnu.

5 months agomalloca: port better to AIX extensions
Paul Eggert [Wed, 6 Nov 2024 06:06:54 +0000 (22:06 -0800)]
malloca: port better to AIX extensions

Also, switch from eealloc.m4 to malloc.m4 to determine
whether malloc (0) returns nonnull.
* lib/malloca.c (mmalloca): Use HAVE_MALLOC_0_NONNULL,
not MALLOC_0_IS_NONNULL.
* m4/malloca.m4 (gl_MALLOCA): Require gl_FUNC_MALLOC_GNU,
not gl_EEMALLOC.
* modules/malloca (Files): Remove m4/eemalloc.m4.
(Depends-on): Add extensions-aix.
* modules/relocatable-prog-wrapper:
AC_REQUIRE gl_FUNC_MALLOC_POSIX to suppress Autoconf 2.71
“warning: AC_REQUIRE: `gl_FUNC_MALLOC_POSIX' was expanded before
it was required”.

5 months agomalloc: refactor to help replace eealloc
Paul Eggert [Wed, 6 Nov 2024 06:00:01 +0000 (22:00 -0800)]
malloc: refactor to help replace eealloc

* m4/malloc.m4 (gl_FUNC_MALLOC_0_NONNULL):
New macro, split out from gl_FUNC_MALLOC_GNU.
(gl_FUNC_MALLOC_GNU): Require it.

5 months agorealloc-posix: mention _LINUX_SOURCE_COMPAT
Paul Eggert [Wed, 6 Nov 2024 05:23:40 +0000 (21:23 -0800)]
realloc-posix: mention _LINUX_SOURCE_COMPAT

* m4/realloc.m4 (gl_FUNC_REALLOC_0_NONNULL):
Add comment about _LINUX_SOURCE_COMPAT.

5 months agodoc: remove duplicate realloc-posix listing
Paul Eggert [Wed, 6 Nov 2024 00:06:11 +0000 (16:06 -0800)]
doc: remove duplicate realloc-posix listing

* MODULES.html.sh: Remove duplicate entry for realloc-posix.

5 months agoaligned_alloc tests: Fix compilation error on mingw (regr. 2024-11-04).
Bruno Haible [Wed, 6 Nov 2024 04:23:51 +0000 (05:23 +0100)]
aligned_alloc tests: Fix compilation error on mingw (regr. 2024-11-04).

* tests/test-aligned_alloc.c (aligned_alloc): Don't redefine if
aligned_alloc does not exist.

5 months agoreallocarray: Fix compilation error in C++ mode (regr. 2024-11-04).
Bruno Haible [Wed, 6 Nov 2024 04:05:26 +0000 (05:05 +0100)]
reallocarray: Fix compilation error in C++ mode (regr. 2024-11-04).

* m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Don't use
REPLACE_REALLOC_FOR_REALLOC_POSIX here. Use gl_cv_malloc_ptrdiff
instead.

5 months agodoc: improve documentation for malloc, realloc etc
Paul Eggert [Tue, 5 Nov 2024 23:57:20 +0000 (15:57 -0800)]
doc: improve documentation for malloc, realloc etc

5 months agomalloc: sync with Autoconf
Paul Eggert [Tue, 5 Nov 2024 23:55:24 +0000 (15:55 -0800)]
malloc: sync with Autoconf

This fixes a comment problem mentioned by Bruno in:
https://lists.gnu.org/r/bug-gnulib/2024-11/msg00048.html

5 months agowmemset tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:12:14 +0000 (21:12 +0100)]
wmemset tests: Verify N3322 functionality.

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

5 months agowmemchr tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:12:11 +0000 (21:12 +0100)]
wmemchr tests: Verify N3322 functionality.

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

5 months agowmemcmp tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:12:08 +0000 (21:12 +0100)]
wmemcmp tests: Verify N3322 functionality.

* tests/test-wmemcmp.c (main): Add zero-size tests.

5 months agowcsncmp tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:12:06 +0000 (21:12 +0100)]
wcsncmp tests: Verify N3322 functionality.

* tests/test-wcsncmp.c (main): Add zero-size tests.

5 months agowcsncat tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:39 +0000 (21:11 +0100)]
wcsncat tests: Verify N3322 functionality.

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

5 months agowcsncat: Guarantee N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:33 +0000 (21:11 +0100)]
wcsncat: Guarantee N3322 functionality.

* lib/wchar.in.h (wcsncat): Consider REPLACE_WCSNCAT.
* m4/wcsncat.m4 (gl_FUNC_WCSNCAT): Test whether the zero-length bug is
present.
* m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSNCAT.
* modules/wchar (Makefile.am): Substitute REPLACE_WCSNCAT.
* modules/wcsncat (Status, Notice): Remove.
(configure.ac): Consider REPLACE_WCSNCAT.
* doc/posix-functions/wcsncat.texi: Mention the zero-length bug.

5 months agowmemmove tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:29 +0000 (21:11 +0100)]
wmemmove tests: Verify N3322 functionality.

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

5 months agowmemcpy tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:25 +0000 (21:11 +0100)]
wmemcpy tests: Verify N3322 functionality.

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

5 months agowcsncpy tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:22 +0000 (21:11 +0100)]
wcsncpy tests: Verify N3322 functionality.

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

5 months agomemset_explicit tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:20 +0000 (21:11 +0100)]
memset_explicit tests: Verify N3322 functionality.

* tests/test-memset_explicit.c (main): Add a zero-size test.

5 months agomemset tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:17 +0000 (21:11 +0100)]
memset tests: Verify N3322 functionality.

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

5 months agomemchr tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:14 +0000 (21:11 +0100)]
memchr tests: Verify N3322 functionality.

* tests/test-memchr.c (main): Add a zero-size test.

5 months agostrncmp tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:12 +0000 (21:11 +0100)]
strncmp tests: Verify N3322 functionality.

* modules/strncmp: New file.
* doc/posix-functions/strncmp.texi: Mention the new module.
* tests/test-strncmp.c: New file.
* modules/strncmp-tests: New file.

5 months agomemcmp tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:10 +0000 (21:11 +0100)]
memcmp tests: Verify N3322 functionality.

* tests/test-memcmp.c (main): Add zero-size tests.

5 months agostrncat tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:11:02 +0000 (21:11 +0100)]
strncat tests: Verify N3322 functionality.

* tests/test-strncat.c (main): Add a zero-size test.

5 months agostrndup tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:23 +0000 (21:10 +0100)]
strndup tests: Verify N3322 functionality.

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

5 months agostrndup: Guarantee N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:20 +0000 (21:10 +0100)]
strndup: Guarantee N3322 functionality.

* m4/strndup.m4 (gl_FUNC_STRNDUP): Check against the AIX bug.
* doc/posix-functions/strndup.texi: Mention the AIX bug.

5 months agostrncpy tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:13 +0000 (21:10 +0100)]
strncpy tests: Verify N3322 functionality.

* modules/strncpy: New file.
* doc/posix-functions/strncpy.texi: Mention the new module.
* tests/test-strncpy.c: New file.
* modules/strncpy-tests: New file.

5 months agomemmove tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:11 +0000 (21:10 +0100)]
memmove tests: Verify N3322 functionality.

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

5 months agomemccpy tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:08 +0000 (21:10 +0100)]
memccpy tests: Verify N3322 functionality.

* modules/memccpy: New file.
* doc/posix-functions/memccpy.texi: Mention the new module.
* tests/test-memccpy.c: New file.
* modules/memccpy-tests: New file.

5 months agomemcpy tests: Verify N3322 functionality.
Bruno Haible [Tue, 5 Nov 2024 20:10:05 +0000 (21:10 +0100)]
memcpy tests: Verify N3322 functionality.

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