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

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