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

141 lines
4.7 KiB
Diff
Raw Normal View History

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