Subject: bug#54795: closed (Re: bug#54795: [PATCH] gnu: efivar: Fix build errors on i686-linux.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 09 Apr 2022 22:04:02 +0000

Your bug report

#54795: [PATCH] gnu: efivar: Fix build errors on i686-linux.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
54795: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54795
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#54795: [PATCH] gnu: efivar: Fix build errors on i686-linux.
From: Ludovic Courtès <[email-masked]>
To: itd <[email-masked]>
Cc: [email-masked]
Date: Sun, 10 Apr 2022 00:03:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

itd <[email-masked]> skribis:

>>>From a6a2c3b3eddbf4ff47e39cfe8265346265d22b00 Mon Sep 17 00:00:00 2001
>
> * gnu/packages/patches/efivar-211.patch: New patch.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/linux.scm (efivar)[source]<origin>: Use it.

I added the URL of the upstream pull request at the top of the patch and
committed it.

Thanks!

Ludo’.

Subject: [PATCH] gnu: efivar: Fix build errors on i686-linux.
From: itd <[email-masked]>
To: [email-masked]
Date: Fri, 08 Apr 2022 18:49:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

>From a6a2c3b3eddbf4ff47e39cfe8265346265d22b00 Mon Sep 17 00:00:00 2001

* gnu/packages/patches/efivar-211.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/linux.scm (efivar)[source]<origin>: Use it.
---
Hi,

currently, efivar on i686-linux does not build [0] due to format errors
[1].  To my knowledge, the merged fix [2] is not part of a release yet.
But, it [2] fixes the efivar build for me.  Please consider applying it.
Thanks!

[0]: https://ci.guix.gnu.org/build/495200/details
[1]: https://github.com/rhboot/efivar/issues/209
[2]: https://github.com/rhboot/efivar/pull/211

Regards
itd

 gnu/local.mk                          |  1 +
 gnu/packages/linux.scm                |  5 +-
 gnu/packages/patches/efivar-211.patch | 84 +++++++++++++++++++++++++++
 3 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/efivar-211.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a44815bdbb..9cccc7e03a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1018,6 +1018,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch	\
   %D%/packages/patches/ecl-16-libffi.patch			\
   %D%/packages/patches/efibootmgr-remove-extra-decl.patch	\
+  %D%/packages/patches/efivar-211.patch			\
   %D%/packages/patches/eigen-remove-openmp-error-counting.patch	\
   %D%/packages/patches/eigen-stabilise-sparseqr-test.patch	\
   %D%/packages/patches/einstein-build.patch			\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index e49bbfbe9c..9e64bb207c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -6776,7 +6776,10 @@ (define-public efivar
                                   "-" version ".tar.bz2"))
               (sha256
                (base32
-                "0jaka7b4lccswjqiv4liclkj6w78gildg7vd6dnw3wf595pfs67h"))))
+                "0jaka7b4lccswjqiv4liclkj6w78gildg7vd6dnw3wf595pfs67h"))
+              (patches
+               (search-patches "efivar-211.patch"))))
+
     (build-system gnu-build-system)
     (arguments
      (list
diff --git a/gnu/packages/patches/efivar-211.patch b/gnu/packages/patches/efivar-211.patch
new file mode 100644
index 0000000000..3df66d3f5c
--- /dev/null
+++ b/gnu/packages/patches/efivar-211.patch
@@ -0,0 +1,84 @@
+From 15622b7e5761f3dde3f0e42081380b2b41639a48 Mon Sep 17 00:00:00 2001
+From: itd0 <[email-masked]>
+Date: Mon, 4 Apr 2022 19:59:58 +0200
+Subject: [PATCH] Avoid format error on i686
+
+On i686 definition of off_t and ssize_t differ.  Update format length
+modifiers as needed to avoid format errors with GCC.
+
+Signed-off-by: itd0 <[email-masked]>
+---
+ src/esl-iter.c   | 18 +++++++++---------
+ src/secdb-dump.c |  2 +-
+ 2 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/src/esl-iter.c b/src/esl-iter.c
+index 26b5cb5e..4a1938ad 100644
+--- a/src/esl-iter.c
++++ b/src/esl-iter.c
+@@ -308,13 +308,13 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ 		return -1;
+ 	}
+ 	if (iter->offset < 0) {
+-		efi_error("iter->offset (%zd) < 0", iter->offset);
++		efi_error("iter->offset (%jd) < 0", (intmax_t)iter->offset);
+ 		errno = EINVAL;
+ 		return -1;
+ 	}
+ 	if ((uint32_t)iter->offset >= iter->len) {
+-		efi_error("iter->offset (%zd) >= iter->len (%zd)",
+-			  iter->offset, iter->len);
++		efi_error("iter->offset (%jd) >= iter->len (%zd)",
++			  (intmax_t)iter->offset, iter->len);
+ 		errno = EINVAL;
+ 		return -1;
+ 	}
+@@ -335,9 +335,9 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ 			      iter->len - iter->offset, iter->len - iter->offset,
+ 			      iter->esl->signature_list_size, iter->esl->signature_list_size);
+ 			if (correct_size && (iter->len - iter->offset) > 0) {
+-				warnx("correcting ESL size from %d to %zd at %lx",
++				warnx("correcting ESL size from %d to %jd at %lx",
+ 				      iter->esl->signature_list_size,
+-				      iter->len - iter->offset, iter->offset);
++				      (intmax_t)(iter->len - iter->offset), iter->offset);
+ 				debug("correcting ESL size from %d to %zd at %lx",
+ 				      iter->esl->signature_list_size,
+ 				      iter->len - iter->offset, iter->offset);
+@@ -360,9 +360,9 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ 		if (iter->len - iter->offset < iter->esl->signature_list_size) {
+ 			debug("EFI_SIGNATURE_LIST is malformed");
+ 			if (correct_size && (iter->len - iter->offset) > 0) {
+-				warnx("correcting ESL size from %d to %zd at 0x%lx",
++				warnx("correcting ESL size from %d to %jd at 0x%lx",
+ 				      iter->esl->signature_list_size,
+-				      iter->len - iter->offset, iter->offset);
++				      (intmax_t)(iter->len - iter->offset), iter->offset);
+ 				debug("correcting ESL size from %d to %zd at 0x%lx",
+ 				      iter->esl->signature_list_size,
+ 				      iter->len - iter->offset, iter->offset);
+@@ -411,9 +411,9 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ 	if (iter->esl->signature_list_size > iter->len - iter->offset) {
+ 		debug("EFI_SIGNATURE_LIST is malformed");
+ 		if (correct_size && (iter->len - iter->offset) > 0) {
+-			warnx("correcting ESL size from %d to %zd at 0x%lx",
++			warnx("correcting ESL size from %d to %jd at 0x%lx",
+ 			      iter->esl->signature_list_size,
+-			      iter->len - iter->offset, iter->offset);
++			      (intmax_t)(iter->len - iter->offset), iter->offset);
+ 			debug("correcting ESL size from %d to %zd at 0x%lx",
+ 			      iter->esl->signature_list_size,
+ 			      iter->len - iter->offset, iter->offset);
+diff --git a/src/secdb-dump.c b/src/secdb-dump.c
+index 02fb915b..17f64411 100644
+--- a/src/secdb-dump.c
++++ b/src/secdb-dump.c
+@@ -248,7 +248,7 @@ secdb_dump(efi_secdb_t *secdb, bool annotations)
+ 		esln += 1;
+ 	}
+ 	secdb_dump_finish();
+-	printf("%08lx\n", offset);
++	printf("%08zx\n", offset);
+ 
+ 	fflush(stdout);
+ }
-- 
2.30.2