diff --git a/tools/gnulib/Makefile b/tools/gnulib/Makefile index 5119355522..f708299549 100644 --- a/tools/gnulib/Makefile +++ b/tools/gnulib/Makefile @@ -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 diff --git a/tools/gnulib/patches/000-bootstrap.patch b/tools/gnulib/patches/000-bootstrap.patch index 120586694e..30a62e9bdb 100644 --- a/tools/gnulib/patches/000-bootstrap.patch +++ b/tools/gnulib/patches/000-bootstrap.patch @@ -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. diff --git a/tools/gnulib/patches/010-autoconf-version.patch b/tools/gnulib/patches/010-autoconf-version.patch index a091bb2e1d..7726cc47a1 100644 --- a/tools/gnulib/patches/010-autoconf-version.patch +++ b/tools/gnulib/patches/010-autoconf-version.patch @@ -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 ." } @@ -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 index 0000000000..f0182438d5 --- /dev/null +++ b/tools/gnulib/patches/020-python-version.patch @@ -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 index 0000000000..1edb1d28a9 --- /dev/null +++ b/tools/gnulib/patches/021-python-main.patch @@ -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. . + #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" "$@" diff --git a/tools/gnulib/patches/150-portable-tdestroy.patch b/tools/gnulib/patches/150-portable-tdestroy.patch index 39c291f196..ae08d4c303 100644 --- a/tools/gnulib/patches/150-portable-tdestroy.patch +++ b/tools/gnulib/patches/150-portable-tdestroy.patch @@ -107,7 +107,7 @@ +#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 @@ -116,7 +116,7 @@ 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. @@ -133,7 +133,7 @@ ]) --- 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 ]]) gl_CHECK_FUNCS_ANDROID([twalk], [[#include ]]) @@ -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]) -@@ -50,6 +51,7 @@ main () +@@ -51,6 +52,7 @@ main () *no) REPLACE_TSEARCH=1 REPLACE_TWALK=1 @@ -149,7 +149,7 @@ ;; esac else -@@ -64,6 +66,12 @@ main () +@@ -65,6 +67,12 @@ main () future*) REPLACE_TWALK=1 ;; esac fi diff --git a/tools/gnulib/patches/160-flag-reallocarray.patch b/tools/gnulib/patches/160-flag-reallocarray.patch index 8ffe273e11..f758b86e70 100644 --- a/tools/gnulib/patches/160-flag-reallocarray.patch +++ b/tools/gnulib/patches/160-flag-reallocarray.patch @@ -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 @@ -76,16 +76,15 @@ --- 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))) @@ -104,7 +103,7 @@ /** * 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))) diff --git a/tools/gnulib/patches/200-force-disable-after-configure.patch b/tools/gnulib/patches/200-force-disable-after-configure.patch index 55335b27d2..34ca77610a 100644 --- a/tools/gnulib/patches/200-force-disable-after-configure.patch +++ b/tools/gnulib/patches/200-force-disable-after-configure.patch @@ -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)); diff --git a/tools/gnulib/patches/320-modules-fallocate-posix.patch b/tools/gnulib/patches/320-modules-fallocate-posix.patch index e30a7172aa..d6f614eaa7 100644 --- a/tools/gnulib/patches/320-modules-fallocate-posix.patch +++ b/tools/gnulib/patches/320-modules-fallocate-posix.patch @@ -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 @@ -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. @@ -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 -@@ -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 index 0000000000..372a80d10d --- /dev/null +++ b/tools/gnulib/patches/500-acl-function-name.patch @@ -0,0 +1,120 @@ +From 8a71833114c376212ecdd56495604905f6aa218d Mon Sep 17 00:00:00 2001 +From: Bruno Haible +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; + }