8a74d28
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8a74d28
From: Robbie Harwood <rharwood@redhat.com>
8a74d28
Date: Wed, 15 Dec 2021 15:07:50 -0500
8a74d28
Subject: [PATCH] Update gnulib version and drop most gnulib patches
8a74d28
8a74d28
In addition to the changes carried in our gnulib patches, several
8a74d28
Coverity and code hygiene fixes that were previously downstream are also
8a74d28
included in this 3-year gnulib increment.
8a74d28
8a74d28
Unfortunately, fix-width.patch is retained.
8a74d28
8a74d28
Bump minimum autoconf version from 2.63 to 2.64 and automake from 1.11
8a74d28
to 1.14, as required by gnulib.
8a74d28
8a74d28
Sync bootstrap script itself with gnulib.
8a74d28
8a74d28
Update regexp module for new dynarray dependency.
8a74d28
8a74d28
Fix various new warnings.
8a74d28
8a74d28
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
8a74d28
(cherry picked from commit deb18ff931c3133c2aa536a92bd92e50d6615303)
8a74d28
[rharwood: backport around requirements in INSTALL]
8a74d28
---
8a74d28
 configure.ac                                       |   2 +-
8a74d28
 grub-core/Makefile.core.def                        |   3 +
8a74d28
 grub-core/disk/luks2.c                             |   4 +-
8a74d28
 grub-core/lib/posix_wrap/limits.h                  |   6 +-
8a74d28
 include/grub/compiler.h                            |   4 +-
8a74d28
 include/grub/list.h                                |   2 +-
8a74d28
 INSTALL                                            |   2 +-
8a74d28
 bootstrap                                          | 291 ++++++++++++---------
8a74d28
 bootstrap.conf                                     |  22 +-
8a74d28
 conf/Makefile.extra-dist                           |   6 -
8a74d28
 config.h.in                                        |  68 +++++
8a74d28
 grub-core/lib/gnulib-patches/fix-null-deref.patch  |  13 -
8a74d28
 .../lib/gnulib-patches/fix-null-state-deref.patch  |  12 -
8a74d28
 .../gnulib-patches/fix-regcomp-uninit-token.patch  |  15 --
8a74d28
 .../gnulib-patches/fix-regexec-null-deref.patch    |  12 -
8a74d28
 .../lib/gnulib-patches/fix-uninit-structure.patch  |  11 -
8a74d28
 .../lib/gnulib-patches/fix-unused-value.patch      |  14 -
8a74d28
 17 files changed, 262 insertions(+), 225 deletions(-)
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8a74d28
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
8a74d28
8a74d28
diff --git a/configure.ac b/configure.ac
3d407d2
index 40c4338bce..79f45ef1e1 100644
8a74d28
--- a/configure.ac
8a74d28
+++ b/configure.ac
8a74d28
@@ -49,7 +49,7 @@ AC_CANONICAL_TARGET
8a74d28
 program_prefix="${save_program_prefix}"
8a74d28
 
8a74d28
 AM_INIT_AUTOMAKE([1.11])
8a74d28
-AC_PREREQ(2.63)
8a74d28
+AC_PREREQ(2.64)
8a74d28
 AC_CONFIG_SRCDIR([include/grub/dl.h])
8a74d28
 AC_CONFIG_HEADER([config-util.h])
8a74d28
 
8a74d28
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
ed1787d
index 08ac0fb15f..ec1ec5083b 100644
8a74d28
--- a/grub-core/Makefile.core.def
8a74d28
+++ b/grub-core/Makefile.core.def
8a74d28
@@ -762,6 +762,9 @@ module = {
8a74d28
   name = regexp;
8a74d28
   common = commands/regexp.c;
8a74d28
   common = commands/wildcard.c;
8a74d28
+  common = lib/gnulib/malloc/dynarray_finalize.c;
8a74d28
+  common = lib/gnulib/malloc/dynarray_emplace_enlarge.c;
8a74d28
+  common = lib/gnulib/malloc/dynarray_resize.c;
8a74d28
   common = lib/gnulib/regex.c;
8a74d28
   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
8a74d28
   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
8a74d28
diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
e622855
index 371a53b837..c917a5f91e 100644
8a74d28
--- a/grub-core/disk/luks2.c
8a74d28
+++ b/grub-core/disk/luks2.c
8a74d28
@@ -389,7 +389,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key,
8a74d28
 {
8a74d28
   grub_uint8_t candidate_digest[GRUB_CRYPTODISK_MAX_KEYLEN];
8a74d28
   grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN], salt[GRUB_CRYPTODISK_MAX_KEYLEN];
8a74d28
-  grub_size_t saltlen = sizeof (salt), digestlen = sizeof (digest);
8a74d28
+  idx_t saltlen = sizeof (salt), digestlen = sizeof (digest);
8a74d28
   const gcry_md_spec_t *hash;
8a74d28
   gcry_err_code_t gcry_ret;
8a74d28
 
8a74d28
@@ -428,7 +428,7 @@ luks2_decrypt_key (grub_uint8_t *out_key,
8a74d28
   grub_uint8_t area_key[GRUB_CRYPTODISK_MAX_KEYLEN];
8a74d28
   grub_uint8_t salt[GRUB_CRYPTODISK_MAX_KEYLEN];
8a74d28
   grub_uint8_t *split_key = NULL;
8a74d28
-  grub_size_t saltlen = sizeof (salt);
8a74d28
+  idx_t saltlen = sizeof (salt);
8a74d28
   char cipher[32], *p;
8a74d28
   const gcry_md_spec_t *hash;
8a74d28
   gcry_err_code_t gcry_ret;
8a74d28
diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h
e622855
index 591dbf3289..4be7b40806 100644
8a74d28
--- a/grub-core/lib/posix_wrap/limits.h
8a74d28
+++ b/grub-core/lib/posix_wrap/limits.h
8a74d28
@@ -25,7 +25,11 @@
8a74d28
 #define USHRT_MAX GRUB_USHRT_MAX
8a74d28
 #define UINT_MAX GRUB_UINT_MAX
8a74d28
 #define ULONG_MAX GRUB_ULONG_MAX
8a74d28
-#define SIZE_MAX GRUB_SIZE_MAX
8a74d28
+
8a74d28
+/* gnulib also defines this type */
8a74d28
+#ifndef SIZE_MAX
8a74d28
+#  define SIZE_MAX GRUB_SIZE_MAX
8a74d28
+#endif
8a74d28
 
8a74d28
 #define SCHAR_MIN GRUB_SCHAR_MIN
8a74d28
 #define SCHAR_MAX GRUB_SCHAR_MAX
8a74d28
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
e622855
index ebafec6895..441a9eca07 100644
8a74d28
--- a/include/grub/compiler.h
8a74d28
+++ b/include/grub/compiler.h
8a74d28
@@ -30,10 +30,10 @@
8a74d28
 
8a74d28
 /* Does this compiler support compile-time error attributes? */
8a74d28
 #if GNUC_PREREQ(4,3)
8a74d28
-#  define ATTRIBUTE_ERROR(msg) \
8a74d28
+#  define GRUB_ATTRIBUTE_ERROR(msg) \
8a74d28
 	__attribute__ ((__error__ (msg)))
8a74d28
 #else
8a74d28
-#  define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
8a74d28
+#  define GRUB_ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
8a74d28
 #endif
8a74d28
 
8a74d28
 #if GNUC_PREREQ(4,4)
8a74d28
diff --git a/include/grub/list.h b/include/grub/list.h
e622855
index b13acb9624..21f4b4b44a 100644
8a74d28
--- a/include/grub/list.h
8a74d28
+++ b/include/grub/list.h
8a74d28
@@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item);
8a74d28
 
8a74d28
 static inline void *
8a74d28
 grub_bad_type_cast_real (int line, const char *file)
8a74d28
-     ATTRIBUTE_ERROR ("bad type cast between incompatible grub types");
8a74d28
+     GRUB_ATTRIBUTE_ERROR ("bad type cast between incompatible grub types");
8a74d28
 
8a74d28
 static inline void *
8a74d28
 grub_bad_type_cast_real (int line, const char *file)
8a74d28
diff --git a/INSTALL b/INSTALL
e622855
index 79a0af7d93..ee9f536f76 100644
8a74d28
--- a/INSTALL
8a74d28
+++ b/INSTALL
8a74d28
@@ -42,7 +42,7 @@ If you use a development snapshot or want to hack on GRUB you may
8a74d28
 need the following.
8a74d28
 
8a74d28
 * Python 2.6 or later
8a74d28
-* Autoconf 2.63 or later
8a74d28
+* Autoconf 2.64 or later
8a74d28
 * Automake 1.11 or later
8a74d28
 
8a74d28
 Prerequisites for make-check:
8a74d28
diff --git a/bootstrap b/bootstrap
e622855
index 5b08e7e2d4..dc2238f4ad 100755
8a74d28
--- a/bootstrap
8a74d28
+++ b/bootstrap
8a74d28
@@ -1,10 +1,10 @@
8a74d28
 #! /bin/sh
8a74d28
 # Print a version string.
8a74d28
-scriptversion=2019-01-04.17; # UTC
8a74d28
+scriptversion=2022-01-26.05; # UTC
8a74d28
 
8a74d28
 # Bootstrap this package from checked-out sources.
8a74d28
 
8a74d28
-# Copyright (C) 2003-2019 Free Software Foundation, Inc.
8a74d28
+# Copyright (C) 2003-2022 Free Software Foundation, Inc.
8a74d28
 
8a74d28
 # This program is free software: you can redistribute it and/or modify
8a74d28
 # it under the terms of the GNU General Public License as published by
8a74d28
@@ -47,7 +47,7 @@ PERL="${PERL-perl}"
8a74d28
 
8a74d28
 me=$0
8a74d28
 
8a74d28
-default_gnulib_url=git://git.sv.gnu.org/gnulib
8a74d28
+default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
8a74d28
 
8a74d28
 usage() {
8a74d28
   cat <
8a74d28
@@ -71,7 +71,9 @@ Options:
8a74d28
  --no-git                 do not use git to update gnulib.  Requires that
8a74d28
                           --gnulib-srcdir point to a correct gnulib snapshot
8a74d28
  --skip-po                do not download po files
8a74d28
-
8a74d28
+EOF
8a74d28
+  bootstrap_print_option_usage_hook
8a74d28
+  cat <
8a74d28
 If the file $me.conf exists in the same directory as this script, its
8a74d28
 contents are read as shell variables to configure the bootstrap.
8a74d28
 
8a74d28
@@ -113,6 +115,12 @@ Running without arguments will suffice in most cases.
8a74d28
 EOF
8a74d28
 }
8a74d28
 
8a74d28
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
8a74d28
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
8a74d28
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
8a74d28
+This is free software: you are free to change and redistribute it.
8a74d28
+There is NO WARRANTY, to the extent permitted by law."
8a74d28
+
8a74d28
 # warnf_ FORMAT-STRING ARG1...
8a74d28
 warnf_ ()
8a74d28
 {
8a74d28
@@ -154,6 +162,18 @@ gnulib_files=
8a74d28
 : ${AUTOPOINT=autopoint}
8a74d28
 : ${AUTORECONF=autoreconf}
8a74d28
 
8a74d28
+# A function to be called for each unrecognized option.  Returns 0 if
8a74d28
+# the option in $1 has been processed by the function.  Returns 1 if
8a74d28
+# the option has not been processed by the function.  Override it via
8a74d28
+# your own definition in bootstrap.conf
8a74d28
+
8a74d28
+bootstrap_option_hook() { return 1; }
8a74d28
+
8a74d28
+# A function to be called in order to print the --help information
8a74d28
+# corresponding to user-defined command-line options.
8a74d28
+
8a74d28
+bootstrap_print_option_usage_hook() { :; }
8a74d28
+
8a74d28
 # A function to be called right after gnulib-tool is run.
8a74d28
 # Override it via your own definition in bootstrap.conf.
8a74d28
 bootstrap_post_import_hook() { :; }
8a74d28
@@ -166,11 +186,11 @@ bootstrap_epilogue() { :; }
8a74d28
 # specified directory.  Fill in the first %s with the destination
8a74d28
 # directory and the second with the domain name.
8a74d28
 po_download_command_format=\
8a74d28
-"wget --mirror --level=1 -nd -q -A.po -P '%s' \
8a74d28
+"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
8a74d28
  https://translationproject.org/latest/%s/"
8a74d28
 
8a74d28
 # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
8a74d28
-# fall back to the package name (1st argument with munging)
8a74d28
+# fall back to the package name (1st argument with munging).
8a74d28
 extract_package_name='
8a74d28
   /^AC_INIT(\[*/{
8a74d28
      s///
8a74d28
@@ -187,8 +207,11 @@ extract_package_name='
8a74d28
      p
8a74d28
   }
8a74d28
 '
8a74d28
-package=$(sed -n "$extract_package_name" configure.ac) \
8a74d28
-  || die 'cannot find package name in configure.ac'
8a74d28
+package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null)
8a74d28
+if test -z "$package"; then
8a74d28
+  package=$(sed -n "$extract_package_name" configure.ac) \
8a74d28
+      || die 'cannot find package name in configure.ac'
8a74d28
+fi
8a74d28
 gnulib_name=lib$package
8a74d28
 
8a74d28
 build_aux=build-aux
8a74d28
@@ -290,6 +313,116 @@ find_tool ()
8a74d28
   eval "export $find_tool_envvar"
8a74d28
 }
8a74d28
 
8a74d28
+# Strip blank and comment lines to leave significant entries.
8a74d28
+gitignore_entries() {
8a74d28
+  sed '/^#/d; /^$/d' "$@"
8a74d28
+}
8a74d28
+
8a74d28
+# If $STR is not already on a line by itself in $FILE, insert it at the start.
8a74d28
+# Entries are inserted at the start of the ignore list to ensure existing
8a74d28
+# entries starting with ! are not overridden.  Such entries support
8a74d28
+# whitelisting exceptions after a more generic blacklist pattern.
8a74d28
+insert_if_absent() {
8a74d28
+  file=$1
8a74d28
+  str=$2
8a74d28
+  test -f $file || touch $file
8a74d28
+  test -r $file || die "Error: failed to read ignore file: $file"
8a74d28
+  duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
8a74d28
+  if [ "$duplicate_entries" ] ; then
8a74d28
+    die "Error: Duplicate entries in $file: " $duplicate_entries
8a74d28
+  fi
8a74d28
+  linesold=$(gitignore_entries $file | wc -l)
8a74d28
+  linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
8a74d28
+  if [ $linesold != $linesnew ] ; then
8a74d28
+    { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
8a74d28
+      || die "insert_if_absent $file $str: failed"
8a74d28
+  fi
8a74d28
+}
8a74d28
+
8a74d28
+# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
8a74d28
+# insert_if_absent.
8a74d28
+insert_vc_ignore() {
8a74d28
+  vc_ignore_file="$1"
8a74d28
+  pattern="$2"
8a74d28
+  case $vc_ignore_file in
8a74d28
+  *.gitignore)
8a74d28
+    # A .gitignore entry that does not start with '/' applies
8a74d28
+    # recursively to subdirectories, so prepend '/' to every
8a74d28
+    # .gitignore entry.
8a74d28
+    pattern=$(echo "$pattern" | sed s,^,/,);;
8a74d28
+  esac
8a74d28
+  insert_if_absent "$vc_ignore_file" "$pattern"
8a74d28
+}
8a74d28
+
8a74d28
+symlink_to_dir()
8a74d28
+{
8a74d28
+  src=$1/$2
8a74d28
+  dst=${3-$2}
8a74d28
+
8a74d28
+  test -f "$src" && {
8a74d28
+
8a74d28
+    # If the destination directory doesn't exist, create it.
8a74d28
+    # This is required at least for "lib/uniwidth/cjk.h".
8a74d28
+    dst_dir=$(dirname "$dst")
8a74d28
+    if ! test -d "$dst_dir"; then
8a74d28
+      mkdir -p "$dst_dir"
8a74d28
+
8a74d28
+      # If we've just created a directory like lib/uniwidth,
8a74d28
+      # tell version control system(s) it's ignorable.
8a74d28
+      # FIXME: for now, this does only one level
8a74d28
+      parent=$(dirname "$dst_dir")
8a74d28
+      for dot_ig in x $vc_ignore; do
8a74d28
+        test $dot_ig = x && continue
8a74d28
+        ig=$parent/$dot_ig
8a74d28
+        insert_vc_ignore $ig "${dst_dir##*/}"
8a74d28
+      done
8a74d28
+    fi
8a74d28
+
8a74d28
+    if $copy; then
8a74d28
+      {
8a74d28
+        test ! -h "$dst" || {
8a74d28
+          echo "$me: rm -f $dst" &&
8a74d28
+          rm -f "$dst"
8a74d28
+        }
8a74d28
+      } &&
8a74d28
+      test -f "$dst" &&
8a74d28
+      cmp -s "$src" "$dst" || {
8a74d28
+        echo "$me: cp -fp $src $dst" &&
8a74d28
+        cp -fp "$src" "$dst"
8a74d28
+      }
8a74d28
+    else
8a74d28
+      # Leave any existing symlink alone, if it already points to the source,
8a74d28
+      # so that broken build tools that care about symlink times
8a74d28
+      # aren't confused into doing unnecessary builds.  Conversely, if the
8a74d28
+      # existing symlink's timestamp is older than the source, make it afresh,
8a74d28
+      # so that broken tools aren't confused into skipping needed builds.  See
8a74d28
+      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
8a74d28
+      test -h "$dst" &&
8a74d28
+      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
8a74d28
+      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
8a74d28
+      test "$src_i" = "$dst_i" &&
8a74d28
+      both_ls=$(ls -dt "$src" "$dst") &&
8a74d28
+      test "X$both_ls" = "X$dst$nl$src" || {
8a74d28
+        dot_dots=
8a74d28
+        case $src in
8a74d28
+        /*) ;;
8a74d28
+        *)
8a74d28
+          case /$dst/ in
8a74d28
+          *//* | */../* | */./* | /*/*/*/*/*/)
8a74d28
+             die "invalid symlink calculation: $src -> $dst";;
8a74d28
+          /*/*/*/*/)    dot_dots=../../../;;
8a74d28
+          /*/*/*/)      dot_dots=../../;;
8a74d28
+          /*/*/)        dot_dots=../;;
8a74d28
+          esac;;
8a74d28
+        esac
8a74d28
+
8a74d28
+        echo "$me: ln -fs $dot_dots$src $dst" &&
8a74d28
+        ln -fs "$dot_dots$src" "$dst"
8a74d28
+      }
8a74d28
+    fi
8a74d28
+  }
8a74d28
+}
8a74d28
+
8a74d28
 # Override the default configuration, if necessary.
8a74d28
 # Make sure that bootstrap.conf is sourced from the current directory
8a74d28
 # if we were invoked as "sh bootstrap".
8a74d28
@@ -320,6 +453,12 @@ do
8a74d28
   --help)
8a74d28
     usage
8a74d28
     exit;;
8a74d28
+  --version)
8a74d28
+    set -e
8a74d28
+    echo "bootstrap $scriptversion"
8a74d28
+    echo "$copyright"
8a74d28
+    exit 0
8a74d28
+    ;;
8a74d28
   --gnulib-srcdir=*)
8a74d28
     GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
8a74d28
   --skip-po)
8a74d28
@@ -335,7 +474,7 @@ do
8a74d28
   --no-git)
8a74d28
     use_git=false;;
8a74d28
   *)
8a74d28
-    die "$option: unknown option";;
8a74d28
+    bootstrap_option_hook $option || die "$option: unknown option";;
8a74d28
   esac
8a74d28
 done
8a74d28
 
8a74d28
@@ -346,47 +485,6 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
8a74d28
   die "Bootstrapping from a non-checked-out distribution is risky."
8a74d28
 fi
8a74d28
 
8a74d28
-# Strip blank and comment lines to leave significant entries.
8a74d28
-gitignore_entries() {
8a74d28
-  sed '/^#/d; /^$/d' "$@"
8a74d28
-}
8a74d28
-
8a74d28
-# If $STR is not already on a line by itself in $FILE, insert it at the start.
8a74d28
-# Entries are inserted at the start of the ignore list to ensure existing
8a74d28
-# entries starting with ! are not overridden.  Such entries support
8a74d28
-# whitelisting exceptions after a more generic blacklist pattern.
8a74d28
-insert_if_absent() {
8a74d28
-  file=$1
8a74d28
-  str=$2
8a74d28
-  test -f $file || touch $file
8a74d28
-  test -r $file || die "Error: failed to read ignore file: $file"
8a74d28
-  duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
8a74d28
-  if [ "$duplicate_entries" ] ; then
8a74d28
-    die "Error: Duplicate entries in $file: " $duplicate_entries
8a74d28
-  fi
8a74d28
-  linesold=$(gitignore_entries $file | wc -l)
8a74d28
-  linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
8a74d28
-  if [ $linesold != $linesnew ] ; then
8a74d28
-    { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
8a74d28
-      || die "insert_if_absent $file $str: failed"
8a74d28
-  fi
8a74d28
-}
8a74d28
-
8a74d28
-# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
8a74d28
-# insert_if_absent.
8a74d28
-insert_vc_ignore() {
8a74d28
-  vc_ignore_file="$1"
8a74d28
-  pattern="$2"
8a74d28
-  case $vc_ignore_file in
8a74d28
-  *.gitignore)
8a74d28
-    # A .gitignore entry that does not start with '/' applies
8a74d28
-    # recursively to subdirectories, so prepend '/' to every
8a74d28
-    # .gitignore entry.
8a74d28
-    pattern=$(echo "$pattern" | sed s,^,/,);;
8a74d28
-  esac
8a74d28
-  insert_if_absent "$vc_ignore_file" "$pattern"
8a74d28
-}
8a74d28
-
8a74d28
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
8a74d28
 found_aux_dir=no
8a74d28
 grep '^[	 ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
8a74d28
@@ -665,9 +763,25 @@ if $use_gnulib; then
8a74d28
       shallow=
8a74d28
       if test -z "$GNULIB_REVISION"; then
8a74d28
         git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
8a74d28
+        git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
8a74d28
+          || cleanup_gnulib
8a74d28
+      else
8a74d28
+        git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
8a74d28
+        mkdir -p "$gnulib_path"
8a74d28
+        # Only want a shallow checkout of $GNULIB_REVISION, but git does not
8a74d28
+        # support cloning by commit hash. So attempt a shallow fetch by commit
8a74d28
+        # hash to minimize the amount of data downloaded and changes needed to
8a74d28
+        # be processed, which can drastically reduce download and processing
8a74d28
+        # time for checkout. If the fetch by commit fails, a shallow fetch can
8a74d28
+        # not be performed because we do not know what the depth of the commit
8a74d28
+        # is without fetching all commits. So fallback to fetching all commits.
8a74d28
+        git -C "$gnulib_path" init
8a74d28
+        git -C "$gnulib_path" remote add origin ${GNULIB_URL:-$default_gnulib_url}
8a74d28
+        git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
8a74d28
+          || git -C "$gnulib_path" fetch origin \
8a74d28
+          || cleanup_gnulib
8a74d28
+        git -C "$gnulib_path" reset --hard FETCH_HEAD
8a74d28
       fi
8a74d28
-      git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
8a74d28
-        || cleanup_gnulib
8a74d28
 
8a74d28
       trap - 1 2 13 15
8a74d28
     fi
8a74d28
@@ -784,75 +898,6 @@ case $SKIP_PO in
8a74d28
   fi;;
8a74d28
 esac
8a74d28
 
8a74d28
-symlink_to_dir()
8a74d28
-{
8a74d28
-  src=$1/$2
8a74d28
-  dst=${3-$2}
8a74d28
-
8a74d28
-  test -f "$src" && {
8a74d28
-
8a74d28
-    # If the destination directory doesn't exist, create it.
8a74d28
-    # This is required at least for "lib/uniwidth/cjk.h".
8a74d28
-    dst_dir=$(dirname "$dst")
8a74d28
-    if ! test -d "$dst_dir"; then
8a74d28
-      mkdir -p "$dst_dir"
8a74d28
-
8a74d28
-      # If we've just created a directory like lib/uniwidth,
8a74d28
-      # tell version control system(s) it's ignorable.
8a74d28
-      # FIXME: for now, this does only one level
8a74d28
-      parent=$(dirname "$dst_dir")
8a74d28
-      for dot_ig in x $vc_ignore; do
8a74d28
-        test $dot_ig = x && continue
8a74d28
-        ig=$parent/$dot_ig
8a74d28
-        insert_vc_ignore $ig "${dst_dir##*/}"
8a74d28
-      done
8a74d28
-    fi
8a74d28
-
8a74d28
-    if $copy; then
8a74d28
-      {
8a74d28
-        test ! -h "$dst" || {
8a74d28
-          echo "$me: rm -f $dst" &&
8a74d28
-          rm -f "$dst"
8a74d28
-        }
8a74d28
-      } &&
8a74d28
-      test -f "$dst" &&
8a74d28
-      cmp -s "$src" "$dst" || {
8a74d28
-        echo "$me: cp -fp $src $dst" &&
8a74d28
-        cp -fp "$src" "$dst"
8a74d28
-      }
8a74d28
-    else
8a74d28
-      # Leave any existing symlink alone, if it already points to the source,
8a74d28
-      # so that broken build tools that care about symlink times
8a74d28
-      # aren't confused into doing unnecessary builds.  Conversely, if the
8a74d28
-      # existing symlink's timestamp is older than the source, make it afresh,
8a74d28
-      # so that broken tools aren't confused into skipping needed builds.  See
8a74d28
-      # <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
8a74d28
-      test -h "$dst" &&
8a74d28
-      src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
8a74d28
-      dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
8a74d28
-      test "$src_i" = "$dst_i" &&
8a74d28
-      both_ls=$(ls -dt "$src" "$dst") &&
8a74d28
-      test "X$both_ls" = "X$dst$nl$src" || {
8a74d28
-        dot_dots=
8a74d28
-        case $src in
8a74d28
-        /*) ;;
8a74d28
-        *)
8a74d28
-          case /$dst/ in
8a74d28
-          *//* | */../* | */./* | /*/*/*/*/*/)
8a74d28
-             die "invalid symlink calculation: $src -> $dst";;
8a74d28
-          /*/*/*/*/)    dot_dots=../../../;;
8a74d28
-          /*/*/*/)      dot_dots=../../;;
8a74d28
-          /*/*/)        dot_dots=../;;
8a74d28
-          esac;;
8a74d28
-        esac
8a74d28
-
8a74d28
-        echo "$me: ln -fs $dot_dots$src $dst" &&
8a74d28
-        ln -fs "$dot_dots$src" "$dst"
8a74d28
-      }
8a74d28
-    fi
8a74d28
-  }
8a74d28
-}
8a74d28
-
8a74d28
 version_controlled_file() {
8a74d28
   parent=$1
8a74d28
   file=$2
8a74d28
@@ -970,7 +1015,7 @@ bootstrap_post_import_hook \
8a74d28
 # Uninitialized submodules are listed with an initial dash.
8a74d28
 if $use_git && git submodule | grep '^-' >/dev/null; then
8a74d28
   die "some git submodules are not initialized. "     \
8a74d28
-      "Run 'git submodule init' and bootstrap again."
8a74d28
+      "Run 'git submodule update --init' and bootstrap again."
8a74d28
 fi
8a74d28
 
8a74d28
 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
8a74d28
@@ -1064,7 +1109,7 @@ bootstrap_epilogue
8a74d28
 
8a74d28
 echo "$0: done.  Now you can run './configure'."
8a74d28
 
8a74d28
-# Local variables:
8a74d28
+# Local Variables:
8a74d28
 # eval: (add-hook 'before-save-hook 'time-stamp)
8a74d28
 # time-stamp-start: "scriptversion="
8a74d28
 # time-stamp-format: "%:y-%02m-%02d.%02H"
8a74d28
diff --git a/bootstrap.conf b/bootstrap.conf
e622855
index 71ce943c7d..e4e5f3750a 100644
8a74d28
--- a/bootstrap.conf
8a74d28
+++ b/bootstrap.conf
8a74d28
@@ -1,6 +1,6 @@
8a74d28
 # Bootstrap configuration.
8a74d28
 
8a74d28
-# Copyright (C) 2006-2019 Free Software Foundation, Inc.
8a74d28
+# Copyright (C) 2006-2022 Free Software Foundation, Inc.
8a74d28
 
8a74d28
 # This program is free software: you can redistribute it and/or modify
8a74d28
 # it under the terms of the GNU General Public License as published by
8a74d28
@@ -16,11 +16,10 @@
8a74d28
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
8a74d28
 
8a74d28
 
8a74d28
-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263
8a74d28
+GNULIB_REVISION=9f48fb992a3d7e96610c4ce8be969cff2d61a01b
8a74d28
 
8a74d28
 # gnulib modules used by this package.
8a74d28
-# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than
8a74d28
-# directly.
8a74d28
+# mbswidth is used by fix-width.diff's changes to argp rather than directly.
8a74d28
 gnulib_modules="
8a74d28
   argp
8a74d28
   base64
8a74d28
@@ -67,8 +66,8 @@ SKIP_PO=t
8a74d28
 
8a74d28
 # Build prerequisites
8a74d28
 buildreq="\
8a74d28
-autoconf   2.63
8a74d28
-automake   1.11
8a74d28
+autoconf   2.64
8a74d28
+automake   1.14
8a74d28
 gettext    0.18.3
8a74d28
 git        1.5.5
8a74d28
 tar        -
8a74d28
@@ -80,11 +79,12 @@ cp -a INSTALL INSTALL.grub
8a74d28
 
8a74d28
 bootstrap_post_import_hook () {
8a74d28
   set -e
8a74d28
-  for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
8a74d28
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do
8a74d28
-    patch -d grub-core/lib/gnulib -p2 \
8a74d28
-      < "grub-core/lib/gnulib-patches/$patchname.patch"
8a74d28
-  done
8a74d28
+
8a74d28
+  # Instead of patching our gnulib and therefore maintaining a fork, submit
8a74d28
+  # changes to gnulib and update the hash above when they've merged.  Do not
8a74d28
+  # add new patches here.
8a74d28
+  patch -d grub-core/lib/gnulib -p2 < grub-core/lib/gnulib-patches/fix-width.patch
8a74d28
+
8a74d28
   for patchname in \
8a74d28
       0001-Support-POTFILES-shell \
8a74d28
       0002-Handle-gettext_printf-shell-function \
8a74d28
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
e622855
index 5eef708338..26ac8765e3 100644
8a74d28
--- a/conf/Makefile.extra-dist
8a74d28
+++ b/conf/Makefile.extra-dist
bd73b85
@@ -31,12 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
8a74d28
 EXTRA_DIST += grub-core/genemuinit.sh
8a74d28
 EXTRA_DIST += grub-core/genemuinitheader.sh
8a74d28
 
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8a74d28
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
8a74d28
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
8a74d28
 
8a74d28
 EXTRA_DIST += grub-core/lib/libgcrypt
8a74d28
diff --git a/config.h.in b/config.h.in
e622855
index c3134309c6..512d1bbe13 100644
8a74d28
--- a/config.h.in
8a74d28
+++ b/config.h.in
8a74d28
@@ -67,10 +67,78 @@
8a74d28
 #  define _GNU_SOURCE 1
8a74d28
 
8a74d28
 #  ifndef _GL_INLINE_HEADER_BEGIN
8a74d28
+/* gnulib gets configured against the host, not the target, and the rest of
8a74d28
+ * our buildsystem works around that.  This is difficult to avoid as gnulib's
8a74d28
+ * detection requires a more capable system than our target.  Instead, we
8a74d28
+ * reach in and set values appropriately - intentionally setting more than the
8a74d28
+ * bare minimum.  If, when updating gnulib, something breaks, there's probably
8a74d28
+ * a change needed here or in grub-core/Makefile.core.def. */
8a74d28
+#    define SIZE_MAX ((size_t) -1)
8a74d28
+#    define _GL_ATTRIBUTE_ALLOC_SIZE(args) \
8a74d28
+    __attribute__ ((__alloc_size__ args))
8a74d28
+#    define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
8a74d28
+#    define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
8a74d28
+#    define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
8a74d28
 #    define _GL_ATTRIBUTE_CONST __attribute__ ((const))
8a74d28
+#    define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute ((__malloc__ (f, i)))
8a74d28
+#    define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
8a74d28
+#    define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
8a74d28
+#    define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
8a74d28
+#    define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE \
8a74d28
+    __attribute__ ((externally_visible))
8a74d28
+#    define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
8a74d28
+#    define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
8a74d28
+#    define _GL_ATTRIBUTE_MALLOC __attribute__ ((malloc))
8a74d28
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
8a74d28
+#    define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
8a74d28
+#    define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
8a74d28
+#    define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
8a74d28
+#    define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
8a74d28
+#    define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
8a74d28
+#    define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
8a74d28
+#    define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
8a74d28
+#    define _GL_ATTRIBUTE_RETURNS_NONNULL \
8a74d28
+    __attribute__ ((__returns_nonnull__))
8a74d28
+#    define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
8a74d28
+#    define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
8a74d28
+#    define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
8a74d28
+#    define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
8a74d28
+#    define _GL_GNUC_PREREQ GNUC_PREREQ
8a74d28
+#    define _GL_INLINE inline
8a74d28
+#    define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
8a74d28
+
8a74d28
+/* We can't use __has_attribute for these because gcc-5.1 is too old for
8a74d28
+ * that.  Everything above is present in that version, though. */
8a74d28
+#    if __GNUC__ >= 7
8a74d28
+#      define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough))
8a74d28
+#    else
8a74d28
+#      define _GL_ATTRIBUTE_FALLTHROUGH /* empty */
8a74d28
+#    endif
8a74d28
+
8a74d28
+#    ifndef ASM_FILE
8a74d28
+typedef __INT_FAST32_TYPE__ int_fast32_t;
8a74d28
+typedef __UINT_FAST32_TYPE__ uint_fast32_t;
8a74d28
+#    endif
8a74d28
+
8a74d28
+/* Ensure ialloc nests static/non-static inline properly. */
8a74d28
+#    define IALLOC_INLINE static inline
8a74d28
+
8a74d28
+/* gnulib uses these for blocking out warnings they can't/won't fix.  gnulib
8a74d28
+ * also makes the decision about whether to provide a declaration for
8a74d28
+ * reallocarray() at compile-time, so this is a convenient place to override -
8a74d28
+ * it's used by the ialloc module, which is used by base64. */
8a74d28
+#    define _GL_INLINE_HEADER_BEGIN _Pragma ("GCC diagnostic push")	\
8a74d28
+    void *								\
8a74d28
+    reallocarray (void *ptr, unsigned int nmemb, unsigned int size);
8a74d28
+#    define _GL_INLINE_HEADER_END   _Pragma ("GCC diagnostic pop")
8a74d28
 
8a74d28
 /* We don't have an abort() for gnulib to call in regexp. */
8a74d28
 #    define abort __builtin_unreachable
8a74d28
 #  endif /* !_GL_INLINE_HEADER_BEGIN */
8a74d28
 
8a74d28
+/* gnulib doesn't build cleanly with older compilers. */
8a74d28
+#  if __GNUC__ < 11
8a74d28
+_Pragma ("GCC diagnostic ignored \"-Wtype-limits\"")
8a74d28
+#  endif
8a74d28
+
8a74d28
 #endif
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch
8a74d28
deleted file mode 100644
e622855
index 8fafa153a4..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-null-deref.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,13 +0,0 @@
8a74d28
-diff --git a/lib/argp-parse.c b/lib/argp-parse.c
8a74d28
-index 6dec57310..900adad54 100644
8a74d28
---- a/lib/argp-parse.c
8a74d28
-+++ b/lib/argp-parse.c
8a74d28
-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse)
8a74d28
- void *
8a74d28
- __argp_input (const struct argp *argp, const struct argp_state *state)
8a74d28
- {
8a74d28
--  if (state)
8a74d28
-+  if (state && state->pstate)
8a74d28
-     {
8a74d28
-       struct group *group;
8a74d28
-       struct parser *parser = state->pstate;
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8a74d28
deleted file mode 100644
e622855
index 813ec09c8a..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,12 +0,0 @@
8a74d28
---- a/lib/argp-help.c	2020-10-28 14:32:19.189215988 +0000
8a74d28
-+++ b/lib/argp-help.c	2020-10-28 14:38:21.204673940 +0000
8a74d28
-@@ -145,7 +145,8 @@
8a74d28
-       if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
8a74d28
-         {
8a74d28
-           __argp_failure (state, 0, 0,
8a74d28
--                          dgettext (state->root_argp->argp_domain,
8a74d28
-+                          dgettext (state == NULL ? NULL
8a74d28
-+                                    : state->root_argp->argp_domain,
8a74d28
-                                     "\
8a74d28
- ARGP_HELP_FMT: %s value is less than or equal to %s"),
8a74d28
-                           "rmargin", up->name);
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8a74d28
deleted file mode 100644
e622855
index 02e06315df..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,15 +0,0 @@
8a74d28
---- a/lib/regcomp.c	2020-11-24 17:06:08.159223858 +0000
8a74d28
-+++ b/lib/regcomp.c	2020-11-24 17:06:15.630253923 +0000
8a74d28
-@@ -3808,11 +3808,7 @@
8a74d28
- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
8a74d28
- 	     re_token_type_t type)
8a74d28
- {
8a74d28
--  re_token_t t;
8a74d28
--#if defined GCC_LINT || defined lint
8a74d28
--  memset (&t, 0, sizeof t);
8a74d28
--#endif
8a74d28
--  t.type = type;
8a74d28
-+  re_token_t t = { .type = type };
8a74d28
-   return create_token_tree (dfa, left, right, &t);
8a74d28
- }
8a74d28
- 
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8a74d28
deleted file mode 100644
e622855
index db6dac9c9e..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,12 +0,0 @@
8a74d28
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
8a74d28
-+++ b/lib/regexec.c	2020-11-05 10:55:09.621542984 +0000
8a74d28
-@@ -1692,6 +1692,9 @@
8a74d28
- {
8a74d28
-   Idx top = mctx->state_log_top;
8a74d28
-
8a74d28
-+  if (mctx->state_log == NULL)
8a74d28
-+    return REG_NOERROR;
8a74d28
-+
8a74d28
-   if ((next_state_log_idx >= mctx->input.bufs_len
8a74d28
-        && mctx->input.bufs_len < mctx->input.len)
8a74d28
-       || (next_state_log_idx >= mctx->input.valid_len
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8a74d28
deleted file mode 100644
e622855
index 7b4d9f67af..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,11 +0,0 @@
8a74d28
---- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
8a74d28
-+++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
8a74d28
-@@ -3662,7 +3662,7 @@
8a74d28
-   Idx alloc = 0;
8a74d28
- #endif /* not RE_ENABLE_I18N */
8a74d28
-   reg_errcode_t ret;
8a74d28
--  re_token_t br_token;
8a74d28
-+  re_token_t br_token = {0};
8a74d28
-   bin_tree_t *tree;
8a74d28
- 
8a74d28
-   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
8a74d28
diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch
8a74d28
deleted file mode 100644
e622855
index ba51f1bf22..0000000000
8a74d28
--- a/grub-core/lib/gnulib-patches/fix-unused-value.patch
8a74d28
+++ /dev/null
8a74d28
@@ -1,14 +0,0 @@
8a74d28
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
8a74d28
-+++ b/lib/regexec.c	2020-10-21 14:32:07.961765604 +0000
8a74d28
-@@ -828,7 +828,11 @@
8a74d28
- 		    break;
8a74d28
- 		  if (__glibc_unlikely (err != REG_NOMATCH))
8a74d28
- 		    goto free_return;
8a74d28
-+#ifdef DEBUG
8a74d28
-+		  /* Only used for assertion below when DEBUG is set, otherwise
8a74d28
-+		     it will be over-written when we loop around.  */
8a74d28
- 		  match_last = -1;
8a74d28
-+#endif
8a74d28
- 		}
8a74d28
- 	      else
8a74d28
- 		break; /* We found a match.  */