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