Blame SOURCES/0201-Drop-gnulib-no-abort.patch.patch

b35c50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b35c50
From: Robbie Harwood <rharwood@redhat.com>
b35c50
Date: Wed, 5 Jan 2022 16:42:11 -0500
b35c50
Subject: [PATCH] Drop gnulib no-abort.patch
b35c50
b35c50
Originally added in db7337a3d353a817ffe9eb4a3702120527100be9, this
b35c50
patched out all relevant invocations of abort() in gnulib.  While it was
b35c50
not documented why at the time, testing suggests that there's no abort()
b35c50
implementation available for gnulib to use.
b35c50
b35c50
gnulib's position is that the use of abort() is correct here, since it
b35c50
happens when input violates a "shall" from POSIX.  Additionally, the
b35c50
code in question is probably not reachable.  Since abort() is more
b35c50
friendly to user-space, they prefer to make no change, so we can just
b35c50
carry a define instead.  (Suggested by Paul Eggert.)
b35c50
b35c50
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
b35c50
(cherry picked from commit 5137c8eb3ec11c3217acea1a93a3f88f3fa4cbca)
b35c50
---
b35c50
 bootstrap.conf                              |  2 +-
b35c50
 conf/Makefile.extra-dist                    |  1 -
b35c50
 config.h.in                                 |  3 +++
b35c50
 grub-core/lib/gnulib-patches/no-abort.patch | 26 --------------------------
b35c50
 4 files changed, 4 insertions(+), 28 deletions(-)
b35c50
 delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch
b35c50
b35c50
diff --git a/bootstrap.conf b/bootstrap.conf
b35c50
index 645e3a459c..71ce943c7d 100644
b35c50
--- a/bootstrap.conf
b35c50
+++ b/bootstrap.conf
b35c50
@@ -81,7 +81,7 @@ cp -a INSTALL INSTALL.grub
b35c50
 bootstrap_post_import_hook () {
b35c50
   set -e
b35c50
   for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
b35c50
-      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do
b35c50
+      fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do
b35c50
     patch -d grub-core/lib/gnulib -p2 \
b35c50
       < "grub-core/lib/gnulib-patches/$patchname.patch"
b35c50
   done
b35c50
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
b35c50
index f4791dc6ca..5eef708338 100644
b35c50
--- a/conf/Makefile.extra-dist
b35c50
+++ b/conf/Makefile.extra-dist
b35c50
@@ -38,7 +38,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
b35c50
-EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
b35c50
 
b35c50
 EXTRA_DIST += grub-core/lib/libgcrypt
b35c50
 EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
b35c50
diff --git a/config.h.in b/config.h.in
b35c50
index 9c7b4afaaa..c3134309c6 100644
b35c50
--- a/config.h.in
b35c50
+++ b/config.h.in
b35c50
@@ -68,6 +68,9 @@
b35c50
 
b35c50
 #  ifndef _GL_INLINE_HEADER_BEGIN
b35c50
 #    define _GL_ATTRIBUTE_CONST __attribute__ ((const))
b35c50
+
b35c50
+/* We don't have an abort() for gnulib to call in regexp. */
b35c50
+#    define abort __builtin_unreachable
b35c50
 #  endif /* !_GL_INLINE_HEADER_BEGIN */
b35c50
 
b35c50
 #endif
b35c50
diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch
b35c50
deleted file mode 100644
b35c50
index e469c4762e..0000000000
b35c50
--- a/grub-core/lib/gnulib-patches/no-abort.patch
b35c50
+++ /dev/null
b35c50
@@ -1,26 +0,0 @@
b35c50
-diff --git a/lib/regcomp.c b/lib/regcomp.c
b35c50
-index cc85f35ac..de45ebb5c 100644
b35c50
---- a/lib/regcomp.c
b35c50
-+++ b/lib/regcomp.c
b35c50
-@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
b35c50
-        to this routine.  If we are given anything else, or if other regex
b35c50
-        code generates an invalid error code, then the program has a bug.
b35c50
-        Dump core so we can fix it.  */
b35c50
--    abort ();
b35c50
--
b35c50
--  msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
b35c50
-+    msg = gettext ("unknown regexp error");
b35c50
-+  else
b35c50
-+    msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
b35c50
- 
b35c50
-   msg_size = strlen (msg) + 1; /* Includes the null.  */
b35c50
- 
b35c50
-@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa)
b35c50
- 	}
b35c50
- 	break;
b35c50
-       default:
b35c50
--	abort ();
b35c50
-+	break;
b35c50
-       }
b35c50
- 
b35c50
-   if (mb_chars || has_period)