gnu: efivar: Fix build on other architectures.

* gnu/packages/linux.scm (efivar)[source]: Add patch.
* gnu/packages/patches/efivar-fix-fprint-format.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I6b80ef642e953bbf68b9dd972a176a2bb155104f
This commit is contained in:
Efraim Flashner 2025-06-16 11:45:54 +03:00
parent 379aee7b4f
commit a8287d8bc4
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351
3 changed files with 49 additions and 1 deletions

View file

@ -1214,6 +1214,7 @@ dist_patch_DATA = \
%D%/packages/patches/dwarves-threading-reproducibility.patch \
%D%/packages/patches/dynaconf-unvendor-deps.patch \
%D%/packages/patches/efivar-211.patch \
%D%/packages/patches/efivar-fix-fprint-format.patch \
%D%/packages/patches/eigen-fix-strict-aliasing-bug.patch \
%D%/packages/patches/einstein-build.patch \
%D%/packages/patches/elfutils-tests-ptrace.patch \

View file

@ -8274,7 +8274,8 @@ under OpenGL graphics workloads.")
(file-name (git-file-name name version))
(sha256
(base32
"1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))))
"1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))
(patches (search-patches "efivar-fix-fprint-format.patch"))))
(build-system gnu-build-system)
(arguments
(list

View file

@ -0,0 +1,46 @@
iter->offset is type off_t, so signed int, and is always safe to cast to unsigned long.
This fixes builds on i686 and armhf, and cross-compiling from x86_64 to riscv64.
The issue can be traced at https://github.com/rhboot/efivar/issues/270
And this commit is at https://github.com/rhboot/efivar/pull/281
diff --git a/src/esl-iter.c b/src/esl-iter.c
index 4a1938a..e4c8fb8 100644
--- a/src/esl-iter.c
+++ b/src/esl-iter.c
@@ -337,7 +337,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at %lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at %lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);
@@ -362,7 +362,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at 0x%lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at 0x%lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);
@@ -394,7 +394,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if ((uint32_t)iter->offset >= iter->len)
return 0;
iter->esl = (efi_signature_list_t *)((intptr_t)iter->buf
- + iter->offset);
+ + (unsigned long)iter->offset);
}
efi_signature_list_t esl;
@@ -413,7 +413,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at 0x%lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at 0x%lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);