All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Robbie Harwood <rharwood@redhat.com>
Subject: Re: [PATCH] Drop gnulib fix-base64.patch
Date: Sun, 14 Nov 2021 10:36:16 +0100	[thread overview]
Message-ID: <YZDYkErmtP4dJuu7@ncase> (raw)
In-Reply-To: <20211028192227.351582-1-rharwood@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4597 bytes --]

On Thu, Oct 28, 2021 at 03:22:27PM -0400, Robbie Harwood wrote:
> 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>

I agree this looks a lot cleaner than patching in support for booleans.
Thanks for the patch!

Reviewed-by: Patrick Steinhardt <ps@pks.im>

Patrick

> ---
>  bootstrap.conf                                |  3 ++-
>  config.h.in                                   |  3 +++
>  grub-core/lib/gnulib-patches/fix-base64.patch | 21 -------------------
>  grub-core/lib/posix_wrap/sys/types.h          |  7 +++----
>  grub-core/lib/xzembed/xz.h                    |  5 +----
>  5 files changed, 9 insertions(+), 30 deletions(-)
>  delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
> 
> diff --git a/bootstrap.conf b/bootstrap.conf
> index 0dd893c5c..21a8cf15d 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -35,6 +35,7 @@ gnulib_modules="
>    realloc-gnu
>    regex
>    save-cwd
> +  stdbool
>  "
>  
>  gnulib_tool_option_extras="\
> @@ -80,7 +81,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/config.h.in b/config.h.in
> index 9e8f9911b..2b65c86c4 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -64,4 +64,7 @@
>  
>  #define _GNU_SOURCE 1
>  
> +/* For gnulib's base64 code. */
> +#define _GL_ATTRIBUTE_CONST /* empty */
> +
>  #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 985db1279..000000000
> --- 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" {
> diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h
> index 854eb0122..eeda543c4 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 f7b32d800..d1417039a 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
> -- 
> 2.33.0
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-11-14  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 19:22 [PATCH] Drop gnulib fix-base64.patch Robbie Harwood
2021-11-03 11:59 ` Darren Kenny
2021-11-14  9:36 ` Patrick Steinhardt [this message]
2021-11-23 15:33 ` Daniel Axtens
2021-11-23 16:08   ` Robbie Harwood
2021-11-23 17:20     ` Daniel Kiper
2021-11-24 14:36       ` Robbie Harwood
2021-11-25 17:09         ` Daniel Kiper
2021-11-29 23:21           ` Robbie Harwood
2021-11-30 16:33             ` Daniel Kiper
2021-12-07 20:34               ` Robbie Harwood
2021-12-09 14:46                 ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZDYkErmtP4dJuu7@ncase \
    --to=ps@pks.im \
    --cc=grub-devel@gnu.org \
    --cc=rharwood@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.