lib


Log

Author Commit Date CI Message
Bruno Haible 062da06e 2024-11-24T15:15:37 gettext: 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>.
Paul Eggert 3c8989db 2024-11-20T17:51:05 openat: don’t close (-1) * lib/openat.c (openat_permissive): Don’t close (-1), as some debugging systems dislike that. Clarify errno handling a bit.
Paul Eggert 131bc8e3 2024-11-18T08:13:26 openat: omit unnecessary fd test * lib/openat.c (openat_permissive): Close fd regardless of whether it’s STDERR_FILENO. This saves a bit of code space and there’s no point to making this unlikely path faster. Also change a couple of != 0 to < 0 for clarity when -1 is the only option.
Paul Eggert b52d021b 2024-11-18T07:58:03 openat: use C99 decls after stmts * lib/openat.c (rpl_openat, openat_permissive): Refactor to put decls closer to where they’re used.
Paul Eggert 8e968d52 2024-11-18T07:54:54 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.
Bruno Haible ea58a72d 2024-11-20T08:50:42 c-stack: Avoid a busy-looping test on macOS. * lib/c-stack.c: Undefine abort.
Paul Eggert da131735 2024-11-19T18:29:57 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.
Paul Eggert 985dd3e7 2024-11-19T15:48:02 strerror, vasnprintf: pacify clang 14 on macOS * lib/strerror.c, lib/vasnprintf.c: Pacify clang 14 on macOS 12.6.
Pádraig Brady e5b82978 2024-11-19T18:11:21 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
Bruno Haible dec9532d 2024-11-19T16:03:01 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'.
Paul Eggert 1f36fee6 2024-11-17T22:58:13 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.
Collin Funk 2d08d875 2024-11-17T13:05:55 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.
Jan Palus 353a3236 2024-11-17T18:58:42 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
Collin Funk ec28c077 2024-11-16T20:54:10 Remove .cvsignore files. * .cvsignore: Remove file. * doc/.cvsignore: Likewise. * lib/.cvsignore: Likewise. * m4/.cvsignore: Likewise.
Bruno Haible e61ac276 2024-11-16T15:16:05 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.
Paul Eggert 72abb08f 2024-11-14T10:40:24 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.
Bruno Haible f3d96537 2024-11-14T15:56:50 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.
Bruno Haible e03c8ac2 2024-11-14T07:43:00 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.
Bruno Haible ec062a11 2024-11-14T05:18:00 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'.
Bruno Haible 5aa62b96 2024-11-14T04:32:09 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'.
Paul Eggert 22f3766d 2024-11-11T16:25:50 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.
Paul Eggert 6025b9a1 2024-11-11T10:59:16 malloca: pacify CHERI clang * lib/malloca.c (freea) [__CHERI_PURE_CAPABILITY__]: Add a cast as the code otherwise doesn’t conform to C.
Paul Eggert a1615477 2024-11-11T10:57:35 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.
Paul Eggert 6a018d04 2024-11-10T21:18:02 file-has-acl: _GL_UNUSED → MAYBE_UNUSED
Paul Eggert 9dac7a63 2024-11-11T07:52:32 file-has-acl: minor refactor of acl_get_link_np fix * lib/file-has-acl.c (file_has_aclinfo): Redo to avoid ‘else #endif’.
Paul Eggert 771fe316 2024-11-11T07:35:50 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.
Bruno Haible ee0bc695 2024-11-11T15:40:52 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.
Florian Weimer 45c2456a 2024-11-11T14:05:53 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.
Bruno Haible 6b507752 2024-11-11T09:53:23 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.
Bruno Haible 06e24345 2024-11-11T09:33:11 getpagesize: Fix use of 'extern inline' (regression 2012-11-20). * lib/unistd.in.h (_GL_GETPAGESIZE_INLINE): New macro. (getpagesize): Use it. * lib/getpagesize.c (_GL_GETPAGESIZE_INLINE): Define. * modules/getpagesize (configure.ac): Compile getpagesize.c also when getpagesize is missing.
Bruno Haible 7368d3b7 2024-11-11T09:02:23 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.
Bruno Haible c56c270c 2024-11-11T07:25:00 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.
Bruno Haible 2d1edb0b 2024-11-11T00:56:15 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.
Pádraig Brady 10197d9c 2024-11-10T12:56:10 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.
Paul Eggert 74b6a2a7 2024-11-09T14:52:05 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.
Paul Eggert 407d0389 2024-11-07T09:37:17 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.
Paul Eggert a44d8b6c 2024-11-07T09:25:43 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.
Paul Eggert 0eb82479 2024-11-06T13:33:27 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.
Paul Eggert 98efc72e 2024-11-06T13:27:08 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.
Paul Eggert 4b506819 2024-11-06T13:22:32 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.
Paul Eggert c61f87c2 2024-11-06T13:03:19 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.
Paul Eggert 02d41a40 2024-11-06T13:00:52 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.
Paul Eggert 13ab059f 2024-11-06T12:51:38 error: tune a bit for xstdopen * lib/error.c (flush_stdout): Also optimize if GNULIB_XSTDOPEN.
Bruno Haible e3915945 2024-11-06T13:02:09 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.
Paul Eggert 67c01c9e 2024-11-05T22:20:45 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.
Paul Eggert ad999640 2024-11-05T22:06:54 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”.
Bruno Haible 101b9d7f 2024-11-05T21:11:33 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.
Bruno Haible 0e381f83 2024-11-05T22:16:12 realloc-posix: Fix link error (regression yesterday). * lib/stdlib.in.h (realloc): Don't inline rpl_realloc if IN_GNULIB_TESTS is defined. * modules/realloc-posix (Depends-on, configure.ac): Compile realloc.c also if REPLACE_REALLOC_FOR_REALLOC_POSIX is 2.
Bruno Haible a9049bff 2024-11-05T16:23:41 stdlib: Add a copyright header. * lib/stdlib.c: Add a copyright header.
Paul Eggert 064110be 2024-11-04T22:24:29 safe-alloc: simplify, given new reallocarray behavior * lib/safe-alloc.h [__CHERI_PURE_CAPABILITY__]: Remove special cases for this, as reallocarray now does it for us. (safe_alloc_realloc_n): Remove. All uses replaced by reallocarray.
Paul Eggert c2df016c 2024-11-04T18:16:50 realloc-posix: tune for glibc-like For glibc, implementing realloc (p, s) as realloc (p, s?s:1) suffices, and it’s probably better to do it inline to aid static checking. * lib/realloc.c (rpl_realloc) [_GL_INLINE_RPL_REALLOC]: Remove, replacing with inline function in stdlib.h. * lib/stdlib.in.h (_GL_INLINE_RPL_REALLOC): New macro. (rpl_realloc): Define as inline if _GL_INLINE_RPL_REALLOC. * m4/realloc.m4 (gl_FUNC_REALLOC_0_NONNULL): Set REPLACE_REALLOC_FOR_REALLOC_POSIX=2 instead of 1, if it’s close enough to glibc that the inline optimization is valid.
Paul Eggert d884e6fc 2024-11-03T22:41:41 realloc-posix: realloc (..., 0) now returns nonnull * lib/realloc.c (rpl_realloc): Simplify and tune by using HAVE_REALLOC_0_NONNULL and HAVE_MALLOC_PTRDIFF, and by having just one call to realloc instead of two. * lib/reallocarray.c (reallocarray): Simplify and tune by delegating the zero case to the revised realloc. * m4/eealloc.m4 (_AC_FUNC_REALLOC_IF): Since only eealloc uses this macro now, move its definition here ... * m4/realloc.m4: ... from here. (gl_FUNC_REALLOC_0_NONNULL): Also check that realloc (p, 0) returns nonnull. Require gl_FUNC_REALLOC_POSIX. Define HAVE_REALLOC_0_NONNULL. * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Also replace reallocarray if it returns a null pointer for size zero. * modules/eealloc (Files): Remove m4/realloc.m4. * modules/realloc-posix (Depends-on): Add extensions-aix. * modules/reallocarray (Files): Add m4/realloc.m4.
Paul Eggert 8835e92d 2024-11-03T22:02:28 stdlib: simplify preprocessor conditionals * lib/stdlib.in.h: Omit some redundant tests in conditionals.
Paul Eggert 9a4319ca 2024-11-03T21:44:15 realloc: don’t require success for nongrowth * lib/realloc.c (rpl_realloc): Do not require realloc (p, 0) to succeed, as apparently glibc realloc (p, n) can sometimes fail even when the region would not grow.
Paul Eggert 9a7a9d1b 2024-11-03T18:18:58 calloc, malloc: tune a bit This applies mostly to non-glibc platforms, or to 32-bit glibc before glibc 2.30 (2019). * lib/calloc.c (rpl_calloc): * lib/malloc.c (rpl_malloc): Optimize away some of the code if !HAVE_MALLOC_0_NONNULL or if !HAVE_MALLOC_PTRDIFF. * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_0_NONNULL. (gl_FUNC_MALLOC_PTRDIFF): Define HAVE_MALLOC_PTRDIFF.
Paul Eggert 4f5e558f 2024-11-04T15:31:15 realloc-posix: use _GL_USE_STDLIB_ALLOC * lib/realloc.c (_GL_USE_STDLIB_ALLOC): New macro, which we can use now that we don’t use malloc. (realloc): Do not undef; no longer needed.
Paul Eggert c6d15a4b 2024-11-04T11:12:21 stdlib: make MB_CUR_MAX usable from extern inline * lib/stdlib.c: New file. * modules/stdlib (Files, lib_SOURCES): Add it. (Depends-on): Add extern-inline. * lib/stdlib.in.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. (_GL_STDLIB_INLINE): New macro. (gl_MB_CUR_MAX): Make it _GL_STDLIB_INLINE not static inline, so that it can be called from extern inline functions. Redo implementation to help GCC better optimize common expressions like (MB_CUR_MAX == 1).
Paul Eggert 9959b629 2024-11-03T23:27:52 realloc-posix: set CHERI bounds * lib/ialloc.h, lib/xmalloc.c [__CHERI_PURE_CAPABILITY__]: Do nothing special, as realloc and reallocarray should do this for us now. * lib/realloc.c [__CHERI_PURE_CAPABILITY__]: Include cheri.h, and arrange for rpl_realloc to set bounds.
Paul Eggert 9c3ebd3b 2024-11-03T12:19:33 malloc-gnu: depend on stdckdint not xalloc-oversized * lib/malloc.c: Include stdckdint.h, xalloc-oversized.h. (rpl_malloc): Use ckd_mul instead of xalloc_oversized. * modules/malloc-gnu, modules/malloc-posix: (Depends-on): Depend on stdckdint, not xalloc-oversized.
Paul Eggert 9334b1c6 2024-11-03T11:11:03 calloc: depend on stdckdint not xalloc-oversized * lib/calloc.c: Include stdckdint.h, xalloc-oversized.h. (rpl_calloc): Use ckd_mul instead of xalloc_oversized. * modules/calloc-gnu, modules/calloc-posix: (Depends-on): Depend on stdckdint, not xalloc-oversized.
Bruno Haible a1da46a0 2024-11-04T17:50:09 aligned_alloc: Fix test failures on macOS, Solaris (regr. 2024-10-30). * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Check for the Solaris bug. Let the test program return a bit mask. Update cross-compilation guesses. * lib/aligned_alloc.c: Include <errno.h>. (aligned_alloc): Fail if the alignment is not a power of 2. Work around the Solaris bug. * modules/aligned_alloc (Depends-on): Add malloc-posix. * doc/posix-functions/aligned_alloc.texi: Mention the Solaris bug.
Bruno Haible 5c3bd571 2024-10-31T20:53:17 realloc-posix: Set errno when failing (regression 2029-10-29). * lib/realloc.c (rpl_realloc): When failing, with HAVE_MALLOC_POSIX not defined, set errno.
Sam Russell 6be0fe41 2024-10-31T14:59:37 crc: Fix compile warnings * lib/crc-generate-table.c: Mark non-exported functions as static * lib/crc.c: Mark non-exported functions as static Signed-off-by: Simon Josefsson <simon@josefsson.org>
Bruno Haible 1460b29e 2024-10-31T14:48:35 crc: Don't attempt to run a compiled C program when cross-compiling. * lib/crc-generate-table.c: Don't include config.h. * modules/crc (configure.ac): Define CROSS_COMPILING variable. Invoke AC_PROG_MKDIR_P. (Makefile.am): When cross-compiling, don't regenerate crc-sliceby8.h. Don't use Gnulib modules while compiling the generator.
Bruno Haible c64f10f0 2024-10-31T14:23:09 crc: Tweak generator. * lib/crc-generate-table.c (print_header): Don't emit a blank line at the end. (print_copyright_notice): Prepend a "DO NOT EDIT" line. (main): Fail if disk is full after we wrote part of the file.
Sam Russell 54f3dae2 2024-10-27T13:19:17 crc: New optimised slice-by-8 implementation * lib/crc.c: Implementation of slice-by-8 algorithm * lib/crc-generate-table.c: Generation code for CRC32 lookup tables * m4/crc.m4: Autoconf enable slice-by-8, flag to disable * modules/crc (Depends-on): Add endian. (Makefile.am): Build slice-by-8 tables from crc-generate-table.c. Signed-off-by: Simon Josefsson <simon@josefsson.org>
Paul Eggert 99bbb61c 2024-10-30T12:47:02 posix_memalign: check for GNU behavior with size 0 * lib/posix_memalign.c: Include stdckdint.h. (posix_memalign): Test for overflow more straightforwardly, and more portably to unlikely platforms where SIZE_MAX <= INT_MAX. Treat a zero size as if it were alignment. * m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): * tests/test-posix_memalign.c (main): Test zero size too. Use volatile to avoid compiler optimizations. * modules/posix_memalign (Depends-on): Add stdckdint.
Paul Eggert e6108a3b 2024-10-30T11:54:57 aligned_alloc: check for GNU behavior with size 0 If someone ever needs to distinguish between GNU and merely POSIX behavior we can split this into two modules, but for now just make this module act like GNU. * lib/aligned_alloc.c (aligned_alloc): Treat zero size like GNU. * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): * tests/test-aligned_alloc.c (main): Test zero size too.
Paul Eggert 70f9c1de 2024-10-29T22:01:42 realloc-posix: realloc (p, 0) yields nonnull * lib/realloc.c: Include <stdckdint.h>, not "xalloc-oversized.h". Use of xalloc_oversized replaced by ckd_add. (rpl_realloc) [!NEED_SANITIZED_REALLOC]: Treat realloc (p, 0) as if it were a realloc (p, 1) that never fails. That’s easier, reduces module dependencies, and better supports the future alloc-0-nonnull module. * modules/realloc-posix (Depends-on): Remove free-posix, malloc-posix, xalloc-oversized. Add stdckdint.
Bruno Haible 6659e016 2024-10-28T00:18:35 realloc-gnu: Replace module with an alias to realloc-posix. * tests/test-realloc-posix.c: Renamed from tests/test-realloc-gnu.c. Add more tests, not yet activated. * modules/realloc-posix-tests: Renamed from modules/realloc-gnu-tests. Test test-realloc-posix instead of test-realloc-gnu. * modules/realloc-gnu: Mark as a deprecated alias of 'realloc-posix'. * lib/stdlib.in.h (realloc): Ignore GNULIB_REALLOC_GNU. * modules/stdlib (Makefile.am): Don't substitute GNULIB_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_GNU. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Don't initialize GNULIB_REALLOC_GNU. (gl_STDLIB_H_DEFAULTS): Don't initialize REPLACE_REALLOC_FOR_REALLOC_GNU. * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Remove macro. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Update comment. * doc/posix-functions/realloc.texi: Remove description of module 'realloc-gnu'. * MODULES.html.sh (Memory management functions <stdlib.h>): Remove realloc-gnu. Add realloc-posix.
Paul Eggert 2d528629 2024-10-25T17:02:02 eealloc: update commentary Even if we remove eealloc we might as well add commentary explaining some of its confusion, before we remove it. * lib/eealloc.h: Update comment. * modules/eealloc (Description): Update, since eealloc is not glibc compatible.
Bruno Haible 0026e803 2024-10-26T20:19:40 execute, spawn-pipe: Fix compilation error on Cygwin (regr. 2024-10-22). * lib/windows-path.h: Include <stdlib.h>.
Bruno Haible a61be742 2024-10-26T19:42:10 pipe-filter-gi: Correct documentation. Reported by Miro Palmu <email@miropalmu.cc> in <https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00199.html>. * lib/pipe-filter.h (pipe_filter_gi_create): Don't say that this function may return NULL.
Bruno Haible 52a75229 2024-10-25T21:59:45 eealloc: Relicense under LGPLv2+. Jim Meyering's approval is in <https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00192.html>. * modules/eealloc (License): Change to LGPLv2+. * lib/eealloc.h: Update license notice. * lib/eealloc.c: Likewise.
Paul Eggert ff052568 2024-10-24T21:55:46 realloc: minor style coalescing * lib/alignalloc.h (alignalloc): * lib/eealloc.h (eerealloc): * lib/ialloc.h (irealloc, ireallocarray): * lib/safe-alloc.h (safe_alloc_realloc_n): Adjust commentary and code to better match what’s used elsewhere. This doesn’t change behavior.
Paul Eggert 99c523bc 2024-10-24T21:52:19 xalloc: port to Cheri, strict C23, realloc null * lib/xmalloc.c [__CHERI_PURE_CAPABILITY__]: Include <cheri.h>. (xrealloc, xreallocarray): Support Cheri. Avoid undefined behavior in strict C23. Work better on platforms where realloc (p, 0) returns a null pointer
Paul Eggert b69be0f7 2024-10-24T21:34:12 reallocarray: simplify * lib/reallocarray.c (reallocarray): Use simpler workaround for realloc glitch, which does not involve malloc. * modules/reallocarray (Depends-on): Remove malloc-posix.
Bruno Haible 427249c6 2024-10-22T22:08:24 execute, spawn-pipe: Support DLL dependencies of Windows executables. Reported by Michele Locati <michele@locati.it>. * lib/windows-path.h: New file. * lib/windows-path.c: New file. * lib/windows-spawn.h (compose_envblock): Add new_PATH parameter. (spawnpvech): Add dll_dirs parameter. Call extended_PATH. * lib/windows-spawn.c: Include windows-path.h. (compose_envblock): Add new_PATH parameter. * modules/windows-spawn (Description): Now applies to Cygwin as well. (Files): Add lib/windows-path.h, lib/windows-path.c. (configure.ac): Define GL_COND_OBJ_WINDOWS_PATH. (Makefile.am): Conditionally compile windows-path.c. (Include): Add windows-path.h. * lib/spawni.c (__spawni): Update compose_envblock call. * lib/execute.h (execute): Add dll_dirs parameter. * lib/execute.c: Include windows-path.h. (execute): Add dll_dirs parameter. Pass it down to spawnpvech. Call extended_environ. * lib/spawn-pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi): Add dll_dirs parameter. * lib/spawn-pipe.c: Include windows-path.h. (create_pipe): Add dll_dirs parameter. Pass it down to spawnpvech. Call extended_environ. (create_pipe_bidi, create_pipe_in, create_pipe_out): Add dll_dirs parameter. * lib/javaexec.c (execute_java_class): Update execute invocations. * lib/cygpath.c (execute_and_read_line): Update create_pipe_in invocation. * lib/javaversion.c (execute_and_read_line): Likewise. * lib/csharpcomp.c (compile_csharp_using_mono, compile_csharp_using_dotnet, compile_csharp_using_sscli): Update execute, create_pipe_in invocations. * lib/csharpexec.c (execute_csharp_using_mono, execute_csharp_using_dotnet, execute_csharp_using_sscli): Likewise. * lib/javacomp.c (compile_using_envjavac, compile_using_javac, execute_and_read_line, is_javac_present): Likewise. * lib/pipe-filter-gi.c (pipe_filter_gi_create): Update create_pipe_bidi invocation. * lib/pipe-filter-ii.c (pipe_filter_ii_execute): Likewise. * tests/test-execute-main.c (main): Update execute invocations. * tests/test-execute-script.c (main): Likewise. * tests/test-spawn-pipe-main.c (main): Update create_pipe_bidi invocation. * tests/test-spawn-pipe-script.c (main): Update create_pipe_in invocations. * NEWS: Mention the changes.
Bruno Haible b3791b2b 2024-10-21T17:20:37 reallocarray: Don't assume unportable behaviour of realloc. * lib/reallocarray.c (reallocarray): Handle the nbytes==0 case explicitly. * modules/reallocarray (Depends-on): Remove realloc-gnu. Add malloc-posix, realloc-posix.
Bruno Haible 12cd6eca 2024-10-21T15:29:40 realloc: Optionally check for undefined behaviour. * m4/realloc.m4 (gl_FUNC_REALLOC_SANITIZED): New macro. (gl_FUNC_REALLOC_POSIX): Require it. If a sanitized realloc is requested, define NEED_SANITIZED_REALLOC and compile realloc.c. (gl_FUNC_REALLOC_GNU): Require it. If a sanitized realloc is requested, don't compile realloc.c a second time. * lib/realloc.c (rpl_realloc): If NEED_SANITIZED_REALLOC is defined, abort in the case of undefined behaviour.
Karl Berry 178c482e 2024-10-19T07:07:02 autoupdate
Bruno Haible dd07b748 2024-10-13T12:01:08 string-desc: New function string_desc_c_casecmp. * lib/string-desc.h: New declaration. * lib/string-desc.c: Include <limits.h>, c-ctype.h. (string_desc_c_casecmp): New function. * modules/string-desc (Depends-on): Add c-ctype. * tests/test-string-desc.c (main): Add tests of string_desc_c_casecmp.
Bruno Haible c3dd4f53 2024-10-13T11:35:12 string-desc: Fix categorization string_desc_new_addr. * lib/string-desc.h (string_desc_new_addr): Move to section "Side-effect-free operations". * lib/string-desc.c (string_desc_new_addr): Move accordingly.
Bruno Haible b0edcb79 2024-10-09T17:22:59 csharpcomp: Avoid error on Windows. Reported by Michele Locati <michele@locati.it>. * build-aux/csharpcomp.sh.in: Don't produce -reference options for DLLs whose name starts with a lowercase letter or contains '.Native.'. * lib/csharpcomp.c (name_is_dll): Filter our file names that start with a lowercase letter or contain '.Native.'.
Bruno Haible efa78d89 2024-10-09T03:20:00 csharpcomp: Add support for dotnet. * lib/csharpcomp.c: Include <dirent.h>, concat-filename.h, xvasprintf.h. (name_is_dll): New function, from lib/csharpexec.c. (compile_csharp_using_dotnet): New function. (compile_csharp_class): Invoke compile_csharp_using_dotnet. * modules/csharpcomp (Depends-on): Add xconcat-filename, scandir, alphasort, xvasprintf.
Bruno Haible a3004965 2024-10-09T03:14:04 csharpexec: Add support for dotnet. * lib/csharpexec.c: Include <dirent.h>, <errno.h>, <sys/stat.h>, dirname.h, concat-filename.h, canonicalize.h, spawn-pipe.h, wait-process.h, xalloc.h, copy-file.h, clean-temp-simple.h, clean-temp.h. (name_is_dll, execute_csharp_using_dotnet): New functions. (execute_csharp_program): Invoke execute_csharp_using_dotnet. * modules/csharpexec (Depends-on): Add stat, dirname, xconcat-filename, canonicalize, spawn-pipe, wait-process, scandir, alphasort, copy-file, clean-temp-simple, clean-temp.
Bruno Haible 5b3286f6 2024-10-09T03:09:15 csharpcomp: Behave like csharpcomp-script. * lib/csharpcomp.c (compile_csharp_using_sscli): Pass the option '-nologo' to csc.
Bruno Haible 5949b785 2024-10-09T03:05:33 csharpcomp: Fix memory management bug (regression yesterday). * lib/csharpcomp.c (compile_csharp_using_sscli): Allocate the source options with malloc() always, not sometimes with malloca() and sometimes with malloc().
Bruno Haible 25292435 2024-10-07T20:25:06 csharpcomp: Improve Cygwin support. * lib/csharpcomp.c: Include cygpath.h. (compile_csharp_using_sscli): Convert the file names passed to 'csc' to native Windows syntax. * modules/csharpcomp (Depends-on): Add cygpath.
Bruno Haible 04b68d47 2024-10-07T20:15:44 csharpexec: Improve Cygwin support. * lib/csharpexec.c: Include cygpath.h. (execute_csharp_using_sscli): Convert the first 'clix' argument to native Windows syntax. * modules/csharpexec (Depends-on): Add cygpath.
Bruno Haible 5312d8c4 2024-10-07T20:10:16 cygpath: New module. * lib/cygpath.h: New file. * lib/cygpath.c: New file, based on lib/javaversion.c. * modules/cygpath: New file.
Bruno Haible 6e398bee 2024-10-07T14:59:00 file-has-acl: Fix test failure on Cygwin. * lib/file-has-acl.c (file_has_aclinfo): On Cygwin, don't fail if acl_get_file (name, ACL_TYPE_DEFAULT) returns NULL on a file of unknown type.
Bruno Haible c3fe68e0 2024-10-07T14:30:52 file-has-acl: Fix performance regression on FreeBSD, Cygwin. * lib/dirent.in.h (_GL_DT_NOTDIR): New macro. * lib/acl.h (ACL_SYMLINK_FOLLOW): Increase value. * lib/file-has-acl.c (file_has_aclinfo): Don't call acl_get_file (name, ACL_TYPE_DEFAULT) if we know that name does not denote a directory. (file_has_acl): Extract from *SB the information that NAME is not a directory.
Bruno Haible fda64057 2024-10-07T13:52:59 file-has-acl: Fix comments. * lib/file-has-acl.c (file_has_aclinfo): Fix typo in comment.
Bruno Haible 593c2c3c 2024-10-07T01:14:20 javacomp, javaversion: Fix resource leak. * lib/javacomp.c (execute_and_read_line): When fdopen fails, terminate the program. * lib/javaversion.c (execute_and_read_line): Likewise. When we can't read a single line, call fclose and wait_subprocess, to free resources.
Paul Eggert 8e0c8d14 2024-10-04T21:07:09 mktime: improve thread-safety * lib/mktime.c (__mktime_internal) [!_LIBC]: Double the number of probes. Although this isn’t guaranteed to suffice, it should be good enough for practical applications, and fixing the problem in general would require access to the underlying tz state lock which would be hard to do.
Paul Eggert 64a179b2 2024-10-04T19:01:30 mktime: fix timegm bug that set tmp->tm_isdst * lib/timegm.c (__timegm64): Omit now-unnecessary initialization of tm_isdst. Anyway, the initialization was always wrong, since timegm should not modify *TMP when it fails.
Paul Eggert bcf84e57 2024-10-04T14:04:22 mktime: refactor to get closer to glibc * lib/mktime.c (convert_time): Reorder args. (__tz_convert): New macro. All convert_time callers changed to use it.
Bruno Haible e44763dd 2024-10-05T02:45:49 iconv_open: Fix undefined behaviour. Reported by Tim Sweet <tsweet64@protonmail.com> at <https://savannah.gnu.org/bugs/?66289>. * lib/iconv.c (utf32be_mbtowc, utf32le_mbtowc): Cast 'unsigned char' values to ucs4_t before shifting them to the left.
Bruno Haible 4e1edf9c 2024-10-04T23:52:13 bcp47: Refactor. * lib/bcp47.c (SCRIPT_*): New macros. (default_script_in_territory, default_script_for_language2, default_script_for_language3): New functions. (xpg_to_bcp47, bcp47_to_xpg): Use them.