Blame SOURCES/0136-Use-git-to-apply-gnulib-patches.patch

8e15ce
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8e15ce
From: Peter Jones <pjones@redhat.com>
8e15ce
Date: Mon, 29 Jul 2019 11:21:27 -0400
8e15ce
Subject: [PATCH] Use git to apply gnulib patches.
8e15ce
8e15ce
Signed-off-by: Peter Jones <pjones@redhat.com>
8e15ce
---
8e15ce
 bootstrap.conf                                     |   6 -
8e15ce
 conf/Makefile.extra-dist                           |  10 -
8e15ce
 grub-core/lib/gnulib-patches/fix-base64.patch      |  21 --
8e15ce
 grub-core/lib/gnulib-patches/fix-null-deref.patch  |  13 --
8e15ce
 .../lib/gnulib-patches/fix-null-state-deref.patch  |  12 --
8e15ce
 .../gnulib-patches/fix-regcomp-uninit-token.patch  |  15 --
8e15ce
 .../gnulib-patches/fix-regexec-null-deref.patch    |  12 --
8e15ce
 .../gnulib-patches/fix-sign-compare-errors.patch   | 161 ---------------
8e15ce
 .../lib/gnulib-patches/fix-uninit-structure.patch  |  11 --
8e15ce
 .../lib/gnulib-patches/fix-unused-value.patch      |  14 --
8e15ce
 grub-core/lib/gnulib-patches/fix-width.patch       | 217 ---------------------
8e15ce
 grub-core/lib/gnulib-patches/no-abort.patch        |  26 ---
8e15ce
 12 files changed, 518 deletions(-)
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch
8e15ce
 delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch
8e15ce
8e15ce
diff --git a/bootstrap.conf b/bootstrap.conf
8e15ce
index 9259526e891..452f4d79b0d 100644
8e15ce
--- a/bootstrap.conf
8e15ce
+++ b/bootstrap.conf
8e15ce
@@ -85,12 +85,6 @@ cp -a INSTALL INSTALL.grub
8e15ce
 
8e15ce
 bootstrap_post_import_hook () {
8e15ce
   set -e
8e15ce
-  for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
8e15ce
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort \
8e15ce
-      fix-sign-compare-errors; do
8e15ce
-    patch -d grub-core/lib/gnulib -p2 \
8e15ce
-      < "grub-core/lib/gnulib-patches/$patchname.patch"
8e15ce
-  done
8e15ce
   for patchname in \
8e15ce
       0001-Support-POTFILES-shell \
8e15ce
       0002-Handle-gettext_printf-shell-function \
8e15ce
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
8e15ce
index ea58362b555..8ddf22e6c99 100644
8e15ce
--- a/conf/Makefile.extra-dist
8e15ce
+++ b/conf/Makefile.extra-dist
8e15ce
@@ -30,16 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
8e15ce
 EXTRA_DIST += grub-core/genemuinit.sh
8e15ce
 EXTRA_DIST += grub-core/genemuinitheader.sh
8e15ce
 
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
8e15ce
-EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
8e15ce
-
8e15ce
 EXTRA_DIST += grub-core/lib/libgcrypt
8e15ce
 EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
8e15ce
 EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch
8e15ce
deleted file mode 100644
8e15ce
index 985db127971..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-base64.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,21 +0,0 @@
8e15ce
-diff --git a/lib/base64.h b/lib/base64.h
8e15ce
-index 9cd0183b8..185a2afa1 100644
8e15ce
---- a/lib/base64.h
8e15ce
-+++ b/lib/base64.h
8e15ce
-@@ -21,8 +21,14 @@
8e15ce
- /* Get size_t. */
8e15ce
- # include <stddef.h>
8e15ce
- 
8e15ce
--/* Get bool. */
8e15ce
--# include <stdbool.h>
8e15ce
-+#ifndef GRUB_POSIX_BOOL_DEFINED
8e15ce
-+typedef enum { false = 0, true = 1 } bool;
8e15ce
-+#define GRUB_POSIX_BOOL_DEFINED 1
8e15ce
-+#endif
8e15ce
-+
8e15ce
-+#ifndef _GL_ATTRIBUTE_CONST
8e15ce
-+# define _GL_ATTRIBUTE_CONST /* empty */
8e15ce
-+#endif
8e15ce
- 
8e15ce
- # ifdef __cplusplus
8e15ce
- extern "C" {
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch
8e15ce
deleted file mode 100644
8e15ce
index 8fafa153a47..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-null-deref.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,13 +0,0 @@
8e15ce
-diff --git a/lib/argp-parse.c b/lib/argp-parse.c
8e15ce
-index 6dec57310..900adad54 100644
8e15ce
---- a/lib/argp-parse.c
8e15ce
-+++ b/lib/argp-parse.c
8e15ce
-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse)
8e15ce
- void *
8e15ce
- __argp_input (const struct argp *argp, const struct argp_state *state)
8e15ce
- {
8e15ce
--  if (state)
8e15ce
-+  if (state && state->pstate)
8e15ce
-     {
8e15ce
-       struct group *group;
8e15ce
-       struct parser *parser = state->pstate;
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8e15ce
deleted file mode 100644
8e15ce
index 813ec09c8a1..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,12 +0,0 @@
8e15ce
---- a/lib/argp-help.c	2020-10-28 14:32:19.189215988 +0000
8e15ce
-+++ b/lib/argp-help.c	2020-10-28 14:38:21.204673940 +0000
8e15ce
-@@ -145,7 +145,8 @@
8e15ce
-       if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
8e15ce
-         {
8e15ce
-           __argp_failure (state, 0, 0,
8e15ce
--                          dgettext (state->root_argp->argp_domain,
8e15ce
-+                          dgettext (state == NULL ? NULL
8e15ce
-+                                    : state->root_argp->argp_domain,
8e15ce
-                                     "\
8e15ce
- ARGP_HELP_FMT: %s value is less than or equal to %s"),
8e15ce
-                           "rmargin", up->name);
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8e15ce
deleted file mode 100644
8e15ce
index 02e06315dff..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,15 +0,0 @@
8e15ce
---- a/lib/regcomp.c	2020-11-24 17:06:08.159223858 +0000
8e15ce
-+++ b/lib/regcomp.c	2020-11-24 17:06:15.630253923 +0000
8e15ce
-@@ -3808,11 +3808,7 @@
8e15ce
- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
8e15ce
- 	     re_token_type_t type)
8e15ce
- {
8e15ce
--  re_token_t t;
8e15ce
--#if defined GCC_LINT || defined lint
8e15ce
--  memset (&t, 0, sizeof t);
8e15ce
--#endif
8e15ce
--  t.type = type;
8e15ce
-+  re_token_t t = { .type = type };
8e15ce
-   return create_token_tree (dfa, left, right, &t);
8e15ce
- }
8e15ce
- 
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8e15ce
deleted file mode 100644
8e15ce
index db6dac9c9e3..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,12 +0,0 @@
8e15ce
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
8e15ce
-+++ b/lib/regexec.c	2020-11-05 10:55:09.621542984 +0000
8e15ce
-@@ -1692,6 +1692,9 @@
8e15ce
- {
8e15ce
-   Idx top = mctx->state_log_top;
8e15ce
-
8e15ce
-+  if (mctx->state_log == NULL)
8e15ce
-+    return REG_NOERROR;
8e15ce
-+
8e15ce
-   if ((next_state_log_idx >= mctx->input.bufs_len
8e15ce
-        && mctx->input.bufs_len < mctx->input.len)
8e15ce
-       || (next_state_log_idx >= mctx->input.valid_len
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch
8e15ce
deleted file mode 100644
8e15ce
index 479029c0565..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,161 +0,0 @@
8e15ce
-diff --git a/lib/regcomp.c b/lib/regcomp.c
8e15ce
-index cc85f35ac58..361079d82d6 100644
8e15ce
---- a/lib/regcomp.c
8e15ce
-+++ b/lib/regcomp.c
8e15ce
-@@ -322,7 +322,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
8e15ce
- 		*p++ = dfa->nodes[node].opr.c;
8e15ce
- 	      memset (&state, '\0', sizeof (state));
8e15ce
- 	      if (__mbrtowc (&wc, (const char *) buf, p - buf,
8e15ce
--			     &state) == p - buf
8e15ce
-+			     &state) == (size_t)(p - buf)
8e15ce
- 		  && (__wcrtomb ((char *) buf, __towlower (wc), &state)
8e15ce
- 		      != (size_t) -1))
8e15ce
- 		re_set_fastmap (fastmap, false, buf[0]);
8e15ce
-@@ -3778,7 +3778,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
8e15ce
-       num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2)
8e15ce
- 	     ? -2
8e15ce
- 	     : num == -1
8e15ce
--	     ? c - '0'
8e15ce
-+	     ? (Idx)(c - '0')
8e15ce
- 	     : MIN (RE_DUP_MAX + 1, num * 10 + c - '0'));
8e15ce
-     }
8e15ce
-   return num;
8e15ce
-diff --git a/lib/regex_internal.c b/lib/regex_internal.c
8e15ce
-index 9004ce809eb..193a1e3d332 100644
8e15ce
---- a/lib/regex_internal.c
8e15ce
-+++ b/lib/regex_internal.c
8e15ce
-@@ -233,7 +233,7 @@ build_wcs_buffer (re_string_t *pstr)
8e15ce
-       /* Apply the translation if we need.  */
8e15ce
-       if (__glibc_unlikely (pstr->trans != NULL))
8e15ce
- 	{
8e15ce
--	  int i, ch;
8e15ce
-+	  unsigned int i, ch;
8e15ce
- 
8e15ce
- 	  for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
8e15ce
- 	    {
8e15ce
-@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
8e15ce
- 	prev_st = pstr->cur_state;
8e15ce
- 	if (__glibc_unlikely (pstr->trans != NULL))
8e15ce
- 	  {
8e15ce
--	    int i, ch;
8e15ce
-+	    unsigned int i, ch;
8e15ce
- 
8e15ce
- 	    for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
8e15ce
- 	      {
8e15ce
-@@ -754,7 +754,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
8e15ce
- 			  memset (&cur_state, 0, sizeof (cur_state));
8e15ce
- 			  mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
8e15ce
- 					      &cur_state);
8e15ce
--			  if (raw + offset - p <= mbclen
8e15ce
-+			  if ((size_t)(raw + offset - p) <= mbclen
8e15ce
- 			      && mbclen < (size_t) -2)
8e15ce
- 			    {
8e15ce
- 			      memset (&pstr->cur_state, '\0',
8e15ce
-diff --git a/lib/regex_internal.h b/lib/regex_internal.h
8e15ce
-index 5462419b787..e0f8292395d 100644
8e15ce
---- a/lib/regex_internal.h
8e15ce
-+++ b/lib/regex_internal.h
8e15ce
-@@ -425,7 +425,7 @@ struct re_string_t
8e15ce
-   unsigned char offsets_needed;
8e15ce
-   unsigned char newline_anchor;
8e15ce
-   unsigned char word_ops_used;
8e15ce
--  int mb_cur_max;
8e15ce
-+  unsigned int mb_cur_max;
8e15ce
- };
8e15ce
- typedef struct re_string_t re_string_t;
8e15ce
- 
8e15ce
-@@ -702,7 +702,7 @@ struct re_dfa_t
8e15ce
-   unsigned int is_utf8 : 1;
8e15ce
-   unsigned int map_notascii : 1;
8e15ce
-   unsigned int word_ops_used : 1;
8e15ce
--  int mb_cur_max;
8e15ce
-+  unsigned int mb_cur_max;
8e15ce
-   bitset_t word_char;
8e15ce
-   reg_syntax_t syntax;
8e15ce
-   Idx *subexp_map;
8e15ce
-diff --git a/lib/regexec.c b/lib/regexec.c
8e15ce
-index 0a7a27b772e..b57d4f9141d 100644
8e15ce
---- a/lib/regexec.c
8e15ce
-+++ b/lib/regexec.c
8e15ce
-@@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length,
8e15ce
-     {
8e15ce
-       if (ret_len)
8e15ce
- 	{
8e15ce
--	  assert (pmatch[0].rm_so == start);
8e15ce
-+	  assert (pmatch[0].rm_so == (long)start);
8e15ce
- 	  rval = pmatch[0].rm_eo - start;
8e15ce
- 	}
8e15ce
-       else
8e15ce
-@@ -877,11 +877,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
8e15ce
- 	    if (__glibc_unlikely (mctx.input.offsets_needed != 0))
8e15ce
- 	      {
8e15ce
- 		pmatch[reg_idx].rm_so =
8e15ce
--		  (pmatch[reg_idx].rm_so == mctx.input.valid_len
8e15ce
-+		  (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len
8e15ce
- 		   ? mctx.input.valid_raw_len
8e15ce
- 		   : mctx.input.offsets[pmatch[reg_idx].rm_so]);
8e15ce
- 		pmatch[reg_idx].rm_eo =
8e15ce
--		  (pmatch[reg_idx].rm_eo == mctx.input.valid_len
8e15ce
-+		  (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len
8e15ce
- 		   ? mctx.input.valid_raw_len
8e15ce
- 		   : mctx.input.offsets[pmatch[reg_idx].rm_eo]);
8e15ce
- 	      }
8e15ce
-@@ -1418,11 +1418,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
8e15ce
-     }
8e15ce
-   memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
8e15ce
- 
8e15ce
--  for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;)
8e15ce
-+  for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;)
8e15ce
-     {
8e15ce
-       update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
8e15ce
- 
8e15ce
--      if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
8e15ce
-+      if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node)
8e15ce
- 	{
8e15ce
- 	  Idx reg_idx;
8e15ce
- 	  if (fs)
8e15ce
-@@ -1519,7 +1519,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
8e15ce
-       if (reg_num < nmatch)
8e15ce
- 	{
8e15ce
- 	  /* We are at the last node of this sub expression.  */
8e15ce
--	  if (pmatch[reg_num].rm_so < cur_idx)
8e15ce
-+	  if (pmatch[reg_num].rm_so < (long)cur_idx)
8e15ce
- 	    {
8e15ce
- 	      pmatch[reg_num].rm_eo = cur_idx;
8e15ce
- 	      /* This is a non-empty match or we are not inside an optional
8e15ce
-@@ -2938,7 +2938,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
8e15ce
-       mctx->state_log[str_idx] = cur_state;
8e15ce
-     }
8e15ce
- 
8e15ce
--  for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;)
8e15ce
-+  for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;)
8e15ce
-     {
8e15ce
-       re_node_set_empty (&next_nodes);
8e15ce
-       if (mctx->state_log[str_idx + 1])
8e15ce
-@@ -3718,7 +3718,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
8e15ce
- 			 const re_string_t *input, Idx str_idx)
8e15ce
- {
8e15ce
-   const re_token_t *node = dfa->nodes + node_idx;
8e15ce
--  int char_len, elem_len;
8e15ce
-+  unsigned int char_len, elem_len;
8e15ce
-   Idx i;
8e15ce
- 
8e15ce
-   if (__glibc_unlikely (node->type == OP_UTF8_PERIOD))
8e15ce
-@@ -4066,7 +4066,7 @@ extend_buffers (re_match_context_t *mctx, int min_len)
8e15ce
-   /* Double the lengths of the buffers, but allocate at least MIN_LEN.  */
8e15ce
-   ret = re_string_realloc_buffers (pstr,
8e15ce
- 				   MAX (min_len,
8e15ce
--					MIN (pstr->len, pstr->bufs_len * 2)));
8e15ce
-+					MIN ((long)pstr->len, pstr->bufs_len * 2)));
8e15ce
-   if (__glibc_unlikely (ret != REG_NOERROR))
8e15ce
-     return ret;
8e15ce
- 
8e15ce
-@@ -4236,7 +4236,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from,
8e15ce
-     = (from == to ? -1 : 0);
8e15ce
- 
8e15ce
-   mctx->bkref_ents[mctx->nbkref_ents++].more = 0;
8e15ce
--  if (mctx->max_mb_elem_len < to - from)
8e15ce
-+  if (mctx->max_mb_elem_len < (long)(to - from))
8e15ce
-     mctx->max_mb_elem_len = to - from;
8e15ce
-   return REG_NOERROR;
8e15ce
- }
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8e15ce
deleted file mode 100644
8e15ce
index 7b4d9f67af4..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,11 +0,0 @@
8e15ce
---- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
8e15ce
-+++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
8e15ce
-@@ -3662,7 +3662,7 @@
8e15ce
-   Idx alloc = 0;
8e15ce
- #endif /* not RE_ENABLE_I18N */
8e15ce
-   reg_errcode_t ret;
8e15ce
--  re_token_t br_token;
8e15ce
-+  re_token_t br_token = {0};
8e15ce
-   bin_tree_t *tree;
8e15ce
- 
8e15ce
-   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch
8e15ce
deleted file mode 100644
8e15ce
index ba51f1bf223..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-unused-value.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,14 +0,0 @@
8e15ce
---- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
8e15ce
-+++ b/lib/regexec.c	2020-10-21 14:32:07.961765604 +0000
8e15ce
-@@ -828,7 +828,11 @@
8e15ce
- 		    break;
8e15ce
- 		  if (__glibc_unlikely (err != REG_NOMATCH))
8e15ce
- 		    goto free_return;
8e15ce
-+#ifdef DEBUG
8e15ce
-+		  /* Only used for assertion below when DEBUG is set, otherwise
8e15ce
-+		     it will be over-written when we loop around.  */
8e15ce
- 		  match_last = -1;
8e15ce
-+#endif
8e15ce
- 		}
8e15ce
- 	      else
8e15ce
- 		break; /* We found a match.  */
8e15ce
diff --git a/grub-core/lib/gnulib-patches/fix-width.patch b/grub-core/lib/gnulib-patches/fix-width.patch
8e15ce
deleted file mode 100644
8e15ce
index 0a208ad08b5..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/fix-width.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,217 +0,0 @@
8e15ce
-diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c
8e15ce
-index ba6a407f7..d0685b3d4 100644
8e15ce
---- a/lib/argp-fmtstream.c
8e15ce
-+++ b/lib/argp-fmtstream.c
8e15ce
-@@ -28,9 +28,11 @@
8e15ce
- #include <errno.h>
8e15ce
- #include <stdarg.h>
8e15ce
- #include <ctype.h>
8e15ce
-+#include <wchar.h>
8e15ce
- 
8e15ce
- #include "argp-fmtstream.h"
8e15ce
- #include "argp-namefrob.h"
8e15ce
-+#include "mbswidth.h"
8e15ce
- 
8e15ce
- #ifndef ARGP_FMTSTREAM_USE_LINEWRAP
8e15ce
- 
8e15ce
-@@ -115,6 +117,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
8e15ce
- #endif
8e15ce
- #endif
8e15ce
- 
8e15ce
-+
8e15ce
-+/* Return the pointer to the first character that doesn't fit in l columns.  */
8e15ce
-+static inline const ptrdiff_t
8e15ce
-+add_width (const char *ptr, const char *end, size_t l)
8e15ce
-+{
8e15ce
-+  mbstate_t ps;
8e15ce
-+  const char *ptr0 = ptr;
8e15ce
-+
8e15ce
-+  memset (&ps, 0, sizeof (ps));
8e15ce
-+
8e15ce
-+  while (ptr < end)
8e15ce
-+    {
8e15ce
-+      wchar_t wc;
8e15ce
-+      size_t s, k;
8e15ce
-+
8e15ce
-+      s = mbrtowc (&wc, ptr, end - ptr, &ps);
8e15ce
-+      if (s == (size_t) -1)
8e15ce
-+	break;
8e15ce
-+      if (s == (size_t) -2)
8e15ce
-+	{
8e15ce
-+	  if (1 >= l)
8e15ce
-+	    break;
8e15ce
-+	  l--;
8e15ce
-+	  ptr++;
8e15ce
-+	  continue;
8e15ce
-+	}
8e15ce
-+
8e15ce
-+      if (wc == '\e' && ptr + 3 < end
8e15ce
-+	  && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1')
8e15ce
-+	  && ptr[3] == 'm')
8e15ce
-+	{
8e15ce
-+	  ptr += 4;
8e15ce
-+	  continue;
8e15ce
-+	}
8e15ce
-+
8e15ce
-+      k = wcwidth (wc);
8e15ce
-+
8e15ce
-+      if (k >= l)
8e15ce
-+	break;
8e15ce
-+      l -= k;
8e15ce
-+      ptr += s;
8e15ce
-+    }
8e15ce
-+  return ptr - ptr0;
8e15ce
-+}
8e15ce
-+
8e15ce
- /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
8e15ce
-    end of its buffer.  This code is mostly from glibc stdio/linewrap.c.  */
8e15ce
- void
8e15ce
-@@ -168,13 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
8e15ce
-       if (!nl)
8e15ce
-         {
8e15ce
-           /* The buffer ends in a partial line.  */
8e15ce
-+          size_t display_width = mbsnwidth (buf, fs->p - buf,
8e15ce
-+                                            MBSW_STOP_AT_NUL);
8e15ce
- 
8e15ce
--          if (fs->point_col + len < fs->rmargin)
8e15ce
-+          if (fs->point_col + display_width < fs->rmargin)
8e15ce
-             {
8e15ce
-               /* The remaining buffer text is a partial line and fits
8e15ce
-                  within the maximum line width.  Advance point for the
8e15ce
-                  characters to be written and stop scanning.  */
8e15ce
--              fs->point_col += len;
8e15ce
-+              fs->point_col += display_width;
8e15ce
-               break;
8e15ce
-             }
8e15ce
-           else
8e15ce
-@@ -182,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
8e15ce
-                the end of the buffer.  */
8e15ce
-             nl = fs->p;
8e15ce
-         }
8e15ce
--      else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
8e15ce
--        {
8e15ce
--          /* The buffer contains a full line that fits within the maximum
8e15ce
--             line width.  Reset point and scan the next line.  */
8e15ce
--          fs->point_col = 0;
8e15ce
--          buf = nl + 1;
8e15ce
--          continue;
8e15ce
--        }
8e15ce
-+      else
8e15ce
-+	{
8e15ce
-+	  size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL);
8e15ce
-+	  if (display_width < (ssize_t) fs->rmargin)
8e15ce
-+	    {
8e15ce
-+	      /* The buffer contains a full line that fits within the maximum
8e15ce
-+		 line width.  Reset point and scan the next line.  */
8e15ce
-+	      fs->point_col = 0;
8e15ce
-+	      buf = nl + 1;
8e15ce
-+	      continue;
8e15ce
-+	    }
8e15ce
-+	}
8e15ce
- 
8e15ce
-       /* This line is too long.  */
8e15ce
-       r = fs->rmargin - 1;
8e15ce
-@@ -225,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
8e15ce
-           char *p, *nextline;
8e15ce
-           int i;
8e15ce
- 
8e15ce
--          p = buf + (r + 1 - fs->point_col);
8e15ce
-+          p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col));
8e15ce
-           while (p >= buf && !isblank ((unsigned char) *p))
8e15ce
-             --p;
8e15ce
-           nextline = p + 1;     /* This will begin the next line.  */
8e15ce
-@@ -243,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
8e15ce
-             {
8e15ce
-               /* A single word that is greater than the maximum line width.
8e15ce
-                  Oh well.  Put it on an overlong line by itself.  */
8e15ce
--              p = buf + (r + 1 - fs->point_col);
8e15ce
-+              p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col));
8e15ce
-               /* Find the end of the long word.  */
8e15ce
-               if (p < nl)
8e15ce
-                 do
8e15ce
-@@ -277,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
8e15ce
-               && fs->p > nextline)
8e15ce
-             {
8e15ce
-               /* The margin needs more blanks than we removed.  */
8e15ce
--              if (fs->end - fs->p > fs->wmargin + 1)
8e15ce
-+              if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL)
8e15ce
-+                  > fs->wmargin + 1)
8e15ce
-                 /* Make some space for them.  */
8e15ce
-                 {
8e15ce
-                   size_t mv = fs->p - nextline;
8e15ce
-diff --git a/lib/argp-help.c b/lib/argp-help.c
8e15ce
-index e5375a0f0..5d8f451ec 100644
8e15ce
---- a/lib/argp-help.c
8e15ce
-+++ b/lib/argp-help.c
8e15ce
-@@ -51,6 +51,7 @@
8e15ce
- #include "argp.h"
8e15ce
- #include "argp-fmtstream.h"
8e15ce
- #include "argp-namefrob.h"
8e15ce
-+#include "mbswidth.h"
8e15ce
- 
8e15ce
- #ifndef SIZE_MAX
8e15ce
- # define SIZE_MAX ((size_t) -1)
8e15ce
-@@ -1432,7 +1433,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
8e15ce
- 
8e15ce
-       /* Manually do line wrapping so that it (probably) won't get wrapped at
8e15ce
-          any embedded spaces.  */
8e15ce
--      space (stream, 1 + nl - cp);
8e15ce
-+      space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL));
8e15ce
- 
8e15ce
-       __argp_fmtstream_write (stream, cp, nl - cp);
8e15ce
-     }
8e15ce
-diff --git a/lib/mbswidth.c b/lib/mbswidth.c
8e15ce
-index 408a15e34..b3fb7f83a 100644
8e15ce
---- a/lib/mbswidth.c
8e15ce
-+++ b/lib/mbswidth.c
8e15ce
-@@ -38,6 +38,14 @@
8e15ce
- /* Get INT_MAX.  */
8e15ce
- #include <limits.h>
8e15ce
- 
8e15ce
-+#ifndef FALLTHROUGH
8e15ce
-+# if __GNUC__ < 7
8e15ce
-+#  define FALLTHROUGH ((void) 0)
8e15ce
-+# else
8e15ce
-+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
8e15ce
-+# endif
8e15ce
-+#endif
8e15ce
-+
8e15ce
- /* Returns the number of columns needed to represent the multibyte
8e15ce
-    character string pointed to by STRING.  If a non-printable character
8e15ce
-    occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
8e15ce
-@@ -90,6 +98,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
8e15ce
-               p++;
8e15ce
-               width++;
8e15ce
-               break;
8e15ce
-+            case '\0':
8e15ce
-+              if (flags & MBSW_STOP_AT_NUL)
8e15ce
-+                return width;
8e15ce
-+              FALLTHROUGH;
8e15ce
-             default:
8e15ce
-               /* If we have a multibyte sequence, scan it up to its end.  */
8e15ce
-               {
8e15ce
-@@ -168,6 +180,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
8e15ce
-     {
8e15ce
-       unsigned char c = (unsigned char) *p++;
8e15ce
- 
8e15ce
-+      if (c == 0 && (flags & MBSW_STOP_AT_NUL))
8e15ce
-+        return width;
8e15ce
-+
8e15ce
-       if (isprint (c))
8e15ce
-         {
8e15ce
-           if (width == INT_MAX)
8e15ce
-diff --git a/lib/mbswidth.h b/lib/mbswidth.h
8e15ce
-index 2b5c53c37..45a123e63 100644
8e15ce
---- a/lib/mbswidth.h
8e15ce
-+++ b/lib/mbswidth.h
8e15ce
-@@ -45,6 +45,10 @@ extern "C" {
8e15ce
-    control characters and 1 otherwise.  */
8e15ce
- #define MBSW_REJECT_UNPRINTABLE 2
8e15ce
- 
8e15ce
-+/* If this bit is set \0 is treated as the end of string.
8e15ce
-+   Otherwise it's treated as a normal one column width character.  */
8e15ce
-+#define MBSW_STOP_AT_NUL 4
8e15ce
-+
8e15ce
- 
8e15ce
- /* Returns the number of screen columns needed for STRING.  */
8e15ce
- #define mbswidth gnu_mbswidth  /* avoid clash with UnixWare 7.1.1 function */
8e15ce
diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch
8e15ce
deleted file mode 100644
8e15ce
index e469c4762eb..00000000000
8e15ce
--- a/grub-core/lib/gnulib-patches/no-abort.patch
8e15ce
+++ /dev/null
8e15ce
@@ -1,26 +0,0 @@
8e15ce
-diff --git a/lib/regcomp.c b/lib/regcomp.c
8e15ce
-index cc85f35ac..de45ebb5c 100644
8e15ce
---- a/lib/regcomp.c
8e15ce
-+++ b/lib/regcomp.c
8e15ce
-@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
8e15ce
-        to this routine.  If we are given anything else, or if other regex
8e15ce
-        code generates an invalid error code, then the program has a bug.
8e15ce
-        Dump core so we can fix it.  */
8e15ce
--    abort ();
8e15ce
--
8e15ce
--  msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
8e15ce
-+    msg = gettext ("unknown regexp error");
8e15ce
-+  else
8e15ce
-+    msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
8e15ce
- 
8e15ce
-   msg_size = strlen (msg) + 1; /* Includes the null.  */
8e15ce
- 
8e15ce
-@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa)
8e15ce
- 	}
8e15ce
- 	break;
8e15ce
-       default:
8e15ce
--	abort ();
8e15ce
-+	break;
8e15ce
-       }
8e15ce
- 
8e15ce
-   if (mb_chars || has_period)