From 05b34c50c4845808892997365fe2f25c155ed4a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Fonzo?= Date: Mon, 16 May 2022 21:51:42 -0300 Subject: [PATCH] recipes: boot/efivar: Refresh software taken changes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Matías Fonzo --- patches/efivar/efivar-efisecdb-atexit.patch | 235 -------------------------- recipes/boot/efivar/recipe | 18 +- sources/SOURCELIST.txt | 2 +- sources/efivar-20220418_6be2cb1.tar.lz.sha256 | 1 + sources/efivar-38.tar.bz2.sha256 | 1 - 5 files changed, 13 insertions(+), 244 deletions(-) delete mode 100644 patches/efivar/efivar-efisecdb-atexit.patch create mode 100644 sources/efivar-20220418_6be2cb1.tar.lz.sha256 delete mode 100644 sources/efivar-38.tar.bz2.sha256 diff --git a/patches/efivar/efivar-efisecdb-atexit.patch b/patches/efivar/efivar-efisecdb-atexit.patch deleted file mode 100644 index ab9ada28..00000000 --- a/patches/efivar/efivar-efisecdb-atexit.patch +++ /dev/null @@ -1,235 +0,0 @@ -From ea680a06ee8cbd9862f39839889d36e6fb5ff0ab Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 28 Jan 2022 12:13:30 +0100 -Subject: [PATCH 1/2] efisecdb: fix build with musl libc - -Refactor code to use POSIX atexit(3) instead of the GNU specific -on_exit(3). - -Resolves: #197 -Resolves: #202 -Signed-off-by: Natanael Copa ---- - src/compiler.h | 2 -- - src/efisecdb.c | 72 +++++++++++++++++++++----------------------------- - 2 files changed, 30 insertions(+), 44 deletions(-) - -diff --git a/src/compiler.h b/src/compiler.h -index e2f18f0..d95fb01 100644 ---- a/src/compiler.h -+++ b/src/compiler.h -@@ -7,8 +7,6 @@ - #ifndef COMPILER_H_ - #define COMPILER_H_ - --#include -- - /* GCC version checking borrowed from glibc. */ - #if defined(__GNUC__) && defined(__GNUC_MINOR__) - # define GNUC_PREREQ(maj,min) \ -diff --git a/src/efisecdb.c b/src/efisecdb.c -index f882373..15baa55 100644 ---- a/src/efisecdb.c -+++ b/src/efisecdb.c -@@ -186,13 +186,20 @@ add_action(list_t *list, action_type_t action_type, const efi_guid_t *owner, - list_add_tail(&action->list, list); - } - -+/* -+ * These need to be static globals so that they're reachable from atexit handler. -+ */ -+static efi_secdb_t *secdb = NULL; -+static list_t infiles; -+static list_t actions; -+ -+ - static void --free_actions(int status UNUSED, void *actionsp) -+free_actions(void) - { -- list_t *actions = (list_t *)actionsp; - list_t *pos, *tmp; - -- for_each_action_safe(pos, tmp, actions) { -+ for_each_action_safe(pos, tmp, &actions) { - action_t *action = list_entry(pos, action_t, list); - - list_del(&action->list); -@@ -202,12 +209,11 @@ free_actions(int status UNUSED, void *actionsp) - } - - static void --free_infiles(int status UNUSED, void *infilesp) -+free_infiles(void) - { -- list_t *infiles = (list_t *)infilesp; - list_t *pos, *tmp; - -- for_each_ptr_safe(pos, tmp, infiles) { -+ for_each_ptr_safe(pos, tmp, &infiles) { - ptrlist_t *entry = list_entry(pos, ptrlist_t, list); - - list_del(&entry->list); -@@ -216,27 +222,12 @@ free_infiles(int status UNUSED, void *infilesp) - } - - static void --maybe_free_secdb(int status UNUSED, void *voidp) --{ -- efi_secdb_t **secdbp = (efi_secdb_t **)voidp; -- -- if (secdbp == NULL || *secdbp == NULL) -- return; -- -- efi_secdb_free(*secdbp); --} -- --static void --maybe_do_unlink(int status, void *filep) -+maybe_free_secdb(void) - { -- char **file = (char **)filep; -- -- if (status == 0) -- return; -- if (file == NULL || *file == NULL) -+ if (secdb == NULL) - return; - -- unlink(*file); -+ efi_secdb_free(secdb); - } - - static void -@@ -323,15 +314,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, - return status; - } - --/* -- * These need to be static globals so that they're not on main's stack when -- * on_exit() fires. -- */ --static efi_secdb_t *secdb = NULL; --static list_t infiles; --static list_t actions; --static char *outfile = NULL; -- - int - main(int argc, char *argv[]) - { -@@ -351,6 +333,7 @@ main(int argc, char *argv[]) - bool do_sort_data = false; - bool sort_descending = false; - int status = 0; -+ char *outfile = NULL; - - const char sopts[] = ":aAc:dfg:h:i:Lo:rs:t:v?"; - const struct option lopts[] = { -@@ -376,10 +359,9 @@ main(int argc, char *argv[]) - INIT_LIST_HEAD(&infiles); - INIT_LIST_HEAD(&actions); - -- on_exit(free_actions, &actions); -- on_exit(free_infiles, &infiles); -- on_exit(maybe_free_secdb, &secdb); -- on_exit(maybe_do_unlink, &outfile); -+ atexit(free_actions); -+ atexit(free_infiles); -+ atexit(maybe_free_secdb); - - /* - * parse the command line. -@@ -587,24 +569,30 @@ sort_err: - outfd = open(outfile, flags, 0600); - if (outfd < 0) { - char *tmpoutfile = outfile; -- if (errno == EEXIST) -- outfile = NULL; -+ if (errno != EEXIST) -+ unlink(outfile); - err(1, "could not open \"%s\"", tmpoutfile); - } - - rc = ftruncate(outfd, 0); -- if (rc < 0) -+ if (rc < 0) { -+ unlink(outfile); - err(1, "could not truncate output file \"%s\"", outfile); -+ } - - void *output; - size_t size = 0; - rc = efi_secdb_realize(secdb, &output, &size); -- if (rc < 0) -+ if (rc < 0) { -+ unlink(outfile); - secdb_err(1, "could not realize signature list"); -+ } - - rc = write(outfd, output, size); -- if (rc < 0) -+ if (rc < 0) { -+ unlink(outfile); - err(1, "could not write signature list"); -+ } - - close(outfd); - xfree(output); --- -2.20.1 - - -From 961f19b834c07f6839c78709be3ef4dd38ab7952 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 28 Jan 2022 12:29:00 +0100 -Subject: [PATCH 2/2] efisecdb: do not free optarg - -The *outfile passed to parse_input_files can only be either set to -optarg or be NULL. optarg should not be free'd and NULL does not need -to. - -Since we no longer use on_exit to unlink outfile we also don't need to -set *outfile to NULL. - -Fixes commit d91787035bc1 (efisecdb: add efisecdb) - -Signed-off-by: Natanael Copa ---- - src/efisecdb.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/src/efisecdb.c b/src/efisecdb.c -index 15baa55..de056d0 100644 ---- a/src/efisecdb.c -+++ b/src/efisecdb.c -@@ -259,8 +259,7 @@ list_guids(void) - * failure. - */ - static int --parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, -- bool dump) -+parse_input_files(list_t *infiles, efi_secdb_t **secdb, bool dump) - { - int status = 0; - list_t *pos, *tmp; -@@ -301,8 +300,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, - if (!dump) - exit(1); - status = 1; -- xfree(*outfile); -- *outfile = NULL; - break; - } - } -@@ -532,7 +529,7 @@ sort_err: - efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DATA, do_sort_data); - efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DESCENDING, sort_descending); - -- status = parse_input_files(&infiles, &outfile, &secdb, dump); -+ status = parse_input_files(&infiles, &secdb, dump); - if (status == 0) { - for_each_action_safe(pos, tmp, &actions) { - action_t *action = list_entry(pos, action_t, list); --- -2.20.1 - diff --git a/recipes/boot/efivar/recipe b/recipes/boot/efivar/recipe index 8b732d69..9f07f6da 100644 --- a/recipes/boot/efivar/recipe +++ b/recipes/boot/efivar/recipe @@ -19,8 +19,8 @@ set -e program=efivar -version=38 -release=3 +version=20220418_6be2cb1 +release=4 # Define a category for the output of the package name pkgcategory=boot @@ -28,17 +28,21 @@ pkgcategory=boot description=" Tools and libraries to work with EFI variables. -The efivar package provides a simple command-line interface -to the UEFI variable facility. +The efivar package provides a simple command-line interface to +the UEFI variable facility. " homepage=https://github.com/rhboot/efivar/ license=LGPLv2.1+ -tarname=${program}-${version}.tar.bz2 +tarname=${program}-${version}.tar.lz # Remote source(s) -fetch=https://github.com/rhboot/efivar/releases/download/${version}/$tarname +#fetch=https://github.com/rhboot/efivar/releases/download/${version}/$tarname +fetch=" + https://dragora.mirror.garr.it/current/sources/$tarname + rsync://rsync.dragora.org/current/sources/$tarname +" # Source documentation docs="COPYING TODO README.md" @@ -54,7 +58,7 @@ build() { # Apply patches - patch -Np1 -i "${worktree}/patches/efivar/efivar-efisecdb-atexit.patch" +# patch -Np1 -i "${worktree}/patches/efivar/efivar-efisecdb-atexit.patch" patch -Np1 -i "${worktree}/patches/efivar/efivar-mandoc-groff.patch" make -j${jobs} V=1 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LIBDIR="/usr/lib${libSuffix}" MANDIR="$mandir" diff --git a/sources/SOURCELIST.txt b/sources/SOURCELIST.txt index 45901ff2..7dafff34 100644 --- a/sources/SOURCELIST.txt +++ b/sources/SOURCELIST.txt @@ -122,6 +122,7 @@ https://dragora.mirror.garr.it/current/sources/db-6.2.38.tar.gz https://dragora.mirror.garr.it/current/sources/dbus-1-tqt-20220503_face487.tar.lz https://dragora.mirror.garr.it/current/sources/dbus-tqt-20220503_c2e0347.tar.lz https://dragora.mirror.garr.it/current/sources/dragora-ice-20190920.tar.lz +https://dragora.mirror.garr.it/current/sources/efivar-20220418_6be2cb1.tar.lz https://dragora.mirror.garr.it/current/sources/gpm-20200617_e82d1a6.tar.lz https://dragora.mirror.garr.it/current/sources/graft-2.16.tar.gz https://dragora.mirror.garr.it/current/sources/hldig-20210616_9427c9cd.tar.lz @@ -247,7 +248,6 @@ https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/nghttp2-1.46.0.tar. https://github.com/ninja-build/ninja/archive/v1.10.2/ninja-1.10.2.tar.gz https://github.com/p11-glue/p11-kit/releases/download/0.24.1/p11-kit-0.24.1.tar.xz https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.bz2 -https://github.com/rhboot/efivar/releases/download/38/efivar-38.tar.bz2 https://github.com/rockdaboot/libpsl/releases/download/0.21.1/libpsl-0.21.1.tar.lz https://github.com/shadow-maint/shadow/releases/download/v4.11.1/shadow-4.11.1.tar.gz https://github.com/skvadrik/re2c/releases/download/2.2/re2c-2.2.tar.lz diff --git a/sources/efivar-20220418_6be2cb1.tar.lz.sha256 b/sources/efivar-20220418_6be2cb1.tar.lz.sha256 new file mode 100644 index 00000000..6664b4fb --- /dev/null +++ b/sources/efivar-20220418_6be2cb1.tar.lz.sha256 @@ -0,0 +1 @@ +dc88ba1d4b1d9525049b3ffa1307c999dd37611ccd743a7fd026eca8d3d2d9e3 efivar-20220418_6be2cb1.tar.lz diff --git a/sources/efivar-38.tar.bz2.sha256 b/sources/efivar-38.tar.bz2.sha256 deleted file mode 100644 index 5724c657..00000000 --- a/sources/efivar-38.tar.bz2.sha256 +++ /dev/null @@ -1 +0,0 @@ -f018ed6e49c5f1c16d336d9fd7687ce87023276591921db1e49a314ad6515349 efivar-38.tar.bz2 -- 2.11.4.GIT