Skip to contentSkip to conversation

Update gnulib and drop patches

PATCH Superseded Robbie Harwood 2 participants 10 messages Jan 26, 2022 – Jan 27, 2022

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 cover Update gnulib and drop patches

This patchset is an expansion of "Drop gnulib fix-base64.patch" and rolls us forward to current gnulib development head. Not carrying patches means we don't have to maintain a gnulib tree (nor do downstream distros). It also allows us to pull in static analyzer fixes that gnulib has applied.

I've attempted to address concerns from previous review about _GL_* stuff, but it's possible I've misunderstood the request there.

fix-width.patch has not merged upstream. A version has been proposed, but would need significant rewrite. It doesn't seem worth the effort to carry, and once this changeset merges to grub, it becomes easier to increment our gnulib version if something like it ever does merge there.

Be well,
--Robbie

Robbie Harwood (4):
Use visual indentation in config.h.in Drop gnulib fix-base64.patch
Drop gnulib no-abort.patch
Update gnulib version and drop all gnulib patches

 bootstrap                                     | 297 ++++++++++--------
 bootstrap.conf                                |  14 +-
 conf/Makefile.extra-dist                      |  10 -
 config.h.in                                   |  78 +++--
 configure.ac                                  |   2 +-
 grub-core/Makefile.core.def                   |   1 +
 grub-core/lib/gnulib-patches/fix-base64.patch |  21 --
 .../lib/gnulib-patches/fix-null-deref.patch   |  13 -
 .../gnulib-patches/fix-null-state-deref.patch |  12 -
 .../fix-regcomp-uninit-token.patch            |  15 -
 .../fix-regexec-null-deref.patch              |  12 -
 .../gnulib-patches/fix-uninit-structure.patch |  11 -
 .../lib/gnulib-patches/fix-unused-value.patch |  14 -
 grub-core/lib/gnulib-patches/fix-width.patch  | 217 -------------
 grub-core/lib/gnulib-patches/no-abort.patch   |  26 --
 grub-core/lib/posix_wrap/sys/types.h          |   7 +-
 grub-core/lib/xzembed/xz.h                    |   5 +-
 17 files changed, 226 insertions(+), 529 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch
 delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/4 Use visual indentation in config.h.in

---
 config.h.in | 56 ++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)
config.h.in +28 -28
index 9e8f9911b..1c8c05b9c 100644
@@ -22,46 +22,46 @@
 #define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1
 
 #if defined (GRUB_BUILD)
-#undef ENABLE_NLS
-#define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@
-#define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@
-#if defined __APPLE__
-# if defined __BIG_ENDIAN__
-#  define BUILD_WORDS_BIGENDIAN 1
-# else
-#  define BUILD_WORDS_BIGENDIAN 0
-# endif
-#else
-#define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@
-#endif
+#  undef ENABLE_NLS
+#  define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@
+#  define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@
+#  if defined __APPLE__
+#    if defined __BIG_ENDIAN__
+#      define BUILD_WORDS_BIGENDIAN 1
+#    else
+#      define BUILD_WORDS_BIGENDIAN 0
+#    endif
+#  else /* !defined __APPLE__ */
+#    define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@
+#  endif /* !defined __APPLE__ */
 #elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
-#include <config-util.h>
-#else
-#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
+#  include <config-util.h>
+#else /* !defined GRUB_UTIL && defined GRUB_MACHINE */
+#  define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
 /* Define if C symbols get an underscore after compilation. */
-#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
+#  define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
 /* Define it to one of __bss_start, edata and _edata.  */
-#define BSS_START_SYMBOL @BSS_START_SYMBOL@
+#  define BSS_START_SYMBOL @BSS_START_SYMBOL@
 /* Define it to either end or _end.  */
-#define END_SYMBOL @END_SYMBOL@
+#  define END_SYMBOL @END_SYMBOL@
 /* Name of package.  */
-#define PACKAGE "@PACKAGE@"
+#  define PACKAGE "@PACKAGE@"
 /* Version number of package.  */
-#define VERSION "@VERSION@"
+#  define VERSION "@VERSION@"
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "@PACKAGE_STRING@"
+#  define PACKAGE_STRING "@PACKAGE_STRING@"
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+#  define PACKAGE_VERSION "@PACKAGE_VERSION@"
 /* Define to the full name of this package. */
-#define PACKAGE_NAME "@PACKAGE_NAME@"
+#  define PACKAGE_NAME "@PACKAGE_NAME@"
 /* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+#  define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
 
-#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
-#define GRUB_PLATFORM "@GRUB_PLATFORM@"
+#  define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
+#  define GRUB_PLATFORM "@GRUB_PLATFORM@"
 
-#define RE_ENABLE_I18N 1
+#  define RE_ENABLE_I18N 1
 
-#define _GNU_SOURCE 1
+#  define _GNU_SOURCE 1
 
 #endif
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/4 Drop gnulib fix-base64.patch

In reply to Robbie Harwood

Originally added in 9fbdec2f6b4fa8b549daa4d49134d1fe89d95ef9 and subsequently modified in 552c9fd08122a3036c724ce96dfe68aa2f75705f, fix-base64.patch handled two problems we have using gnulib, which are exerciesd by the base64 module but not directly caused by it.

First, grub2 defines its own bool type, while gnulib expects the equivalent of stdbool.h to be present. Rather than patching gnulib, instead use gnulib's stdbool module to provide a bool type if needed. (Suggested by Simon Josefsson.)

Second, our config.h doesn't always inherit config-util.h, which is where gnulib-related options like _GL_ATTRIBUTE_CONST end up. fix-base64.h worked around this by defining the attribute away, but this workaround is better placed in config.h itself, not a gnulib patch.

---
 bootstrap.conf                                |  3 ++-
 conf/Makefile.extra-dist                      |  1 -
 config.h.in                                   |  2 ++
 grub-core/lib/gnulib-patches/fix-base64.patch | 21 -------------------
 grub-core/lib/posix_wrap/sys/types.h          |  7 +++----
 grub-core/lib/xzembed/xz.h                    |  5 +----
 6 files changed, 8 insertions(+), 31 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
bootstrap.conf +2 -1
index 0dd893c5c..21a8cf15d 100644
@@ -35,6 +35,7 @@ gnulib_modules="
   realloc-gnu
   regex
   save-cwd
+  stdbool
 "
 
 gnulib_tool_option_extras="\
@@ -80,7 +81,7 @@ cp -a INSTALL INSTALL.grub
 
 bootstrap_post_import_hook () {
   set -e
-  for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
+  for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
       fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do
     patch -d grub-core/lib/gnulib -p2 \
       < "grub-core/lib/gnulib-patches/$patchname.patch"
conf/Makefile.extra-dist +0 -1
index 8f1485d52..15a9b74e9 100644
@@ -28,7 +28,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
 EXTRA_DIST += grub-core/genemuinit.sh
 EXTRA_DIST += grub-core/genemuinitheader.sh
 
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
config.h.in +2 -0
index 1c8c05b9c..751802f91 100644
@@ -64,4 +64,6 @@
 
 #  define _GNU_SOURCE 1
 
+#  define _GL_ATTRIBUTE_CONST
+
 #endif
grub-core/lib/gnulib-patches/fix-base64.patch deleted +0 -21
deleted file mode 100644
index 985db1279..000000000
@@ -1,21 +0,0 @@
-diff --git a/lib/base64.h b/lib/base64.h
-index 9cd0183b8..185a2afa1 100644
---- a/lib/base64.h
-+++ b/lib/base64.h
-@@ -21,8 +21,14 @@
- /* Get size_t. */
- # include <stddef.h>
- 
--/* Get bool. */
--# include <stdbool.h>
-+#ifndef GRUB_POSIX_BOOL_DEFINED
-+typedef enum { false = 0, true = 1 } bool;
-+#define GRUB_POSIX_BOOL_DEFINED 1
-+#endif
-+
-+#ifndef _GL_ATTRIBUTE_CONST
-+# define _GL_ATTRIBUTE_CONST /* empty */
-+#endif
- 
- # ifdef __cplusplus
- extern "C" {
grub-core/lib/posix_wrap/sys/types.h +3 -4
index 854eb0122..eeda543c4 100644
@@ -23,11 +23,10 @@
 
 #include <stddef.h>
 
+/* Provided by gnulib if not present. */
+#include <stdbool.h>
+
 typedef grub_ssize_t ssize_t;
-#ifndef GRUB_POSIX_BOOL_DEFINED
-typedef enum { false = 0, true = 1 } bool;
-#define GRUB_POSIX_BOOL_DEFINED 1
-#endif
 
 typedef grub_uint8_t uint8_t;
 typedef grub_uint16_t uint16_t;
grub-core/lib/xzembed/xz.h +1 -4
index f7b32d800..d1417039a 100644
@@ -29,10 +29,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <grub/misc.h>
-
-#ifndef GRUB_POSIX_BOOL_DEFINED
-typedef enum { false = 0, true = 1 } bool;
-#endif
+#include <stdbool.h>
 
 /**
  * enum xz_ret - Return codes
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/4 Drop gnulib no-abort.patch

In reply to Robbie Harwood

Originally added in db7337a3d353a817ffe9eb4a3702120527100be9, this patched out all relevant invocations of abort() in gnulib. While it was not documented why at the time, testing suggests that there's no abort() implementation available for gnulib to use.

gnulib's position is that the use of abort() is correct here, since it happens when input violates a "shall" from POSIX. Additionally, the code in question is probably not reachable. Since abort() is more friendly to user-space, they prefer to make no change, so we can just carry a define instead. (Suggested by Paul Eggert.)

---
 bootstrap.conf                              |  2 +-
 conf/Makefile.extra-dist                    |  1 -
 config.h.in                                 |  3 +++
 grub-core/lib/gnulib-patches/no-abort.patch | 26 ---------------------
 4 files changed, 4 insertions(+), 28 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch
bootstrap.conf +1 -1
index 21a8cf15d..71acbeeb1 100644
@@ -82,7 +82,7 @@ cp -a INSTALL INSTALL.grub
 bootstrap_post_import_hook () {
   set -e
   for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do
+      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do
     patch -d grub-core/lib/gnulib -p2 \
       < "grub-core/lib/gnulib-patches/$patchname.patch"
   done
conf/Makefile.extra-dist +0 -1
index 15a9b74e9..4ddc3c8f7 100644
@@ -35,7 +35,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
 
 EXTRA_DIST += grub-core/lib/libgcrypt
 EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
config.h.in +3 -0
index 751802f91..66c16abfd 100644
@@ -66,4 +66,7 @@
 
 #  define _GL_ATTRIBUTE_CONST
 
+/* We don't have an abort() for gnulib to call in regexp. */
+#  define abort() DEBUG_ASSERT(0)
+
 #endif
grub-core/lib/gnulib-patches/no-abort.patch deleted +0 -26
deleted file mode 100644
index e469c4762..000000000
@@ -1,26 +0,0 @@
-diff --git a/lib/regcomp.c b/lib/regcomp.c
-index cc85f35ac..de45ebb5c 100644
---- a/lib/regcomp.c
-+++ b/lib/regcomp.c
-@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
-        to this routine.  If we are given anything else, or if other regex
-        code generates an invalid error code, then the program has a bug.
-        Dump core so we can fix it.  */
--    abort ();
--
--  msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
-+    msg = gettext ("unknown regexp error");
-+  else
-+    msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
- 
-   msg_size = strlen (msg) + 1; /* Includes the null.  */
- 
-@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa)
- 	}
- 	break;
-       default:
--	abort ();
-+	break;
-       }
- 
-   if (mb_chars || has_period)
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 4/4 Update gnulib version and drop all gnulib patches

In reply to Robbie Harwood

In addition to the changes carried in our gnulib patches, several Coverity and code hygiene fixes that were previously downstream are also included in this 3-year gnulib increment.

Bump minimum autoconf version from 2.63 to 2.64 as required by gnulib.

Sync bootstrap script itself with gnulib.

Update regexp module for new dynarray dependency.

---
 bootstrap                                     | 297 ++++++++++--------
 bootstrap.conf                                |  13 +-
 conf/Makefile.extra-dist                      |   8 -
 config.h.in                                   |  17 +
 configure.ac                                  |   2 +-
 grub-core/Makefile.core.def                   |   1 +
 .../lib/gnulib-patches/fix-null-deref.patch   |  13 -
 .../gnulib-patches/fix-null-state-deref.patch |  12 -
 .../fix-regcomp-uninit-token.patch            |  15 -
 .../fix-regexec-null-deref.patch              |  12 -
 .../gnulib-patches/fix-uninit-structure.patch |  11 -
 .../lib/gnulib-patches/fix-unused-value.patch |  14 -
 grub-core/lib/gnulib-patches/fix-width.patch  | 217 -------------
 13 files changed, 188 insertions(+), 444 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch
bootstrap +163 -134
index 5b08e7e2d..63e76deeb 100755
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2019-01-04.17; # UTC
+scriptversion=2021-04-11.09; # UTC
 
 # Bootstrap this package from checked-out sources.
 
-# Copyright (C) 2003-2019 Free Software Foundation, Inc.
+# Copyright (C) 2003-2021 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ PERL="${PERL-perl}"
 
 me=$0
 
-default_gnulib_url=git://git.sv.gnu.org/gnulib
+default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
 
 usage() {
   cat <<EOF
@@ -71,7 +71,9 @@ Options:
  --no-git                 do not use git to update gnulib.  Requires that
                           --gnulib-srcdir point to a correct gnulib snapshot
  --skip-po                do not download po files
-
+EOF
+  bootstrap_print_option_usage_hook
+  cat <<EOF
 If the file $me.conf exists in the same directory as this script, its
 contents are read as shell variables to configure the bootstrap.
 
@@ -113,6 +115,12 @@ Running without arguments will suffice in most cases.
 EOF
 }
 
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
 # warnf_ FORMAT-STRING ARG1...
 warnf_ ()
 {
@@ -154,6 +162,18 @@ gnulib_files=
 : ${AUTOPOINT=autopoint}
 : ${AUTORECONF=autoreconf}
 
+# A function to be called for each unrecognized option.  Returns 0 if
+# the option in $1 has been processed by the function.  Returns 1 if
+# the option has not been processed by the function.  Override it via
+# your own definition in bootstrap.conf
+
+bootstrap_option_hook() { return 1; }
+
+# A function to be called in order to print the --help information
+# corresponding to user-defined command-line options.
+
+bootstrap_print_option_usage_hook() { :; }
+
 # A function to be called right after gnulib-tool is run.
 # Override it via your own definition in bootstrap.conf.
 bootstrap_post_import_hook() { :; }
@@ -166,11 +186,11 @@ bootstrap_epilogue() { :; }
 # specified directory.  Fill in the first %s with the destination
 # directory and the second with the domain name.
 po_download_command_format=\
-"wget --mirror --level=1 -nd -q -A.po -P '%s' \
+"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
  https://translationproject.org/latest/%s/"
 
 # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
-# fall back to the package name (1st argument with munging)
+# fall back to the package name (1st argument with munging).
 extract_package_name='
   /^AC_INIT(\[*/{
      s///
@@ -187,8 +207,11 @@ extract_package_name='
      p
   }
 '
-package=$(sed -n "$extract_package_name" configure.ac) \
-  || die 'cannot find package name in configure.ac'
+package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null)
+if test -z "$package"; then
+  package=$(sed -n "$extract_package_name" configure.ac) \
+      || die 'cannot find package name in configure.ac'
+fi
 gnulib_name=lib$package
 
 build_aux=build-aux
@@ -290,62 +313,6 @@ find_tool ()
   eval "export $find_tool_envvar"
 }
 
-# Override the default configuration, if necessary.
-# Make sure that bootstrap.conf is sourced from the current directory
-# if we were invoked as "sh bootstrap".
-case "$0" in
-  */*) test -r "$0.conf" && . "$0.conf" ;;
-  *) test -r "$0.conf" && . ./"$0.conf" ;;
-esac
-
-if test "$vc_ignore" = auto; then
-  vc_ignore=
-  test -d .git && vc_ignore=.gitignore
-  test -d CVS && vc_ignore="$vc_ignore .cvsignore"
-fi
-
-if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
-  use_gnulib=false
-else
-  use_gnulib=true
-fi
-
-# Translate configuration into internal form.
-
-# Parse options.
-
-for option
-do
-  case $option in
-  --help)
-    usage
-    exit;;
-  --gnulib-srcdir=*)
-    GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
-  --skip-po)
-    SKIP_PO=t;;
-  --force)
-    checkout_only_file=;;
-  --copy)
-    copy=true;;
-  --bootstrap-sync)
-    bootstrap_sync=true;;
-  --no-bootstrap-sync)
-    bootstrap_sync=false;;
-  --no-git)
-    use_git=false;;
-  *)
-    die "$option: unknown option";;
-  esac
-done
-
-$use_git || test -d "$GNULIB_SRCDIR" \
-  || die "Error: --no-git requires --gnulib-srcdir"
-
-if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
-  die "Bootstrapping from a non-checked-out distribution is risky."
-fi
-
 # Strip blank and comment lines to leave significant entries.
 gitignore_entries() {
   sed '/^#/d; /^$/d' "$@"
@@ -387,6 +354,137 @@ insert_vc_ignore() {
   insert_if_absent "$vc_ignore_file" "$pattern"
 }
 
+symlink_to_dir()
+{
+  src=$1/$2
+  dst=${3-$2}
+
+  test -f "$src" && {
+
+    # If the destination directory doesn't exist, create it.
+    # This is required at least for "lib/uniwidth/cjk.h".
+    dst_dir=$(dirname "$dst")
+    if ! test -d "$dst_dir"; then
+      mkdir -p "$dst_dir"
+
+      # If we've just created a directory like lib/uniwidth,
+      # tell version control system(s) it's ignorable.
+      # FIXME: for now, this does only one level
+      parent=$(dirname "$dst_dir")
+      for dot_ig in x $vc_ignore; do
+        test $dot_ig = x && continue
+        ig=$parent/$dot_ig
+        insert_vc_ignore $ig "${dst_dir##*/}"
+      done
+    fi
+
+    if $copy; then
+      {
+        test ! -h "$dst" || {
+          echo "$me: rm -f $dst" &&
+          rm -f "$dst"
+        }
+      } &&
+      test -f "$dst" &&
+      cmp -s "$src" "$dst" || {
+        echo "$me: cp -fp $src $dst" &&
+        cp -fp "$src" "$dst"
+      }
+    else
+      # Leave any existing symlink alone, if it already points to the source,
+      # so that broken build tools that care about symlink times
+      # aren't confused into doing unnecessary builds.  Conversely, if the
+      # existing symlink's timestamp is older than the source, make it afresh,
+      # so that broken tools aren't confused into skipping needed builds.  See
+      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
+      test -h "$dst" &&
+      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
+      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
+      test "$src_i" = "$dst_i" &&
+      both_ls=$(ls -dt "$src" "$dst") &&
+      test "X$both_ls" = "X$dst$nl$src" || {
+        dot_dots=
+        case $src in
+        /*) ;;
+        *)
+          case /$dst/ in
+          *//* | */../* | */./* | /*/*/*/*/*/)
+             die "invalid symlink calculation: $src -> $dst";;
+          /*/*/*/*/)    dot_dots=../../../;;
+          /*/*/*/)      dot_dots=../../;;
+          /*/*/)        dot_dots=../;;
+          esac;;
+        esac
+
+        echo "$me: ln -fs $dot_dots$src $dst" &&
+        ln -fs "$dot_dots$src" "$dst"
+      }
+    fi
+  }
+}
+
+# Override the default configuration, if necessary.
+# Make sure that bootstrap.conf is sourced from the current directory
+# if we were invoked as "sh bootstrap".
+case "$0" in
+  */*) test -r "$0.conf" && . "$0.conf" ;;
+  *) test -r "$0.conf" && . ./"$0.conf" ;;
+esac
+
+if test "$vc_ignore" = auto; then
+  vc_ignore=
+  test -d .git && vc_ignore=.gitignore
+  test -d CVS && vc_ignore="$vc_ignore .cvsignore"
+fi
+
+if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
+  use_gnulib=false
+else
+  use_gnulib=true
+fi
+
+# Translate configuration into internal form.
+
+# Parse options.
+
+for option
+do
+  case $option in
+  --help)
+    usage
+    exit;;
+  --version)
+    set -e
+    echo "bootstrap $scriptversion"
+    echo "$copyright"
+    exit 0
+    ;;
+  --gnulib-srcdir=*)
+    GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
+  --skip-po)
+    SKIP_PO=t;;
+  --force)
+    checkout_only_file=;;
+  --copy)
+    copy=true;;
+  --bootstrap-sync)
+    bootstrap_sync=true;;
+  --no-bootstrap-sync)
+    bootstrap_sync=false;;
+  --no-git)
+    use_git=false;;
+  *)
+    bootstrap_option_hook $option || die "$option: unknown option";;
+  esac
+done
+
+$use_git || test -d "$GNULIB_SRCDIR" \
+  || die "Error: --no-git requires --gnulib-srcdir"
+
+if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
+  die "Bootstrapping from a non-checked-out distribution is risky."
+fi
+
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
 found_aux_dir=no
 grep '^[	 ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -784,75 +882,6 @@ case $SKIP_PO in
   fi;;
 esac
 
-symlink_to_dir()
-{
-  src=$1/$2
-  dst=${3-$2}
-
-  test -f "$src" && {
-
-    # If the destination directory doesn't exist, create it.
-    # This is required at least for "lib/uniwidth/cjk.h".
-    dst_dir=$(dirname "$dst")
-    if ! test -d "$dst_dir"; then
-      mkdir -p "$dst_dir"
-
-      # If we've just created a directory like lib/uniwidth,
-      # tell version control system(s) it's ignorable.
-      # FIXME: for now, this does only one level
-      parent=$(dirname "$dst_dir")
-      for dot_ig in x $vc_ignore; do
-        test $dot_ig = x && continue
-        ig=$parent/$dot_ig
-        insert_vc_ignore $ig "${dst_dir##*/}"
-      done
-    fi
-
-    if $copy; then
-      {
-        test ! -h "$dst" || {
-          echo "$me: rm -f $dst" &&
-          rm -f "$dst"
-        }
-      } &&
-      test -f "$dst" &&
-      cmp -s "$src" "$dst" || {
-        echo "$me: cp -fp $src $dst" &&
-        cp -fp "$src" "$dst"
-      }
-    else
-      # Leave any existing symlink alone, if it already points to the source,
-      # so that broken build tools that care about symlink times
-      # aren't confused into doing unnecessary builds.  Conversely, if the
-      # existing symlink's timestamp is older than the source, make it afresh,
-      # so that broken tools aren't confused into skipping needed builds.  See
-      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
-      test -h "$dst" &&
-      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
-      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
-      test "$src_i" = "$dst_i" &&
-      both_ls=$(ls -dt "$src" "$dst") &&
-      test "X$both_ls" = "X$dst$nl$src" || {
-        dot_dots=
-        case $src in
-        /*) ;;
-        *)
-          case /$dst/ in
-          *//* | */../* | */./* | /*/*/*/*/*/)
-             die "invalid symlink calculation: $src -> $dst";;
-          /*/*/*/*/)    dot_dots=../../../;;
-          /*/*/*/)      dot_dots=../../;;
-          /*/*/)        dot_dots=../;;
-          esac;;
-        esac
-
-        echo "$me: ln -fs $dot_dots$src $dst" &&
-        ln -fs "$dot_dots$src" "$dst"
-      }
-    fi
-  }
-}
-
 version_controlled_file() {
   parent=$1
   file=$2
@@ -970,7 +999,7 @@ bootstrap_post_import_hook \
 # Uninitialized submodules are listed with an initial dash.
 if $use_git && git submodule | grep '^-' >/dev/null; then
   die "some git submodules are not initialized. "     \
-      "Run 'git submodule init' and bootstrap again."
+      "Run 'git submodule update --init' and bootstrap again."
 fi
 
 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
bootstrap.conf +6 -7
index 71acbeeb1..3cd225f8e 100644
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 
-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263
+GNULIB_REVISION=364c5ba2e40d17e98cc66021ef893e30a009068b
 
 # gnulib modules used by this package.
 # mbswidth is used by gnulib-fix-width.diff's changes to argp rather than
@@ -67,7 +67,7 @@ SKIP_PO=t
 
 # Build prerequisites
 buildreq="\
-autoconf   2.63
+autoconf   2.64
 automake   1.11
 gettext    0.18.3
 git        1.5.5
@@ -81,11 +81,10 @@ cp -a INSTALL INSTALL.grub
 
 bootstrap_post_import_hook () {
   set -e
-  for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do
-    patch -d grub-core/lib/gnulib -p2 \
-      < "grub-core/lib/gnulib-patches/$patchname.patch"
-  done
+
+  # Instead of patching our gnulib and therefore maintaining a fork, submit
+  # changes to gnulib and update the hash above when they've merged.
+
   for patchname in \
       0001-Support-POTFILES-shell \
       0002-Handle-gettext_printf-shell-function \
conf/Makefile.extra-dist +0 -8
index 4ddc3c8f7..07d828ab9 100644
@@ -28,14 +28,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
 EXTRA_DIST += grub-core/genemuinit.sh
 EXTRA_DIST += grub-core/genemuinitheader.sh
 
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
-
 EXTRA_DIST += grub-core/lib/libgcrypt
 EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
 EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
config.h.in +17 -0
index 66c16abfd..d9cc5176a 100644
@@ -64,7 +64,24 @@
 
 #  define _GNU_SOURCE 1
 
+/* gnulib gets configured against the host, not the target, and the rest of
+ * our buildsystem works around that.  This is difficult to avoid as gnulib's
+ * detection requires a more capable system than our target.  Instead, we
+ * reach in and set values appropriately.  If, when updating gnulib,
+ * something breaks, there's probably a change needed here or in
+ * grub-core/Makefile.core.def. */
 #  define _GL_ATTRIBUTE_CONST
+#  define _GL_ATTRIBUTE_COLD
+#  define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+#  define _GL_ATTRIBUTE_MALLOC
+#  define _GL_INLINE inline
+#  define _GL_INLINE_HEADER_BEGIN
+#  define SIZE_MAX ((size_t) -1)
+#  define uint_fast32_t uint32_t
+#  define int_fast32_t int32_t
+
+/* We don't have an abort() for gnulib to call in regexp. */
+#  define abort() DEBUG_ASSERT(0)
 
 /* We don't have an abort() for gnulib to call in regexp. */
 #  define abort() DEBUG_ASSERT(0)
configure.ac +1 -1
index 4f649edaf..cc220e9d0 100644
@@ -49,7 +49,7 @@ AC_CANONICAL_TARGET
 program_prefix="${save_program_prefix}"
 
 AM_INIT_AUTOMAKE([1.11])
-AC_PREREQ(2.63)
+AC_PREREQ(2.64)
 AC_CONFIG_SRCDIR([include/grub/dl.h])
 AC_CONFIG_HEADER([config-util.h])
 
grub-core/Makefile.core.def +1 -0
index 8022e1c0a..48ac59be6 100644
@@ -743,6 +743,7 @@ module = {
   name = regexp;
   common = commands/regexp.c;
   common = commands/wildcard.c;
+  common = lib/gnulib/malloc/dynarray_resize.c;
   common = lib/gnulib/regex.c;
   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
grub-core/lib/gnulib-patches/fix-null-deref.patch deleted +0 -13
deleted file mode 100644
index 8fafa153a..000000000
@@ -1,13 +0,0 @@
-diff --git a/lib/argp-parse.c b/lib/argp-parse.c
-index 6dec57310..900adad54 100644
---- a/lib/argp-parse.c
-+++ b/lib/argp-parse.c
-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse)
- void *
- __argp_input (const struct argp *argp, const struct argp_state *state)
- {
--  if (state)
-+  if (state && state->pstate)
-     {
-       struct group *group;
-       struct parser *parser = state->pstate;
grub-core/lib/gnulib-patches/fix-null-state-deref.patch deleted +0 -12
deleted file mode 100644
index 813ec09c8..000000000
@@ -1,12 +0,0 @@
---- a/lib/argp-help.c	2020-10-28 14:32:19.189215988 +0000
-+++ b/lib/argp-help.c	2020-10-28 14:38:21.204673940 +0000
-@@ -145,7 +145,8 @@
-       if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
-         {
-           __argp_failure (state, 0, 0,
--                          dgettext (state->root_argp->argp_domain,
-+                          dgettext (state == NULL ? NULL
-+                                    : state->root_argp->argp_domain,
-                                     "\
- ARGP_HELP_FMT: %s value is less than or equal to %s"),
-                           "rmargin", up->name);
grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch deleted +0 -15
deleted file mode 100644
index 02e06315d..000000000
@@ -1,15 +0,0 @@
---- a/lib/regcomp.c	2020-11-24 17:06:08.159223858 +0000
-+++ b/lib/regcomp.c	2020-11-24 17:06:15.630253923 +0000
-@@ -3808,11 +3808,7 @@
- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
- 	     re_token_type_t type)
- {
--  re_token_t t;
--#if defined GCC_LINT || defined lint
--  memset (&t, 0, sizeof t);
--#endif
--  t.type = type;
-+  re_token_t t = { .type = type };
-   return create_token_tree (dfa, left, right, &t);
- }
- 
grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch deleted +0 -12
deleted file mode 100644
index db6dac9c9..000000000
@@ -1,12 +0,0 @@
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
-+++ b/lib/regexec.c	2020-11-05 10:55:09.621542984 +0000
-@@ -1692,6 +1692,9 @@
- {
-   Idx top = mctx->state_log_top;
-
-+  if (mctx->state_log == NULL)
-+    return REG_NOERROR;
-+
-   if ((next_state_log_idx >= mctx->input.bufs_len
-        && mctx->input.bufs_len < mctx->input.len)
-       || (next_state_log_idx >= mctx->input.valid_len
grub-core/lib/gnulib-patches/fix-uninit-structure.patch deleted +0 -11
deleted file mode 100644
index 7b4d9f67a..000000000
@@ -1,11 +0,0 @@
---- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
-+++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
-@@ -3662,7 +3662,7 @@
-   Idx alloc = 0;
- #endif /* not RE_ENABLE_I18N */
-   reg_errcode_t ret;
--  re_token_t br_token;
-+  re_token_t br_token = {0};
-   bin_tree_t *tree;
- 
-   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
grub-core/lib/gnulib-patches/fix-unused-value.patch deleted +0 -14
deleted file mode 100644
index ba51f1bf2..000000000
@@ -1,14 +0,0 @@
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
-+++ b/lib/regexec.c	2020-10-21 14:32:07.961765604 +0000
-@@ -828,7 +828,11 @@
- 		    break;
- 		  if (__glibc_unlikely (err != REG_NOMATCH))
- 		    goto free_return;
-+#ifdef DEBUG
-+		  /* Only used for assertion below when DEBUG is set, otherwise
-+		     it will be over-written when we loop around.  */
- 		  match_last = -1;
-+#endif
- 		}
- 	      else
- 		break; /* We found a match.  */
grub-core/lib/gnulib-patches/fix-width.patch deleted +0 -217

217 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v2 4/4] Update gnulib version and drop all gnulib patches

Quoted 39 lines · On Wed, 26 Jan 2022 17:09:12 -0500 Robbie Harwood <[email protected]> wrote:

In addition to the changes carried in our gnulib patches, several Coverity and code hygiene fixes that were previously downstream are also included in this 3-year gnulib increment.

Bump minimum autoconf version from 2.63 to 2.64 as required by gnulib.

Sync bootstrap script itself with gnulib.

Update regexp module for new dynarray dependency.

---
 bootstrap                                     | 297 ++++++++++--------
 bootstrap.conf                                |  13 +-
 conf/Makefile.extra-dist                      |   8 -
 config.h.in                                   |  17 +
 configure.ac                                  |   2 +-
 grub-core/Makefile.core.def                   |   1 +
 .../lib/gnulib-patches/fix-null-deref.patch   |  13 -
 .../gnulib-patches/fix-null-state-deref.patch |  12 -
 .../fix-regcomp-uninit-token.patch            |  15 -
 .../fix-regexec-null-deref.patch              |  12 -
 .../gnulib-patches/fix-uninit-structure.patch |  11 -
 .../lib/gnulib-patches/fix-unused-value.patch |  14 -
 grub-core/lib/gnulib-patches/fix-width.patch  | 217 -------------
 13 files changed, 188 insertions(+), 444 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch
bootstrap +0 -0
index 5b08e7e2d..63e76deeb 100755

bootstrap line 3

Quoted 4 lines
bootstrap +1 -1
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2019-01-04.17; # UTC
+scriptversion=2021-04-11.09; # UTC

This version doesn't match and is older than the version in the $GNULIB_REVISION below. Was there a reason why you didn't want to update the bootstrap script to that revision level?

Glenn

Quoted 821 lines
bootstrap +162 -133
 # Bootstrap this package from checked-out sources.
 
-# Copyright (C) 2003-2019 Free Software Foundation, Inc.
+# Copyright (C) 2003-2021 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ PERL="${PERL-perl}"
 
 me=$0
 
-default_gnulib_url=git://git.sv.gnu.org/gnulib
+default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
 
 usage() {
   cat <<EOF
@@ -71,7 +71,9 @@ Options:
  --no-git                 do not use git to update gnulib.  Requires that
                           --gnulib-srcdir point to a correct gnulib snapshot
  --skip-po                do not download po files
-
+EOF
+  bootstrap_print_option_usage_hook
+  cat <<EOF
 If the file $me.conf exists in the same directory as this script, its
 contents are read as shell variables to configure the bootstrap.
 
@@ -113,6 +115,12 @@ Running without arguments will suffice in most cases.
 EOF
 }
 
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
 # warnf_ FORMAT-STRING ARG1...
 warnf_ ()
 {
@@ -154,6 +162,18 @@ gnulib_files=
 : ${AUTOPOINT=autopoint}
 : ${AUTORECONF=autoreconf}
 
+# A function to be called for each unrecognized option.  Returns 0 if
+# the option in $1 has been processed by the function.  Returns 1 if
+# the option has not been processed by the function.  Override it via
+# your own definition in bootstrap.conf
+
+bootstrap_option_hook() { return 1; }
+
+# A function to be called in order to print the --help information
+# corresponding to user-defined command-line options.
+
+bootstrap_print_option_usage_hook() { :; }
+
 # A function to be called right after gnulib-tool is run.
 # Override it via your own definition in bootstrap.conf.
 bootstrap_post_import_hook() { :; }
@@ -166,11 +186,11 @@ bootstrap_epilogue() { :; }
 # specified directory.  Fill in the first %s with the destination
 # directory and the second with the domain name.
 po_download_command_format=\
-"wget --mirror --level=1 -nd -q -A.po -P '%s' \
+"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
  https://translationproject.org/latest/%s/"
 
 # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
-# fall back to the package name (1st argument with munging)
+# fall back to the package name (1st argument with munging).
 extract_package_name='
   /^AC_INIT(\[*/{
      s///
@@ -187,8 +207,11 @@ extract_package_name='
      p
   }
 '
-package=$(sed -n "$extract_package_name" configure.ac) \
-  || die 'cannot find package name in configure.ac'
+package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null)
+if test -z "$package"; then
+  package=$(sed -n "$extract_package_name" configure.ac) \
+      || die 'cannot find package name in configure.ac'
+fi
 gnulib_name=lib$package
 
 build_aux=build-aux
@@ -290,62 +313,6 @@ find_tool ()
   eval "export $find_tool_envvar"
 }
 
-# Override the default configuration, if necessary.
-# Make sure that bootstrap.conf is sourced from the current directory
-# if we were invoked as "sh bootstrap".
-case "$0" in
-  */*) test -r "$0.conf" && . "$0.conf" ;;
-  *) test -r "$0.conf" && . ./"$0.conf" ;;
-esac
-
-if test "$vc_ignore" = auto; then
-  vc_ignore=
-  test -d .git && vc_ignore=.gitignore
-  test -d CVS && vc_ignore="$vc_ignore .cvsignore"
-fi
-
-if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
-  use_gnulib=false
-else
-  use_gnulib=true
-fi
-
-# Translate configuration into internal form.
-
-# Parse options.
-
-for option
-do
-  case $option in
-  --help)
-    usage
-    exit;;
-  --gnulib-srcdir=*)
-    GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
-  --skip-po)
-    SKIP_PO=t;;
-  --force)
-    checkout_only_file=;;
-  --copy)
-    copy=true;;
-  --bootstrap-sync)
-    bootstrap_sync=true;;
-  --no-bootstrap-sync)
-    bootstrap_sync=false;;
-  --no-git)
-    use_git=false;;
-  *)
-    die "$option: unknown option";;
-  esac
-done
-
-$use_git || test -d "$GNULIB_SRCDIR" \
-  || die "Error: --no-git requires --gnulib-srcdir"
-
-if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
-  die "Bootstrapping from a non-checked-out distribution is risky."
-fi
-
 # Strip blank and comment lines to leave significant entries.
 gitignore_entries() {
   sed '/^#/d; /^$/d' "$@"
@@ -387,6 +354,137 @@ insert_vc_ignore() {
   insert_if_absent "$vc_ignore_file" "$pattern"
 }
 
+symlink_to_dir()
+{
+  src=$1/$2
+  dst=${3-$2}
+
+  test -f "$src" && {
+
+    # If the destination directory doesn't exist, create it.
+    # This is required at least for "lib/uniwidth/cjk.h".
+    dst_dir=$(dirname "$dst")
+    if ! test -d "$dst_dir"; then
+      mkdir -p "$dst_dir"
+
+      # If we've just created a directory like lib/uniwidth,
+      # tell version control system(s) it's ignorable.
+      # FIXME: for now, this does only one level
+      parent=$(dirname "$dst_dir")
+      for dot_ig in x $vc_ignore; do
+        test $dot_ig = x && continue
+        ig=$parent/$dot_ig
+        insert_vc_ignore $ig "${dst_dir##*/}"
+      done
+    fi
+
+    if $copy; then
+      {
+        test ! -h "$dst" || {
+          echo "$me: rm -f $dst" &&
+          rm -f "$dst"
+        }
+      } &&
+      test -f "$dst" &&
+      cmp -s "$src" "$dst" || {
+        echo "$me: cp -fp $src $dst" &&
+        cp -fp "$src" "$dst"
+      }
+    else
+      # Leave any existing symlink alone, if it already points to the source,
+      # so that broken build tools that care about symlink times
+      # aren't confused into doing unnecessary builds.  Conversely, if the
+      # existing symlink's timestamp is older than the source, make it afresh,
+      # so that broken tools aren't confused into skipping needed builds.  See
+      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
+      test -h "$dst" &&
+      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
+      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
+      test "$src_i" = "$dst_i" &&
+      both_ls=$(ls -dt "$src" "$dst") &&
+      test "X$both_ls" = "X$dst$nl$src" || {
+        dot_dots=
+        case $src in
+        /*) ;;
+        *)
+          case /$dst/ in
+          *//* | */../* | */./* | /*/*/*/*/*/)
+             die "invalid symlink calculation: $src -> $dst";;
+          /*/*/*/*/)    dot_dots=../../../;;
+          /*/*/*/)      dot_dots=../../;;
+          /*/*/)        dot_dots=../;;
+          esac;;
+        esac
+
+        echo "$me: ln -fs $dot_dots$src $dst" &&
+        ln -fs "$dot_dots$src" "$dst"
+      }
+    fi
+  }
+}
+
+# Override the default configuration, if necessary.
+# Make sure that bootstrap.conf is sourced from the current directory
+# if we were invoked as "sh bootstrap".
+case "$0" in
+  */*) test -r "$0.conf" && . "$0.conf" ;;
+  *) test -r "$0.conf" && . ./"$0.conf" ;;
+esac
+
+if test "$vc_ignore" = auto; then
+  vc_ignore=
+  test -d .git && vc_ignore=.gitignore
+  test -d CVS && vc_ignore="$vc_ignore .cvsignore"
+fi
+
+if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
+  use_gnulib=false
+else
+  use_gnulib=true
+fi
+
+# Translate configuration into internal form.
+
+# Parse options.
+
+for option
+do
+  case $option in
+  --help)
+    usage
+    exit;;
+  --version)
+    set -e
+    echo "bootstrap $scriptversion"
+    echo "$copyright"
+    exit 0
+    ;;
+  --gnulib-srcdir=*)
+    GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
+  --skip-po)
+    SKIP_PO=t;;
+  --force)
+    checkout_only_file=;;
+  --copy)
+    copy=true;;
+  --bootstrap-sync)
+    bootstrap_sync=true;;
+  --no-bootstrap-sync)
+    bootstrap_sync=false;;
+  --no-git)
+    use_git=false;;
+  *)
+    bootstrap_option_hook $option || die "$option: unknown option";;
+  esac
+done
+
+$use_git || test -d "$GNULIB_SRCDIR" \
+  || die "Error: --no-git requires --gnulib-srcdir"
+
+if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
+  die "Bootstrapping from a non-checked-out distribution is risky."
+fi
+
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
 found_aux_dir=no
 grep '^[	 ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -784,75 +882,6 @@ case $SKIP_PO in
   fi;;
 esac
 
-symlink_to_dir()
-{
-  src=$1/$2
-  dst=${3-$2}
-
-  test -f "$src" && {
-
-    # If the destination directory doesn't exist, create it.
-    # This is required at least for "lib/uniwidth/cjk.h".
-    dst_dir=$(dirname "$dst")
-    if ! test -d "$dst_dir"; then
-      mkdir -p "$dst_dir"
-
-      # If we've just created a directory like lib/uniwidth,
-      # tell version control system(s) it's ignorable.
-      # FIXME: for now, this does only one level
-      parent=$(dirname "$dst_dir")
-      for dot_ig in x $vc_ignore; do
-        test $dot_ig = x && continue
-        ig=$parent/$dot_ig
-        insert_vc_ignore $ig "${dst_dir##*/}"
-      done
-    fi
-
-    if $copy; then
-      {
-        test ! -h "$dst" || {
-          echo "$me: rm -f $dst" &&
-          rm -f "$dst"
-        }
-      } &&
-      test -f "$dst" &&
-      cmp -s "$src" "$dst" || {
-        echo "$me: cp -fp $src $dst" &&
-        cp -fp "$src" "$dst"
-      }
-    else
-      # Leave any existing symlink alone, if it already points to the source,
-      # so that broken build tools that care about symlink times
-      # aren't confused into doing unnecessary builds.  Conversely, if the
-      # existing symlink's timestamp is older than the source, make it afresh,
-      # so that broken tools aren't confused into skipping needed builds.  See
-      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
-      test -h "$dst" &&
-      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
-      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
-      test "$src_i" = "$dst_i" &&
-      both_ls=$(ls -dt "$src" "$dst") &&
-      test "X$both_ls" = "X$dst$nl$src" || {
-        dot_dots=
-        case $src in
-        /*) ;;
-        *)
-          case /$dst/ in
-          *//* | */../* | */./* | /*/*/*/*/*/)
-             die "invalid symlink calculation: $src -> $dst";;
-          /*/*/*/*/)    dot_dots=../../../;;
-          /*/*/*/)      dot_dots=../../;;
-          /*/*/)        dot_dots=../;;
-          esac;;
-        esac
-
-        echo "$me: ln -fs $dot_dots$src $dst" &&
-        ln -fs "$dot_dots$src" "$dst"
-      }
-    fi
-  }
-}
-
 version_controlled_file() {
   parent=$1
   file=$2
@@ -970,7 +999,7 @@ bootstrap_post_import_hook \
 # Uninitialized submodules are listed with an initial dash.
 if $use_git && git submodule | grep '^-' >/dev/null; then
   die "some git submodules are not initialized. "     \
-      "Run 'git submodule init' and bootstrap again."
+      "Run 'git submodule update --init' and bootstrap again."
 fi
 
 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
bootstrap.conf +6 -7
index 71acbeeb1..3cd225f8e 100644
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 
-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263
+GNULIB_REVISION=364c5ba2e40d17e98cc66021ef893e30a009068b
 
 # gnulib modules used by this package.
 # mbswidth is used by gnulib-fix-width.diff's changes to argp rather than
@@ -67,7 +67,7 @@ SKIP_PO=t
 
 # Build prerequisites
 buildreq="\
-autoconf   2.63
+autoconf   2.64
 automake   1.11
 gettext    0.18.3
 git        1.5.5
@@ -81,11 +81,10 @@ cp -a INSTALL INSTALL.grub
 
 bootstrap_post_import_hook () {
   set -e
-  for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do
-    patch -d grub-core/lib/gnulib -p2 \
-      < "grub-core/lib/gnulib-patches/$patchname.patch"
-  done
+
+  # Instead of patching our gnulib and therefore maintaining a fork, submit
+  # changes to gnulib and update the hash above when they've merged.
+
   for patchname in \
       0001-Support-POTFILES-shell \
       0002-Handle-gettext_printf-shell-function \
conf/Makefile.extra-dist +0 -8
index 4ddc3c8f7..07d828ab9 100644
@@ -28,14 +28,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
 EXTRA_DIST += grub-core/genemuinit.sh
 EXTRA_DIST += grub-core/genemuinitheader.sh
 
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
-
 EXTRA_DIST += grub-core/lib/libgcrypt
 EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
 EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
config.h.in +17 -0
index 66c16abfd..d9cc5176a 100644
@@ -64,7 +64,24 @@
 
 #  define _GNU_SOURCE 1
 
+/* gnulib gets configured against the host, not the target, and the rest of
+ * our buildsystem works around that.  This is difficult to avoid as gnulib's
+ * detection requires a more capable system than our target.  Instead, we
+ * reach in and set values appropriately.  If, when updating gnulib,
+ * something breaks, there's probably a change needed here or in
+ * grub-core/Makefile.core.def. */
 #  define _GL_ATTRIBUTE_CONST
+#  define _GL_ATTRIBUTE_COLD
+#  define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+#  define _GL_ATTRIBUTE_MALLOC
+#  define _GL_INLINE inline
+#  define _GL_INLINE_HEADER_BEGIN
+#  define SIZE_MAX ((size_t) -1)
+#  define uint_fast32_t uint32_t
+#  define int_fast32_t int32_t
+
+/* We don't have an abort() for gnulib to call in regexp. */
+#  define abort() DEBUG_ASSERT(0)
 
 /* We don't have an abort() for gnulib to call in regexp. */
 #  define abort() DEBUG_ASSERT(0)
configure.ac +1 -1
index 4f649edaf..cc220e9d0 100644
@@ -49,7 +49,7 @@ AC_CANONICAL_TARGET
 program_prefix="${save_program_prefix}"
 
 AM_INIT_AUTOMAKE([1.11])
-AC_PREREQ(2.63)
+AC_PREREQ(2.64)
 AC_CONFIG_SRCDIR([include/grub/dl.h])
 AC_CONFIG_HEADER([config-util.h])
 
grub-core/Makefile.core.def +1 -0
index 8022e1c0a..48ac59be6 100644
@@ -743,6 +743,7 @@ module = {
   name = regexp;
   common = commands/regexp.c;
   common = commands/wildcard.c;
+  common = lib/gnulib/malloc/dynarray_resize.c;
   common = lib/gnulib/regex.c;
   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
grub-core/lib/gnulib-patches/fix-null-deref.patch deleted +0 -13
deleted file mode 100644
index 8fafa153a..000000000
@@ -1,13 +0,0 @@
-diff --git a/lib/argp-parse.c b/lib/argp-parse.c
-index 6dec57310..900adad54 100644
---- a/lib/argp-parse.c
-+++ b/lib/argp-parse.c
-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse)
- void *
- __argp_input (const struct argp *argp, const struct argp_state *state)
- {
--  if (state)
-+  if (state && state->pstate)
-     {
-       struct group *group;
-       struct parser *parser = state->pstate;
grub-core/lib/gnulib-patches/fix-null-state-deref.patch deleted +0 -12
deleted file mode 100644
index 813ec09c8..000000000
@@ -1,12 +0,0 @@
---- a/lib/argp-help.c	2020-10-28 14:32:19.189215988 +0000
-+++ b/lib/argp-help.c	2020-10-28 14:38:21.204673940 +0000
-@@ -145,7 +145,8 @@
-       if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
-         {
-           __argp_failure (state, 0, 0,
--                          dgettext (state->root_argp->argp_domain,
-+                          dgettext (state == NULL ? NULL
-+                                    : state->root_argp->argp_domain,
-                                     "\
- ARGP_HELP_FMT: %s value is less than or equal to %s"),
-                           "rmargin", up->name);
grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch deleted +0 -15
deleted file mode 100644
index 02e06315d..000000000
@@ -1,15 +0,0 @@
---- a/lib/regcomp.c	2020-11-24 17:06:08.159223858 +0000
-+++ b/lib/regcomp.c	2020-11-24 17:06:15.630253923 +0000
-@@ -3808,11 +3808,7 @@
- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
- 	     re_token_type_t type)
- {
--  re_token_t t;
--#if defined GCC_LINT || defined lint
--  memset (&t, 0, sizeof t);
--#endif
--  t.type = type;
-+  re_token_t t = { .type = type };
-   return create_token_tree (dfa, left, right, &t);
- }
- 
grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch deleted +0 -12
deleted file mode 100644
index db6dac9c9..000000000
@@ -1,12 +0,0 @@
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
-+++ b/lib/regexec.c	2020-11-05 10:55:09.621542984 +0000
-@@ -1692,6 +1692,9 @@
- {
-   Idx top = mctx->state_log_top;
-
-+  if (mctx->state_log == NULL)
-+    return REG_NOERROR;
-+
-   if ((next_state_log_idx >= mctx->input.bufs_len
-        && mctx->input.bufs_len < mctx->input.len)
-       || (next_state_log_idx >= mctx->input.valid_len
grub-core/lib/gnulib-patches/fix-uninit-structure.patch deleted +0 -11
deleted file mode 100644
index 7b4d9f67a..000000000
@@ -1,11 +0,0 @@
---- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
-+++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
-@@ -3662,7 +3662,7 @@
-   Idx alloc = 0;
- #endif /* not RE_ENABLE_I18N */
-   reg_errcode_t ret;
--  re_token_t br_token;
-+  re_token_t br_token = {0};
-   bin_tree_t *tree;
- 
-   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
grub-core/lib/gnulib-patches/fix-unused-value.patch deleted +0 -14
deleted file mode 100644
index ba51f1bf2..000000000
@@ -1,14 +0,0 @@
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
-+++ b/lib/regexec.c	2020-10-21 14:32:07.961765604 +0000
-@@ -828,7 +828,11 @@
- 		    break;
- 		  if (__glibc_unlikely (err != REG_NOMATCH))
- 		    goto free_return;
-+#ifdef DEBUG
-+		  /* Only used for assertion below when DEBUG is set, otherwise
-+		     it will be over-written when we loop around.  */
- 		  match_last = -1;
-+#endif
- 		}
- 	      else
- 		break; /* We found a match.  */
grub-core/lib/gnulib-patches/fix-width.patch deleted +0 -217
deleted file mode 100644
index 0a208ad08..000000000
@@ -1,217 +0,0 @@
-diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c
-index ba6a407f7..d0685b3d4 100644
---- a/lib/argp-fmtstream.c
-+++ b/lib/argp-fmtstream.c
-@@ -28,9 +28,11 @@
- #include <errno.h>
- #include <stdarg.h>
- #include <ctype.h>
-+#include <wchar.h>
- 
- #include "argp-fmtstream.h"
- #include "argp-namefrob.h"
-+#include "mbswidth.h"
- 
- #ifndef ARGP_FMTSTREAM_USE_LINEWRAP
- 
-@@ -115,6 +117,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
- #endif
- #endif
- 
-+
-+/* Return the pointer to the first character that doesn't fit in l columns.  */
-+static inline const ptrdiff_t
-+add_width (const char *ptr, const char *end, size_t l)
-+{
-+  mbstate_t ps;
-+  const char *ptr0 = ptr;
-+
-+  memset (&ps, 0, sizeof (ps));
-+
-+  while (ptr < end)
-+    {
-+      wchar_t wc;
-+      size_t s, k;
-+
-+      s = mbrtowc (&wc, ptr, end - ptr, &ps);
-+      if (s == (size_t) -1)
-+	break;
-+      if (s == (size_t) -2)
-+	{
-+	  if (1 >= l)
-+	    break;
-+	  l--;
-+	  ptr++;
-+	  continue;
-+	}
-+
-+      if (wc == '\e' && ptr + 3 < end
-+	  && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1')
-+	  && ptr[3] == 'm')
-+	{
-+	  ptr += 4;
-+	  continue;
-+	}
-+
-+      k = wcwidth (wc);
-+
-+      if (k >= l)
-+	break;
-+      l -= k;
-+      ptr += s;
-+    }
-+  return ptr - ptr0;
-+}
-+
- /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
-    end of its buffer.  This code is mostly from glibc stdio/linewrap.c.  */
- void
-@@ -168,13 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
-       if (!nl)
-         {
-           /* The buffer ends in a partial line.  */
-+          size_t display_width = mbsnwidth (buf, fs->p - buf,
-+                                            MBSW_STOP_AT_NUL);
- 
--          if (fs->point_col + len < fs->rmargin)
-+          if (fs->point_col + display_width < fs->rmargin)
-             {
-               /* The remaining buffer text is a partial line and fits
-                  within the maximum line width.  Advance point for the
-                  characters to be written and stop scanning.  */
--              fs->point_col += len;
-+              fs->point_col += display_width;
-               break;
-             }
-           else
-@@ -182,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
-                the end of the buffer.  */
-             nl = fs->p;
-         }
--      else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
--        {
--          /* The buffer contains a full line that fits within the maximum
--             line width.  Reset point and scan the next line.  */
--          fs->point_col = 0;
--          buf = nl + 1;
--          continue;
--        }
-+      else
-+	{
-+	  size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL);
-+	  if (display_width < (ssize_t) fs->rmargin)
-+	    {
-+	      /* The buffer contains a full line that fits within the maximum
-+		 line width.  Reset point and scan the next line.  */
-+	      fs->point_col = 0;
-+	      buf = nl + 1;
-+	      continue;
-+	    }
-+	}
- 
-       /* This line is too long.  */
-       r = fs->rmargin - 1;
-@@ -225,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
-           char *p, *nextline;
-           int i;
- 
--          p = buf + (r + 1 - fs->point_col);
-+          p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col));
-           while (p >= buf && !isblank ((unsigned char) *p))
-             --p;
-           nextline = p + 1;     /* This will begin the next line.  */
-@@ -243,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
-             {
-               /* A single word that is greater than the maximum line width.
-                  Oh well.  Put it on an overlong line by itself.  */
--              p = buf + (r + 1 - fs->point_col);
-+              p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col));
-               /* Find the end of the long word.  */
-               if (p < nl)
-                 do
-@@ -277,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
-               && fs->p > nextline)
-             {
-               /* The margin needs more blanks than we removed.  */
--              if (fs->end - fs->p > fs->wmargin + 1)
-+              if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL)
-+                  > fs->wmargin + 1)
-                 /* Make some space for them.  */
-                 {
-                   size_t mv = fs->p - nextline;
-diff --git a/lib/argp-help.c b/lib/argp-help.c
-index e5375a0f0..5d8f451ec 100644
---- a/lib/argp-help.c
-+++ b/lib/argp-help.c
-@@ -51,6 +51,7 @@
- #include "argp.h"
- #include "argp-fmtstream.h"
- #include "argp-namefrob.h"
-+#include "mbswidth.h"
- 
- #ifndef SIZE_MAX
- # define SIZE_MAX ((size_t) -1)
-@@ -1432,7 +1433,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
- 
-       /* Manually do line wrapping so that it (probably) won't get wrapped at
-          any embedded spaces.  */
--      space (stream, 1 + nl - cp);
-+      space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL));
- 
-       __argp_fmtstream_write (stream, cp, nl - cp);
-     }
-diff --git a/lib/mbswidth.c b/lib/mbswidth.c
-index 408a15e34..b3fb7f83a 100644
---- a/lib/mbswidth.c
-+++ b/lib/mbswidth.c
-@@ -38,6 +38,14 @@
- /* Get INT_MAX.  */
- #include <limits.h>
- 
-+#ifndef FALLTHROUGH
-+# if __GNUC__ < 7
-+#  define FALLTHROUGH ((void) 0)
-+# else
-+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
-+# endif
-+#endif
-+
- /* Returns the number of columns needed to represent the multibyte
-    character string pointed to by STRING.  If a non-printable character
-    occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
-@@ -90,6 +98,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
-               p++;
-               width++;
-               break;
-+            case '\0':
-+              if (flags & MBSW_STOP_AT_NUL)
-+                return width;
-+              FALLTHROUGH;
-             default:
-               /* If we have a multibyte sequence, scan it up to its end.  */
-               {
-@@ -168,6 +180,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
-     {
-       unsigned char c = (unsigned char) *p++;
- 
-+      if (c == 0 && (flags & MBSW_STOP_AT_NUL))
-+        return width;
-+
-       if (isprint (c))
-         {
-           if (width == INT_MAX)
-diff --git a/lib/mbswidth.h b/lib/mbswidth.h
-index 2b5c53c37..45a123e63 100644
---- a/lib/mbswidth.h
-+++ b/lib/mbswidth.h
-@@ -45,6 +45,10 @@ extern "C" {
-    control characters and 1 otherwise.  */
- #define MBSW_REJECT_UNPRINTABLE 2
- 
-+/* If this bit is set \0 is treated as the end of string.
-+   Otherwise it's treated as a normal one column width character.  */
-+#define MBSW_STOP_AT_NUL 4
-+
- 
- /* Returns the number of screen columns needed for STRING.  */
- #define mbswidth gnu_mbswidth  /* avoid clash with UnixWare 7.1.1 function */
#6 lore raw

Re: [PATCH v2 4/4] Update gnulib version and drop all gnulib patches

Quoted 9 lines · Glenn Washburn

bootstrap line 3

Quoted 2 lines · Robbie Harwood
bootstrap +1 -1
-scriptversion=2019-01-04.17; # UTC
+scriptversion=2021-04-11.09; # UTC

This version doesn't match and is older than the version in the $GNULIB_REVISION below. Was there a reason why you didn't want to update the bootstrap script to that revision level?

No, I just had a local checkout with a slightly older version and forgot to commit it for update :) Will fix.

Be well,
--Robbie

#7 lore raw
In reply to Robbie Harwood
Quoted 5 lines · On Wed, 26 Jan 2022 17:09:08 -0500 Robbie Harwood <[email protected]> wrote:

This patchset is an expansion of "Drop gnulib fix-base64.patch" and rolls us forward to current gnulib development head. Not carrying patches means we don't have to maintain a gnulib tree (nor do downstream distros). It also allows us to pull in static analyzer fixes that gnulib has applied.

Quoted 7 lines

I've attempted to address concerns from previous review about _GL_* stuff, but it's possible I've misunderstood the request there.

fix-width.patch has not merged upstream. A version has been proposed, but would need significant rewrite. It doesn't seem worth the effort to carry, and once this changeset merges to grub, it becomes easier to increment our gnulib version if something like it ever does merge there.

Thanks Robbie for updating gnulib, this is something I've been wanting to get done. If I'm understanding you correctly, fix-width.patch is being dropped but there is not replacement for what it did. How was this patch functionally being used by GRUB? And what will the effects be of dropping it? Looking at the patch maybe one of the places its used is in GRUB's help command. If so, does that mean that line wrapping when printing help will be affected?

Glenn

Quoted 38 lines

Be well,
--Robbie

Robbie Harwood (4):
Use visual indentation in config.h.in Drop gnulib fix-base64.patch
Drop gnulib no-abort.patch
Update gnulib version and drop all gnulib patches

 bootstrap                                     | 297 ++++++++++--------
 bootstrap.conf                                |  14 +-
 conf/Makefile.extra-dist                      |  10 -
 config.h.in                                   |  78 +++--
 configure.ac                                  |   2 +-
 grub-core/Makefile.core.def                   |   1 +
 grub-core/lib/gnulib-patches/fix-base64.patch |  21 --
 .../lib/gnulib-patches/fix-null-deref.patch   |  13 -
 .../gnulib-patches/fix-null-state-deref.patch |  12 -
 .../fix-regcomp-uninit-token.patch            |  15 -
 .../fix-regexec-null-deref.patch              |  12 -
 .../gnulib-patches/fix-uninit-structure.patch |  11 -
 .../lib/gnulib-patches/fix-unused-value.patch |  14 -
 grub-core/lib/gnulib-patches/fix-width.patch  | 217 -------------
 grub-core/lib/gnulib-patches/no-abort.patch   |  26 --
 grub-core/lib/posix_wrap/sys/types.h          |   7 +-
 grub-core/lib/xzembed/xz.h                    |   5 +-
 17 files changed, 226 insertions(+), 529 deletions(-)
 delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
 delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch
 delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch
#8 lore raw
Quoted 11 lines · Glenn Washburn
Quoted 5 lines · Robbie Harwood

fix-width.patch has not merged upstream. A version has been proposed, but would need significant rewrite. It doesn't seem worth the effort to carry, and once this changeset merges to grub, it becomes easier to increment our gnulib version if something like it ever does merge there.

Thanks Robbie for updating gnulib, this is something I've been wanting to get done. If I'm understanding you correctly, fix-width.patch is being dropped but there is not replacement for what it did.

All good questions. To back up for a moment, my original plan had been to wait longer and see if we could get a better version of that patch accepted into gnulib. However, we're accelerated from that now because us using an old gnulib is holding up other efforts (and according to my bug mail this morning, is needed to build with newer gcc/glibc).

Quoted 4 lines

How was this patch functionally being used by GRUB? And what will the effects be of dropping it? Looking at the patch maybe one of the places its used is in GRUB's help command. If so, does that mean that line wrapping when printing help will be affected?

Not totally clear, and there's no commit information to help. Mostly it seems to change gnulib's width assumption to be multibyte-character aware. I think this could cause lines to not wrap early in locales that are mutibyte-heavy, but I don't actually know, as I don't speak any languages that meet that criteria.

gnulib upstream pointed out that this is only papering over the problem
though: it won't work for Chinese, for instance. (It also won't work for Thai, but there's nothing that anyone can do there.)

I could be wrong, but I'm actually not sure this affects grub at all. We're not translated, which I think means that every character we put in a help string will fit in a single byte under UTF-8.

Be well,
--Robbie

#9 lore raw
Quoted 3 lines · Robbie Harwood

I could be wrong, but I'm actually not sure this affects grub at all. We're not translated, which I think means that every character we put in a help string will fit in a single byte under UTF-8.

(Just a note that I am in fact wrong about this - grub is translated.)

Be well,
--Robbie