Skip to contentSkip to conversation

Some fixes and cleanups

PATCH In review Daniel Kiper via Grub-devel 2 participants 9 messages Oct 24, 2025 – Oct 25, 2025

lore
Share & tools
lore
#0 lore raw

cover Some fixes and cleanups

Hey,

As in subject...

Daniel

Daniel Kiper (3):
bootstrap: Fix patching warnings lib/xzembed/xz_dec_stream: Replace grub_memcpy() call with memcpy()
build: Add appended signatures header file to EXTRA_DIST

 conf/Makefile.extra-dist                                     | 2 ++
 grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch | 4 ++--
 grub-core/lib/gnulib-patches/fix-unused-value.patch          | 2 +-
 grub-core/lib/xzembed/xz_dec_stream.c                        | 3 +--
 4 files changed, 6 insertions(+), 5 deletions(-)

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#1 lore raw

PATCH 1/3 bootstrap: Fix patching warnings

Currently bootstrap complains in the following way when patching gnulib files:

patching file regcomp.c
Hunk #2 succeeded at 1029 with fuzz 2.
Hunk #5 succeeded at 1716 with fuzz 2.
patching file regexec.c
patching file base64.c
patching file regexec.c
Hunk #1 succeeded at 807 (offset -21 lines).

Let's fix it by adding missing "\f" and amending line numbers in the patches.

---
 grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch | 4 ++--
 grub-core/lib/gnulib-patches/fix-unused-value.patch          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch +2 -2
index b2e900023..62e7623a6 100644
@@ -50,7 +50,7 @@
 -  return REG_NOERROR;
 +  return err;
  }
- 
+ 
  /* If it is possible to do searching in single byte encoding instead of UTF-8
 @@ -1677,12 +1677,11 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
      {
@@ -106,5 +106,5 @@
 +
 +  return err;
  }
- 
+ 
  /* Functions for token which are used in the parser.  */
grub-core/lib/gnulib-patches/fix-unused-value.patch +1 -1
index ba51f1bf2..b56ab4bb4 100644
@@ -1,6 +1,6 @@
 --- a/lib/regexec.c	2020-10-21 14:25:35.310195912 +0000
 +++ b/lib/regexec.c	2020-10-21 14:32:07.961765604 +0000
-@@ -828,7 +828,11 @@
+@@ -807,7 +807,11 @@
  		    break;
  		  if (__glibc_unlikely (err != REG_NOMATCH))
  		    goto free_return;
Signature · 7 lines
2.11.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] bootstrap: Fix patching warnings

Looks good to me, thank you.

Quoted 57 lines · Daniel Kiper via Grub-devel

Currently bootstrap complains in the following way when patching gnulib files:

patching file regcomp.c
Hunk #2 succeeded at 1029 with fuzz 2.
Hunk #5 succeeded at 1716 with fuzz 2.
patching file regexec.c
patching file base64.c
patching file regexec.c
Hunk #1 succeeded at 807 (offset -21 lines).

Let's fix it by adding missing "\f" and amending line numbers in the patches.

---
 grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch | 4 ++--
 grub-core/lib/gnulib-patches/fix-unused-value.patch          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch +2 -2
index b2e900023..62e7623a6 100644
@@ -50,7 +50,7 @@
 -  return REG_NOERROR;
 +  return err;
  }
-
+
  /* If it is possible to do searching in single byte encoding instead of UTF-8
 @@ -1677,12 +1677,11 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
      {
@@ -106,5 +106,5 @@
 +
 +  return err;
  }
-
+
  /* Functions for token which are used in the parser.  */
grub-core/lib/gnulib-patches/fix-unused-value.patch +1 -2
index ba51f1bf2..b56ab4bb4 100644
@@ -1,6 +1,6 @@
 --- a/lib/regexec.c    2020-10-21 14:25:35.310195912 +0000
 +++ b/lib/regexec.c    2020-10-21 14:32:07.961765604 +0000
-@@ -828,7 +828,11 @@
+@@ -807,7 +807,11 @@
                    break;
                  if (__glibc_unlikely (err != REG_NOMATCH))
                    goto free_return;
--

2.11.0

Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#3 lore raw

PATCH 2/3 lib/xzembed/xz_dec_stream: Replace grub_memcpy() call with memcpy()

In reply to Daniel Kiper via Grub-devel

Make the code consistent.

---
 grub-core/lib/xzembed/xz_dec_stream.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
grub-core/lib/xzembed/xz_dec_stream.c +1 -2
index f2dd42dc2..13658d448 100644
@@ -387,8 +387,7 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
 		&& sizeof (s->hash_value) >= hash->mdlen)
 	{
 		hash->final(hash_context);
-		grub_memcpy (s->hash_value, hash->read(hash_context),
-			     hash->mdlen);
+		memcpy (s->hash_value, hash->read (hash_context), hash->mdlen);
 		s->have_hash_value = 1;
 		if (s->hash_id == 1 || crc32)
 		{
Signature · 7 lines
2.11.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] lib/xzembed/xz_dec_stream: Replace grub_memcpy() call with memcpy()

Looks good to me, thank you.

Quoted 26 lines · Daniel Kiper via Grub-devel

Make the code consistent.

---
 grub-core/lib/xzembed/xz_dec_stream.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
grub-core/lib/xzembed/xz_dec_stream.c +1 -3
index f2dd42dc2..13658d448 100644
@@ -387,8 +387,7 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
                && sizeof (s->hash_value) >= hash->mdlen)
        {
                hash->final(hash_context);
-               grub_memcpy (s->hash_value, hash->read(hash_context),
-                            hash->mdlen);
+               memcpy (s->hash_value, hash->read (hash_context), hash->mdlen);
                s->have_hash_value = 1;
                if (s->hash_id == 1 || crc32)
                {
--

2.11.0

Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw

PATCH 3/3 build: Add appended signatures header file to EXTRA_DIST

In reply to Daniel Kiper via Grub-devel

This file was not added to EXTRA_DIST during the appended signatures merge.

Fixes 3e4ff6ffb (appended signatures: Parse ASN1 node)
---
 conf/Makefile.extra-dist | 2 ++
 1 file changed, 2 insertions(+)
conf/Makefile.extra-dist +2 -0
index 846d45341..dcb0bed07 100644
@@ -76,6 +76,8 @@ EXTRA_DIST += grub-core/tests/asn1/asn1_test.h
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/tests/asn1/tests -name '*.h')
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/commands/tpm2_key_protector -name '*.h')
 
+EXTRA_DIST += grub-core/commands/appendedsig/appendedsig.h
+
 EXTRA_DIST += grub-core/lib/LzmaDec.c
 
 EXTRA_DIST += grub-core/fs/cpio_common.c
Signature · 7 lines
2.11.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#6 lore raw

Re: [PATCH 3/3] build: Add appended signatures header file to EXTRA_DIST

Hello,

I notice that these files aren't in the dist archive currently, should they be added too?

grub-core/commands/tpm2_key_protector/tpm2key.asn grub-core/lib/libgcrypt-grub/mpi: ec.c grub-core/lib/libgcrypt-grub/mpi: ec-ed25519.c grub-core/lib/libgcrypt-grub/mpi: ec-hw-s390x.c grub-core/lib/libgcrypt-grub/mpi: ec-nist.c grub-core/lib/libgcrypt-grub/src: context.c grub-core/lib/libgcrypt-grub/src: gen-note-integrity.sh grub-core/lib/libgcrypt-grub/src: hwf-arm.c grub-core/lib/libgcrypt-grub/src: hwf-ppc.c grub-core/lib/libgcrypt-grub/src: hwf-s390x.c grub-core/lib/libgcrypt-grub/src: hwf-x86.c grub-core/lib/libgcrypt-grub/src: mpicalc.c grub-core/tests: cmdline_cat_test.c grub-core/tests: gfxterm_menu.c

These I wasn't sure if it was intentional to leave them out? MAINTAINERS
SECURITY
.travis.yml

Thanks,
Andrew

Quoted 27 lines · Daniel Kiper via Grub-devel

This file was not added to EXTRA_DIST during the appended signatures merge.

Fixes 3e4ff6ffb (appended signatures: Parse ASN1 node)
---
 conf/Makefile.extra-dist | 2 ++
 1 file changed, 2 insertions(+)
conf/Makefile.extra-dist +2 -1
index 846d45341..dcb0bed07 100644
@@ -76,6 +76,8 @@ EXTRA_DIST += grub-core/tests/asn1/asn1_test.h
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/tests/asn1/tests -name '*.h')
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/commands/tpm2_key_protector -name '*.h')
 
+EXTRA_DIST += grub-core/commands/appendedsig/appendedsig.h
+
 EXTRA_DIST += grub-core/lib/LzmaDec.c
 
 EXTRA_DIST += grub-core/fs/cpio_common.c
--

2.11.0

Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reviewed-by
#7 lore raw

Re: [PATCH 3/3] build: Add appended signatures header file to EXTRA_DIST

I did some more investigation on these and found the following:

grub-core/commands/tpm2_key_protector/tpm2key.asn
- Seems only required if manually regenerating file
grub-core/commands/tpm2_key_protector/tpm2key_asn1_tab.c but may be helpful to include for reference or if someone wants to change it for some reason. I will send a patch to include it.

grub-core/lib/libgcrypt-grub/mpi: ec.c grub-core/lib/libgcrypt-grub/mpi: ec-ed25519.c grub-core/lib/libgcrypt-grub/mpi: ec-hw-s390x.c grub-core/lib/libgcrypt-grub/mpi: ec-nist.c grub-core/lib/libgcrypt-grub/src: context.c grub-core/lib/libgcrypt-grub/src: gen-note-integrity.sh grub-core/lib/libgcrypt-grub/src: hwf-arm.c grub-core/lib/libgcrypt-grub/src: hwf-ppc.c grub-core/lib/libgcrypt-grub/src: hwf-s390x.c grub-core/lib/libgcrypt-grub/src: hwf-x86.c grub-core/lib/libgcrypt-grub/src: mpicalc.c
- These don't seem to be needed in the dist archive, building from
git source and dist results in the same output either way. grub-core/tests: cmdline_cat_test.c
grub-core/tests: gfxterm_menu.c
- These tests are disabled so make sense they aren't included.

MAINTAINERS
SECURITY
- These may be worth including, I'll submit a patch that adds them
for consideration.
.travis.yml
- I guess this was intended for a CI process but may not be actually
used anywhere currently.

I also found the new zstd test files need to be added so will send a patch for those too.

In summary, this looks good to me, I'll send a patch for other possible updates.

Thanks,
Andrew

Quoted 58 lines · Andrew Hamilton

Hello,

I notice that these files aren't in the dist archive currently, should they be added too?

grub-core/commands/tpm2_key_protector/tpm2key.asn grub-core/lib/libgcrypt-grub/mpi: ec.c grub-core/lib/libgcrypt-grub/mpi: ec-ed25519.c grub-core/lib/libgcrypt-grub/mpi: ec-hw-s390x.c grub-core/lib/libgcrypt-grub/mpi: ec-nist.c grub-core/lib/libgcrypt-grub/src: context.c grub-core/lib/libgcrypt-grub/src: gen-note-integrity.sh grub-core/lib/libgcrypt-grub/src: hwf-arm.c grub-core/lib/libgcrypt-grub/src: hwf-ppc.c grub-core/lib/libgcrypt-grub/src: hwf-s390x.c grub-core/lib/libgcrypt-grub/src: hwf-x86.c grub-core/lib/libgcrypt-grub/src: mpicalc.c grub-core/tests: cmdline_cat_test.c grub-core/tests: gfxterm_menu.c

These I wasn't sure if it was intentional to leave them out? MAINTAINERS
SECURITY
.travis.yml

Thanks,
Andrew

Quoted 27 lines · Daniel Kiper via Grub-devel

This file was not added to EXTRA_DIST during the appended signatures merge.

Fixes 3e4ff6ffb (appended signatures: Parse ASN1 node)
---
 conf/Makefile.extra-dist | 2 ++
 1 file changed, 2 insertions(+)
conf/Makefile.extra-dist +2 -1
index 846d45341..dcb0bed07 100644
@@ -76,6 +76,8 @@ EXTRA_DIST += grub-core/tests/asn1/asn1_test.h
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/tests/asn1/tests -name '*.h')
 EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/commands/tpm2_key_protector -name '*.h')
 
+EXTRA_DIST += grub-core/commands/appendedsig/appendedsig.h
+
 EXTRA_DIST += grub-core/lib/LzmaDec.c
 
 EXTRA_DIST += grub-core/fs/cpio_common.c
--

2.11.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

author Reviewed-by Alec Brown on the v1 series
#8 lore raw
In reply to Daniel Kiper via Grub-devel

Confidential – Oracle Internal

Quoted 12 lines · Daniel Kiper

Hey,

As in subject...

Daniel

Daniel Kiper (3):
bootstrap: Fix patching warnings lib/xzembed/xz_dec_stream: Replace grub_memcpy() call with memcpy()
build: Add appended signatures header file to EXTRA_DIST

Quoted 5 lines
 conf/Makefile.extra-dist                                     | 2 ++
 grub-core/lib/gnulib-patches/fix-regcomp-resource-leak.patch | 4 ++--
 grub-core/lib/gnulib-patches/fix-unused-value.patch          | 2 +-
 grub-core/lib/xzembed/xz_dec_stream.c                        | 3 +--
 4 files changed, 6 insertions(+), 5 deletions(-)

All these patches LGTM.

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel