]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
tools/gnulib: update to branch stable-202407
authorMichael Pratt <mcpratt@pm.me>
Tue, 6 May 2025 17:57:24 +0000 (13:57 -0400)
committerRobert Marko <robimarko@gmail.com>
Sat, 26 Jul 2025 12:38:07 +0000 (14:38 +0200)
Bump to the next stable branch with the May 2025 update.

Add a patch to compensate for gnulib-tool being further split up
into independent shell and python implementations
by using a non-hidden version of the main.py file.

Add a patch for the python implementation of gnulib-tool
in order to ignore the required version of autoconf in configure.ac
being lower than the required version of autoconf for gnulib
if the version that is being run exceeds the required version for both,
and adjust existing autoconf version shell script patch to new filename.

Backport a patch for a change in function naming convention
for forward compatibility with tool releases after this stable branch.

Added:
 - 020-python-version.patch
 - 021-python-main.patch
 - 500-acl-function-name.patch

Manually Adjusted:
 - 010-autoconf-version.patch
 - 160-flag-reallocarray.patch

Existing patches are automatically refreshed.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
tools/gnulib/Makefile
tools/gnulib/patches/000-bootstrap.patch
tools/gnulib/patches/010-autoconf-version.patch
tools/gnulib/patches/020-python-version.patch [new file with mode: 0644]
tools/gnulib/patches/021-python-main.patch [new file with mode: 0644]
tools/gnulib/patches/150-portable-tdestroy.patch
tools/gnulib/patches/160-flag-reallocarray.patch
tools/gnulib/patches/200-force-disable-after-configure.patch
tools/gnulib/patches/320-modules-fallocate-posix.patch
tools/gnulib/patches/500-acl-function-name.patch [new file with mode: 0644]

index 51193555225b74b0fff2b9b17586ca098f901826..f708299549f29de57ff141806aaa4cb5d81d23c2 100644 (file)
@@ -2,11 +2,11 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnulib
 PKG_CPE_ID:=cpe:/a:gnu:$(PKG_NAME)
-PKG_VERSION:=c99c8d491850dc3a6e0b8604a2729d8bc5c0eff1# # stable-202401
+PKG_VERSION:=320db6ee7a3cd44ee77f09d30c8a9002159beb4b# # stable-202407
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://git.savannah.gnu.org/cgit/$(PKG_NAME).git/snapshot
-PKG_HASH:=8e6f4a907d9677b55fd452e1340a3e030a6f530b138d420c11975da33f086b1e
+PKG_HASH:=0be734e8c5f88e259bd593d63da2be275b93aedb551ccdcd78db9825bddeb94e
 
 include $(INCLUDE_DIR)/host-build.mk
 
index 120586694ec2bf5a57ba282ab6fb180c6a48d6b8..30a62e9bdb0b186b9d26aca557dcb7c5c5fec18f 100644 (file)
@@ -43,7 +43,7 @@
        if [ ! "$inst_ver" ]; then
          warn_ "Error: '$app' not found"
          ret=1
-@@ -1157,7 +1157,7 @@ autogen()
+@@ -1178,7 +1178,7 @@ autogen()
    # two just-pre-run programs.
  
    # Import from gettext.
index a091bb2e1d29e51e95c18fd275d82995c99997af..7726cc47a1ee542caa6f342ee56fef2834f0ac6b 100644 (file)
@@ -1,6 +1,6 @@
---- a/gnulib-tool
-+++ b/gnulib-tool
-@@ -346,6 +346,34 @@ Options for --import, --add/remove-impor
+--- a/gnulib-tool.sh
++++ b/gnulib-tool.sh
+@@ -343,6 +343,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 ()
-@@ -1620,6 +1648,9 @@ func_determine_path_separator
+@@ -1665,6 +1693,9 @@ func_determine_path_separator
    fi
    case "$autoconf_minversion" in
      1.* | 2.[0-5]* | 2.6[0-3]*)
diff --git a/tools/gnulib/patches/020-python-version.patch b/tools/gnulib/patches/020-python-version.patch
new file mode 100644 (file)
index 0000000..f018243
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/pygnulib/functions.py
++++ b/pygnulib/functions.py
+@@ -16,6 +16,8 @@
+ from __future__ import annotations
+ import os.path
++import re
++import subprocess as sp
+ from .constants import substart
+ from .GLConfig import GLConfig
+@@ -50,3 +52,15 @@ def rewrite_file_name(file_name: str, co
+     else:  # file is not a special file
+         result = file_name
+     return os.path.normpath(result)
++
++def get_version(app: str) -> str:
++    result = sp.run([app, '--version'], capture_output=True, text=True)
++    version = re.sub(r".*[v ]([0-9])", r"\1", result.stdout)
++    version_lines = [line for line in version.splitlines() if re.search(r"^[0-9]", line)]
++    version = '\n'.join(version_lines) + "\n"
++    version = re.sub(r"[^.a-z0-9-\n].*", r"", version)
++    version = re.sub(r"^([0-9]*)[a-z-].*", r"\1", version, 1)
++    version = re.sub(r"\.0*([1-9])", r".\1", version)
++    version_lines = [line for line in version.splitlines() if line.strip()]
++    version = ''.join(version_lines[0]) + "\n"
++    return version.strip()
+--- a/pygnulib/GLImport.py
++++ b/pygnulib/GLImport.py
+@@ -40,6 +40,7 @@ from .constants import (
+     rmtree,
+ )
+ from .functions import rewrite_file_name
++from .functions import get_version
+ from .GLError import GLError
+ from .GLConfig import GLConfig
+ from .GLModuleSystem import GLModuleTable
+@@ -125,7 +126,8 @@ class GLImport:
+                             for version in versions })
+             self.config.setAutoconfVersion(version)
+             if version < 2.64:
+-                raise GLError(4, version)
++                # If the version of autoconf in use is high enough, do not error.
++                if float(get_version('autoconf')) < 2.64: raise GLError(4, version)
+         # Get other cached variables.
+         path = joinpath(self.config['m4base'], 'gnulib-cache.m4')
diff --git a/tools/gnulib/patches/021-python-main.patch b/tools/gnulib/patches/021-python-main.patch
new file mode 100644 (file)
index 0000000..1edb1d2
--- /dev/null
@@ -0,0 +1,15 @@
+--- /dev/null
++++ b/gnulib-tool-main.py
+@@ -0,0 +1,4 @@
++from pygnulib import main
++
++if __name__ == '__main__':
++    main.main_with_exception_handling()
+--- a/gnulib-tool.py
++++ b/gnulib-tool.py
+@@ -157,4 +157,4 @@ fi
+ profiler_args=
+ # For profiling, cf. <https://docs.python.org/3/library/profile.html>.
+ #profiler_args="-m cProfile -s tottime"
+-exec python3 $profiler_args "$gnulib_dir/.gnulib-tool.py" "$@"
++exec python3 $profiler_args "$gnulib_dir/gnulib-tool-main.py" "$@"
index 39c291f196fdcd0d26964ec61a700f7689b8bcea..ae08d4c303edaf680f4dc40e3274a67790a419f3 100644 (file)
 +#endif /* defined(_LIBC) || GNULIB_defined_tdestroy */
 --- a/m4/search_h.m4
 +++ b/m4/search_h.m4
-@@ -39,7 +39,7 @@ AC_DEFUN_ONCE([gl_SEARCH_H],
+@@ -40,7 +40,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>
  
    AC_REQUIRE([AC_C_RESTRICT])
  ])
-@@ -75,8 +75,10 @@ AC_DEFUN([gl_SEARCH_H_DEFAULTS],
+@@ -76,8 +76,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.
  ])
 --- a/m4/tsearch.m4
 +++ b/m4/tsearch.m4
-@@ -9,6 +9,7 @@ AC_DEFUN([gl_FUNC_TSEARCH],
+@@ -10,6 +10,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>]])
    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])
-@@ -50,6 +51,7 @@ main ()
+@@ -51,6 +52,7 @@ main ()
        *no)
          REPLACE_TSEARCH=1
          REPLACE_TWALK=1
          ;;
      esac
    else
-@@ -64,6 +66,12 @@ main ()
+@@ -65,6 +67,12 @@ main ()
        future*) REPLACE_TWALK=1 ;;
      esac
    fi
index 8ffe273e1178595eace17dd37ac2026d9a326f77..f758b86e707c676cd135956ddeb034b308ae4c13 100644 (file)
@@ -21,7 +21,7 @@
 --- a/lib/xmalloc.c
 +++ b/lib/xmalloc.c
 @@ -51,12 +51,16 @@ ximalloc (idx_t s)
-   return nonnull (imalloc (s));
+   return check_nonnull (imalloc (s));
  }
  
 +#if GNULIB_REALLOCARRAY
@@ -38,7 +38,7 @@
     with error checking.  */
  
 @@ -75,6 +79,8 @@ xirealloc (void *p, idx_t s)
-   return nonnull (irealloc (p, s));
+   return check_nonnull (irealloc (p, s));
  }
  
 +#if GNULIB_REALLOCARRAY
  
 --- a/lib/safe-alloc.h
 +++ b/lib/safe-alloc.h
-@@ -36,6 +36,8 @@ _GL_INLINE_HEADER_BEGIN
- # define SAFE_ALLOC_INLINE _GL_INLINE
+@@ -40,6 +40,7 @@ _GL_INLINE_HEADER_BEGIN
+ extern "C" {
  #endif
  
 +#if GNULIB_REALLOCARRAY
-+
  /* Don't call these directly - use the macros below.  */
  SAFE_ALLOC_INLINE void *
- safe_alloc_realloc_n (void *ptr, size_t count, size_t size)
-@@ -51,6 +53,9 @@ safe_alloc_realloc_n (void *ptr, size_t
+@@ -56,6 +57,9 @@ safe_alloc_realloc_n (void *ptr, size_t
  #endif
    return ptr;
  }
@@ -95,7 +94,7 @@
  _GL_ATTRIBUTE_NODISCARD SAFE_ALLOC_INLINE int
  safe_alloc_check (void *ptr)
  {
-@@ -84,6 +89,8 @@ safe_alloc_check (void *ptr)
+@@ -89,6 +93,8 @@ safe_alloc_check (void *ptr)
  #define ALLOC_N(ptr, count) \
    safe_alloc_check ((ptr) = calloc (count, sizeof *(ptr)))
  
  /**
   * ALLOC_N_UNINITIALIZED:
   * @ptr: pointer to allocated memory
-@@ -112,6 +119,8 @@ safe_alloc_check (void *ptr)
+@@ -117,6 +123,8 @@ safe_alloc_check (void *ptr)
  #define REALLOC_N(ptr, count) \
    safe_alloc_check ((ptr) = safe_alloc_realloc_n (ptr, count, sizeof *(ptr)))
  
index 55335b27d2fbb07a8a2d1a912b114d1dd26422ea..34ca77610a3602dadd7c77cd29480920fb634d6f 100644 (file)
@@ -20,7 +20,7 @@
  {
 --- a/lib/stdlib.in.h
 +++ b/lib/stdlib.in.h
-@@ -1447,10 +1447,16 @@ _GL_FUNCDECL_RPL (reallocarray, void *,
+@@ -1508,10 +1508,16 @@ _GL_FUNCDECL_RPL (reallocarray, void *,
                    (void *ptr, size_t nmemb, size_t size));
  _GL_CXXALIAS_RPL (reallocarray, void *,
                    (void *ptr, size_t nmemb, size_t size));
index e30a7172aaf3b0e513fea0c70abba9f8e4447bfa..d6f614eaa7c79cd68d02597fbea23e484baf18ce 100644 (file)
@@ -69,7 +69,7 @@
 +AC_DEFUN([gl_PREREQ_POSIX_FALLOCATE], [:])
 --- a/m4/fcntl_h.m4
 +++ b/m4/fcntl_h.m4
-@@ -23,7 +23,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H],
+@@ -25,7 +25,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])
-@@ -50,6 +50,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
+@@ -52,6 +52,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])
-@@ -61,10 +62,12 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
+@@ -63,10 +64,12 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
  AC_DEFUN([gl_FCNTL_H_DEFAULTS],
  [
    dnl Assume proper GNU behavior unless another module says otherwise.
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 --- a/lib/fcntl.in.h
 +++ b/lib/fcntl.in.h
-@@ -238,6 +238,33 @@ _GL_WARN_ON_USE (openat, "openat is not
+@@ -239,6 +239,33 @@ _GL_WARN_ON_USE (openat, "openat is not
  # endif
  #endif
  
diff --git a/tools/gnulib/patches/500-acl-function-name.patch b/tools/gnulib/patches/500-acl-function-name.patch
new file mode 100644 (file)
index 0000000..372a80d
--- /dev/null
@@ -0,0 +1,120 @@
+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;
+ }