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

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