tools/gnulib: update to branch stable-202501

Move to the June 2025 update of the first 2025 stable branch
in order to better support updating gettext to the latest versions.

More instances of blocking the defining of functions
that use reallocarray() is needed for portability with macOS
as more similar functions have been added.
And one instance is removed as the function was removed.
Refer to a previous commit to explain the need for this.

Manually adjusted patch:
 - 150-portable-tdestroy.patch
 - 160-flag-reallocarray.patch
 - 200-force-disable-after-configure.patch

Removed upstreamed patch:
 - 500-acl-function-name.patch

All other patches are automatically refreshed.

Ref: 5ade7ee60 ("tools/gnulib: add macros to skip reallocarray() functions")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Michael Pratt 2025-06-07 00:48:20 -04:00 committed by Robert Marko
parent 92d10e2cdf
commit d19f8bc199
8 changed files with 125 additions and 164 deletions

View File

@ -4,9 +4,9 @@ PKG_NAME:=gnulib
PKG_CPE_ID:=cpe:/a:gnu:$(PKG_NAME)
PKG_SOURCE_URL=git://git.git.savannah.gnu.org/$(PKG_NAME).git
PKG_SOURCE_DATE:=2025-05-03
PKG_SOURCE_VERSION:=320db6ee7a3cd44ee77f09d30c8a9002159beb4b# # stable-202407
PKG_MIRROR_HASH:=0c3d39a0d26381b042ac8e95d22b88bda99bc8cc3974b151b1de184c0f4ac1bf
PKG_SOURCE_DATE:=2025-07-01
PKG_SOURCE_VERSION:=a3151d456d6919c9066b54dc6f680452168165cf# # stable-202501
PKG_MIRROR_HASH:=b695d96e915ecd6c4551436f417cb2c0879aef4ef6318721c8d5cc86cb44ba9d
include $(INCLUDE_DIR)/host-build.mk

View File

@ -43,7 +43,7 @@
if [ ! "$inst_ver" ]; then
warn_ "Error: '$app' not found"
ret=1
@@ -1178,7 +1178,7 @@ autogen()
@@ -1205,7 +1205,7 @@ autogen()
# two just-pre-run programs.
# Import from gettext.

View File

@ -1,6 +1,6 @@
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -343,6 +343,34 @@ Options for --import, --add/remove-impor
@@ -344,6 +344,34 @@ Options for --import, --add/remove-impor
Report bugs to <bug-gnulib@gnu.org>."
}
@ -35,7 +35,7 @@
# func_version
# outputs to stdout the --version message.
func_version ()
@@ -1665,6 +1693,9 @@ func_determine_path_separator
@@ -1666,6 +1694,9 @@ func_determine_path_separator
fi
case "$autoconf_minversion" in
1.* | 2.[0-5]* | 2.6[0-3]*)

View File

@ -107,7 +107,7 @@
+#endif /* defined(_LIBC) || GNULIB_defined_tdestroy */
--- a/m4/search_h.m4
+++ b/m4/search_h.m4
@@ -40,7 +40,7 @@ AC_DEFUN_ONCE([gl_SEARCH_H],
@@ -41,7 +41,7 @@ AC_DEFUN_ONCE([gl_SEARCH_H],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <search.h>
@ -116,7 +116,7 @@
AC_REQUIRE([AC_C_RESTRICT])
])
@@ -76,8 +76,10 @@ AC_DEFUN([gl_SEARCH_H_DEFAULTS],
@@ -77,8 +77,10 @@ AC_DEFUN([gl_SEARCH_H_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LFIND], [1])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEARCH], [1])
dnl Assume proper GNU behavior unless another module says otherwise.
@ -133,7 +133,7 @@
])
--- a/m4/tsearch.m4
+++ b/m4/tsearch.m4
@@ -10,6 +10,7 @@ AC_DEFUN([gl_FUNC_TSEARCH],
@@ -11,6 +11,7 @@ AC_DEFUN([gl_FUNC_TSEARCH],
AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
gl_CHECK_FUNCS_ANDROID([twalk], [[#include <search.h>]])
@ -141,7 +141,7 @@
if test $ac_cv_func_tsearch = yes; then
dnl On OpenBSD 4.0, the return value of tdelete() is incorrect.
AC_REQUIRE([AC_PROG_CC])
@@ -51,6 +52,7 @@ main ()
@@ -52,6 +53,7 @@ main ()
*no)
REPLACE_TSEARCH=1
REPLACE_TWALK=1
@ -149,7 +149,7 @@
;;
esac
else
@@ -65,6 +67,12 @@ main ()
@@ -66,6 +68,12 @@ main ()
future*) REPLACE_TWALK=1 ;;
esac
fi
@ -162,8 +162,8 @@
])
# Prerequisites of lib/tsearch.c.
--- a/modules/search
+++ b/modules/search
--- a/modules/search-h
+++ b/modules/search-h
@@ -37,8 +37,10 @@ search.h: search.in.h $(top_builddir)/co
-e 's/@''GNULIB_MDA_LSEARCH''@/$(GNULIB_MDA_LSEARCH)/g' \
-e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \
@ -177,7 +177,7 @@
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
--- a/modules/tsearch
+++ b/modules/tsearch
@@ -11,7 +11,12 @@ search
@@ -11,7 +11,12 @@ search-h
configure.ac:
gl_FUNC_TSEARCH
gl_CONDITIONAL([GL_COND_OBJ_TSEARCH],

View File

@ -1,6 +1,6 @@
--- a/lib/ialloc.h
+++ b/lib/ialloc.h
@@ -106,6 +106,8 @@ icalloc (idx_t n, idx_t s)
@@ -91,6 +91,8 @@ icalloc (idx_t n, idx_t s)
return calloc (n, s);
}
@ -9,8 +9,8 @@
/* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size).
It returns a non-NULL pointer to num * size bytes of memory.
Upon failure, it returns NULL with errno set. */
@@ -131,6 +133,8 @@ ireallocarray (void *p, idx_t n, idx_t s
return _gl_alloc_nomem ();
@@ -102,6 +104,8 @@ ireallocarray (void *p, idx_t n, idx_t s
: _gl_alloc_nomem ());
}
+#endif /* GNULIB_REALLOCARRAY */
@ -57,7 +57,24 @@
new size. The new array will contain at least N_INCR_MIN more
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -129,6 +129,7 @@ char *xstrdup (char const *str)
@@ -81,10 +81,16 @@ void *xrealloc (void *p, size_t s)
_GL_ATTRIBUTE_ALLOC_SIZE ((2));
void *xirealloc (void *p, idx_t s)
_GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+# if GNULIB_REALLOCARRAY
+
void *xreallocarray (void *p, size_t n, size_t s)
_GL_ATTRIBUTE_ALLOC_SIZE ((2, 3));
void *xireallocarray (void *p, idx_t n, idx_t s)
_GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+# endif /* GNULIB_REALLOCARRAY */
+
void *x2realloc (void *p, size_t *ps) /* superseded by xpalloc */
_GL_ATTRIBUTE_RETURNS_NONNULL;
void *x2nrealloc (void *p, size_t *pn, size_t s) /* superseded by xpalloc */
@@ -129,6 +135,7 @@ char *xstrdup (char const *str)
# define XCALLOC(n, t) \
((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
@ -65,7 +82,7 @@
/* Allocate an array of N objects, each with S bytes of memory,
dynamically, with error checking. S must be nonzero. */
@@ -156,6 +157,8 @@ char *xcharalloc (size_t n)
@@ -156,6 +163,8 @@ char *xcharalloc (size_t n)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
_GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
@ -76,25 +93,15 @@
--- a/lib/safe-alloc.h
+++ b/lib/safe-alloc.h
@@ -40,6 +40,7 @@ _GL_INLINE_HEADER_BEGIN
@@ -37,7 +37,6 @@ _GL_INLINE_HEADER_BEGIN
extern "C" {
#endif
+#if GNULIB_REALLOCARRAY
/* Don't call these directly - use the macros below. */
SAFE_ALLOC_INLINE void *
@@ -56,6 +57,9 @@ safe_alloc_realloc_n (void *ptr, size_t
#endif
return ptr;
}
+
+#endif /* GNULIB_REALLOCARRAY */
+
-
/* Don't call this directly - use the macros below. */
_GL_ATTRIBUTE_NODISCARD SAFE_ALLOC_INLINE int
safe_alloc_check (void *ptr)
{
@@ -89,6 +93,8 @@ safe_alloc_check (void *ptr)
@@ -72,6 +71,8 @@ safe_alloc_check (void *ptr)
#define ALLOC_N(ptr, count) \
safe_alloc_check ((ptr) = calloc (count, sizeof *(ptr)))
@ -103,12 +110,85 @@
/**
* ALLOC_N_UNINITIALIZED:
* @ptr: pointer to allocated memory
@@ -117,6 +123,8 @@ safe_alloc_check (void *ptr)
@@ -100,6 +101,8 @@ safe_alloc_check (void *ptr)
#define REALLOC_N(ptr, count) \
safe_alloc_check ((ptr) = safe_alloc_realloc_n (ptr, count, sizeof *(ptr)))
safe_alloc_check ((ptr) = reallocarray (ptr, count, sizeof *(ptr)))
+#endif /* GNULIB_REALLOCARRAY */
+
/**
* FREE:
* @ptr: pointer holding address to be freed
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -1620,6 +1620,8 @@ lex (struct dfa *dfa)
}
}
+#if GNULIB_REALLOCARRAY
+
static void
addtok_mb (struct dfa *dfa, token t, char mbprop)
{
@@ -1674,6 +1676,8 @@ addtok_mb (struct dfa *dfa, token t, cha
}
}
+#endif /* GNULIB_REALLOCARRAY */
+
static void addtok_wc (struct dfa *dfa, wint_t wc);
/* Add the given token to the parse tree, maintaining the depth count and
@@ -2934,6 +2938,8 @@ dfaanalyze (struct dfa *d, bool searchfl
free (tmp.elems);
}
+#if GNULIB_REALLOCARRAY
+
/* Make sure D's state arrays are large enough to hold NEW_STATE. */
static void
realloc_trans_if_necessary (struct dfa *d)
@@ -2969,6 +2975,8 @@ realloc_trans_if_necessary (struct dfa *
}
}
+#endif /* GNULIB_REALLOCARRAY */
+
/*
Calculate the transition table for a new state derived from state s
for a compiled dfa d after input character uc, and return the new
@@ -4010,6 +4018,8 @@ freelist (char **cpp)
free (*cpp++);
}
+#if GNULIB_REALLOCARRAY
+
static char **
enlistnew (char **cpp, char *new)
{
@@ -4046,6 +4056,8 @@ enlist (char **cpp, char const *str, idx
return enlistnew (cpp, ximemdup0 (str, len));
}
+#endif /* GNULIB_REALLOCARRAY */
+
/* Given pointers to two strings, return a pointer to an allocated
list of their distinct common substrings. */
static char **
--- a/lib/readtokens.c
+++ b/lib/readtokens.c
@@ -128,6 +128,8 @@ readtoken (FILE *stream,
return i;
}
+#if GNULIB_REALLOCARRAY
+
/* Build a NULL-terminated array of pointers to tokens
read from STREAM. Return the number of tokens read.
All storage is obtained through calls to xmalloc-like functions.
@@ -190,3 +192,5 @@ readtokens (FILE *stream,
free (lengths);
return n_tokens;
}
+
+#endif /* GNULIB_REALLOCARRAY */

View File

@ -20,8 +20,8 @@
{
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1508,10 +1508,16 @@ _GL_FUNCDECL_RPL (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
@@ -1549,11 +1549,17 @@ _GL_FUNCDECL_RPL (reallocarray, void *,
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
+# if !GNULIB_defined_rpl_reallocarray
@ -30,7 +30,8 @@
# else
# if ! @HAVE_REALLOCARRAY@
_GL_FUNCDECL_SYS (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
(void *ptr, size_t nmemb, size_t size),
_GL_ATTRIBUTE_NODISCARD);
+# if !GNULIB_defined_reallocarray
+# define GNULIB_defined_reallocarray 1
+# endif
@ -49,7 +50,7 @@
reallocarray (void *ptr, size_t nmemb, size_t size)
{
@@ -36,3 +38,5 @@ reallocarray (void *ptr, size_t nmemb, s
/* Rely on the semantics of GNU realloc. */
/* Call realloc, setting errno to ENOMEM on failure. */
return realloc (ptr, nbytes);
}
+

View File

@ -69,7 +69,7 @@
+AC_DEFUN([gl_PREREQ_POSIX_FALLOCATE], [:])
--- a/m4/fcntl_h.m4
+++ b/m4/fcntl_h.m4
@@ -25,7 +25,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H],
@@ -26,7 +26,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H],
dnl corresponding gnulib module is not in use, if it is not common
dnl enough to be declared everywhere.
gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
@ -78,7 +78,7 @@
])
# gl_FCNTL_MODULE_INDICATOR([modulename])
@@ -52,6 +52,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
@@ -53,6 +53,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
@ -86,7 +86,7 @@
dnl Support Microsoft deprecated alias function names by default.
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
@@ -63,10 +64,12 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
@@ -64,10 +65,12 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
[
dnl Assume proper GNU behavior unless another module says otherwise.
@ -127,7 +127,7 @@
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -239,6 +239,33 @@ _GL_WARN_ON_USE (openat, "openat is not
@@ -241,6 +241,33 @@ _GL_WARN_ON_USE (openat, "openat is not
# endif
#endif
@ -316,7 +316,7 @@
+}
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2552,6 +2552,7 @@ func_all_modules ()
@@ -2555,6 +2555,7 @@ func_all_modules ()
func_module execve
func_module execvp
func_module execvpe

View File

@ -1,120 +0,0 @@
From 8a71833114c376212ecdd56495604905f6aa218d Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 24 Aug 2024 17:58:48 +0200
Subject: acl: First step towards more consistent function names.
* lib/acl.h (xset_acl): New declaration.
(set_acl): Mark deprecated.
(xcopy_acl): New declaration.
(copy_acl): Mark deprecated.
* lib/set-acl.c (xset_acl): Renamed from set_acl.
(set_acl): New function.
* lib/copy-acl.c (xcopy_acl): Renamed from copy_acl.
(copy_acl): New function.
* tests/test-set-mode-acl.c (main): Test xset_acl instead of set_acl.
* tests/test-copy-acl.c (main): Test xcopy_acl instead of copy_acl.
---
lib/acl.h | 14 +++++++++++---
lib/copy-acl.c | 11 +++++++++--
lib/set-acl.c | 8 +++++++-
tests/test-copy-acl.c | 2 +-
tests/test-set-mode-acl.c | 2 +-
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -20,7 +20,7 @@
#ifndef _GL_ACL_H
#define _GL_ACL_H 1
-/* This file uses _GL_ATTRIBUTE_CONST. */
+/* This file uses _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_DEPRECATED. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -35,10 +35,18 @@ extern "C" {
bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST;
int file_has_acl (char const *, struct stat const *);
+
int qset_acl (char const *, int, mode_t);
-int set_acl (char const *, int, mode_t);
+int xset_acl (char const *, int, mode_t);
+/* Old name of xset_acl. */
+_GL_ATTRIBUTE_DEPRECATED int set_acl (char const *, int, mode_t);
+
int qcopy_acl (char const *, int, char const *, int, mode_t);
-int copy_acl (char const *, int, char const *, int, mode_t);
+int xcopy_acl (char const *, int, char const *, int, mode_t);
+/* Old name of xcopy_acl. */
+_GL_ATTRIBUTE_DEPRECATED int copy_acl (char const *, int, char const *, int,
+ mode_t);
+
int chmod_or_fchmod (char const *, int, mode_t);
--- a/lib/copy-acl.c
+++ b/lib/copy-acl.c
@@ -40,8 +40,8 @@
negative error code. */
int
-copy_acl (const char *src_name, int source_desc, const char *dst_name,
- int dest_desc, mode_t mode)
+xcopy_acl (const char *src_name, int source_desc, const char *dst_name,
+ int dest_desc, mode_t mode)
{
int ret = qcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
switch (ret)
@@ -59,3 +59,10 @@ copy_acl (const char *src_name, int sour
}
return ret;
}
+
+int
+copy_acl (const char *src_name, int source_desc, const char *dst_name,
+ int dest_desc, mode_t mode)
+{
+ return xcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
+}
--- a/lib/set-acl.c
+++ b/lib/set-acl.c
@@ -39,10 +39,16 @@
return -1. */
int
-set_acl (char const *name, int desc, mode_t mode)
+xset_acl (char const *name, int desc, mode_t mode)
{
int ret = qset_acl (name, desc, mode);
if (ret != 0)
error (0, errno, _("setting permissions for %s"), quote (name));
return ret;
}
+
+int
+set_acl (char const *name, int desc, mode_t mode)
+{
+ return xset_acl (name, desc, mode);
+}
--- a/tests/test-copy-acl.c
+++ b/tests/test-copy-acl.c
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
}
#if USE_ACL
- if (copy_acl (file1, fd1, file2, fd2, mode))
+ if (xcopy_acl (file1, fd1, file2, fd2, mode))
exit (EXIT_FAILURE);
#else
chmod (file2, mode);
--- a/tests/test-set-mode-acl.c
+++ b/tests/test-set-mode-acl.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
file = argv[1];
mode = strtol (argv[2], NULL, 8);
- set_acl (file, -1, mode);
+ xset_acl (file, -1, mode);
return test_exit_status;
}