Blame SOURCES/0200-Drop-gnulib-fix-base64.patch.patch

b35c50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b35c50
From: Robbie Harwood <rharwood@redhat.com>
b35c50
Date: Thu, 28 Oct 2021 15:07:50 -0400
b35c50
Subject: [PATCH] Drop gnulib fix-base64.patch
b35c50
b35c50
Originally added in 9fbdec2f6b4fa8b549daa4d49134d1fe89d95ef9 and
b35c50
subsequently modified in 552c9fd08122a3036c724ce96dfe68aa2f75705f,
b35c50
fix-base64.patch handled two problems we have using gnulib, which are
b35c50
exerciesd by the base64 module but not directly caused by it.
b35c50
b35c50
First, grub2 defines its own bool type, while gnulib expects the
b35c50
equivalent of stdbool.h to be present.  Rather than patching gnulib,
b35c50
instead use gnulib's stdbool module to provide a bool type if needed.
b35c50
(Suggested by Simon Josefsson.)
b35c50
b35c50
Second, our config.h doesn't always inherit config-util.h, which is
b35c50
where gnulib-related options like _GL_ATTRIBUTE_CONST end up.
b35c50
fix-base64.h worked around this by defining the attribute away, but this
b35c50
workaround is better placed in config.h itself, not a gnulib patch.
b35c50
b35c50
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
b35c50
(cherry picked from commit 54fd1c3301dd15f6b6212c12887265e8a6cbc076)
b35c50
---
b35c50
 grub-core/lib/posix_wrap/sys/types.h          |  7 +++----
b35c50
 grub-core/lib/xzembed/xz.h                    |  5 +----
b35c50
 bootstrap.conf                                |  3 ++-
b35c50
 conf/Makefile.extra-dist                      |  1 -
b35c50
 config.h.in                                   |  4 ++++
b35c50
 grub-core/lib/gnulib-patches/fix-base64.patch | 21 ---------------------
b35c50
 6 files changed, 10 insertions(+), 31 deletions(-)
b35c50
 delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
b35c50
b35c50
diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h
b35c50
index f63412c8da..2f3e865495 100644
b35c50
--- a/grub-core/lib/posix_wrap/sys/types.h
b35c50
+++ b/grub-core/lib/posix_wrap/sys/types.h
b35c50
@@ -23,11 +23,10 @@
b35c50
 
b35c50
 #include <stddef.h>
b35c50
 
b35c50
+/* Provided by gnulib if not present. */
b35c50
+#include <stdbool.h>
b35c50
+
b35c50
 typedef grub_ssize_t ssize_t;
b35c50
-#ifndef GRUB_POSIX_BOOL_DEFINED
b35c50
-typedef enum { false = 0, true = 1 } bool;
b35c50
-#define GRUB_POSIX_BOOL_DEFINED 1
b35c50
-#endif
b35c50
 
b35c50
 typedef grub_uint8_t uint8_t;
b35c50
 typedef grub_uint16_t uint16_t;
b35c50
diff --git a/grub-core/lib/xzembed/xz.h b/grub-core/lib/xzembed/xz.h
b35c50
index f7b32d8003..d1417039aa 100644
b35c50
--- a/grub-core/lib/xzembed/xz.h
b35c50
+++ b/grub-core/lib/xzembed/xz.h
b35c50
@@ -29,10 +29,7 @@
b35c50
 #include <unistd.h>
b35c50
 #include <string.h>
b35c50
 #include <grub/misc.h>
b35c50
-
b35c50
-#ifndef GRUB_POSIX_BOOL_DEFINED
b35c50
-typedef enum { false = 0, true = 1 } bool;
b35c50
-#endif
b35c50
+#include <stdbool.h>
b35c50
 
b35c50
 /**
b35c50
  * enum xz_ret - Return codes
b35c50
diff --git a/bootstrap.conf b/bootstrap.conf
b35c50
index 52d4af44be..645e3a459c 100644
b35c50
--- a/bootstrap.conf
b35c50
+++ b/bootstrap.conf
b35c50
@@ -35,6 +35,7 @@ gnulib_modules="
b35c50
   realloc-gnu
b35c50
   regex
b35c50
   save-cwd
b35c50
+  stdbool
b35c50
 "
b35c50
 
b35c50
 gnulib_tool_option_extras="\
b35c50
@@ -79,7 +80,7 @@ cp -a INSTALL INSTALL.grub
b35c50
 
b35c50
 bootstrap_post_import_hook () {
b35c50
   set -e
b35c50
-  for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
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
     patch -d grub-core/lib/gnulib -p2 \
b35c50
       < "grub-core/lib/gnulib-patches/$patchname.patch"
b35c50
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
b35c50
index ad235de7fc..f4791dc6ca 100644
b35c50
--- a/conf/Makefile.extra-dist
b35c50
+++ b/conf/Makefile.extra-dist
b35c50
@@ -31,7 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh
b35c50
 EXTRA_DIST += grub-core/genemuinit.sh
b35c50
 EXTRA_DIST += grub-core/genemuinitheader.sh
b35c50
 
b35c50
-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
b35c50
 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
b35c50
diff --git a/config.h.in b/config.h.in
b35c50
index f2ed0066ec..9c7b4afaaa 100644
b35c50
--- a/config.h.in
b35c50
+++ b/config.h.in
b35c50
@@ -66,4 +66,8 @@
b35c50
 
b35c50
 #  define _GNU_SOURCE 1
b35c50
 
b35c50
+#  ifndef _GL_INLINE_HEADER_BEGIN
b35c50
+#    define _GL_ATTRIBUTE_CONST __attribute__ ((const))
b35c50
+#  endif /* !_GL_INLINE_HEADER_BEGIN */
b35c50
+
b35c50
 #endif
b35c50
diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch
b35c50
deleted file mode 100644
b35c50
index 985db12797..0000000000
b35c50
--- a/grub-core/lib/gnulib-patches/fix-base64.patch
b35c50
+++ /dev/null
b35c50
@@ -1,21 +0,0 @@
b35c50
-diff --git a/lib/base64.h b/lib/base64.h
b35c50
-index 9cd0183b8..185a2afa1 100644
b35c50
---- a/lib/base64.h
b35c50
-+++ b/lib/base64.h
b35c50
-@@ -21,8 +21,14 @@
b35c50
- /* Get size_t. */
b35c50
- # include <stddef.h>
b35c50
- 
b35c50
--/* Get bool. */
b35c50
--# include <stdbool.h>
b35c50
-+#ifndef GRUB_POSIX_BOOL_DEFINED
b35c50
-+typedef enum { false = 0, true = 1 } bool;
b35c50
-+#define GRUB_POSIX_BOOL_DEFINED 1
b35c50
-+#endif
b35c50
-+
b35c50
-+#ifndef _GL_ATTRIBUTE_CONST
b35c50
-+# define _GL_ATTRIBUTE_CONST /* empty */
b35c50
-+#endif
b35c50
- 
b35c50
- # ifdef __cplusplus
b35c50
- extern "C" {