From 37ff4d8a25b7be52d25cd44abe9fe87cbab44a42 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Sat, 20 Aug 2022 14:39:06 +0530 Subject: [PATCH] efivar: use git commit, drop patches --- extra/efivar/build | 10 - extra/efivar/checksums | 4 +- extra/efivar/patches/musl-compat.patch | 231 ----------------------- extra/efivar/patches/no-add-needed.patch | 30 --- extra/efivar/sources | 2 - extra/efivar/version | 2 +- 6 files changed, 2 insertions(+), 277 deletions(-) delete mode 100644 extra/efivar/patches/musl-compat.patch delete mode 100644 extra/efivar/patches/no-add-needed.patch diff --git a/extra/efivar/build b/extra/efivar/build index 3f63ff93..5f7dcd5e 100755 --- a/extra/efivar/build +++ b/extra/efivar/build @@ -1,15 +1,5 @@ #!/bin/sh -e -patch -p1 < musl-compat.patch -patch -p1 < no-add-needed.patch - -# Disable test program 'thread-test' as it causes build failures when using -# parallel make (due to missing dependency on libefivar.so). Other workarounds -# include patching the Makefile or forcing -j1 (what we used to do). -# See: https://github.com/rhboot/efivar/pull/169 -sed 's/thread-test//' src/Makefile > _ -mv -f _ src/Makefile - # Remove mandoc build dependency mv docs/efisecdb.1.mdoc docs/efisecdb.1 diff --git a/extra/efivar/checksums b/extra/efivar/checksums index cf1d1328..7342adee 100644 --- a/extra/efivar/checksums +++ b/extra/efivar/checksums @@ -1,3 +1 @@ -e3bbde37238bd47af1fcf270dc0ef1f4be030d86364c917b93669222ec52bbea -2e46e54310762fac2ce223329807af7b1109b0ccb7869eac9be9ea776ed7ef2d -bad5af225196cccad29f488015399830a44de71bf955c5b29b432b68fe96083a +bcb74d7fd3145a050f0a38f42fc8cbcf4e855c1d2ec5e6869aebe31f00a8fbfc diff --git a/extra/efivar/patches/musl-compat.patch b/extra/efivar/patches/musl-compat.patch deleted file mode 100644 index 00229be5..00000000 --- a/extra/efivar/patches/musl-compat.patch +++ /dev/null @@ -1,231 +0,0 @@ -From cece3ffd5be2f8641eb694513f2b73e5eb97ffd3 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 | 68 +++++++++++++++++++------------------------------- - 2 files changed, 26 insertions(+), 44 deletions(-) - -diff --git a/src/compiler.h b/src/compiler.h -index e2f18f0b..d95fb014 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 f8823737..6bd5ad90 100644 ---- a/src/efisecdb.c -+++ b/src/efisecdb.c -@@ -25,6 +25,10 @@ - extern char *optarg; - extern int optind, opterr, optopt; - -+static efi_secdb_t *secdb = NULL; -+static list_t infiles; -+static list_t actions; -+ - struct hash_param { - char *name; - efi_secdb_type_t algorithm; -@@ -187,12 +191,11 @@ add_action(list_t *list, action_type_t action_type, const efi_guid_t *owner, - } - - 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 +205,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 +218,12 @@ free_infiles(int status UNUSED, void *infilesp) - } - - static void --maybe_free_secdb(int status UNUSED, void *voidp) -+maybe_free_secdb(void) - { -- efi_secdb_t **secdbp = (efi_secdb_t **)voidp; -- -- if (secdbp == NULL || *secdbp == NULL) -+ if (secdb == NULL) - return; - -- efi_secdb_free(*secdbp); --} -- --static void --maybe_do_unlink(int status, void *filep) --{ -- char **file = (char **)filep; -- -- if (status == 0) -- return; -- if (file == NULL || *file == NULL) -- return; -- -- unlink(*file); -+ efi_secdb_free(secdb); - } - - static void -@@ -323,15 +310,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 +329,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 +355,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 +565,30 @@ main(int argc, char *argv[]) - 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); - -From df09b472419466987f2f30176dd00937e640aa9a 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 6bd5ad90..70fa1847 100644 ---- a/src/efisecdb.c -+++ b/src/efisecdb.c -@@ -255,8 +255,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; -@@ -297,8 +296,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, - if (!dump) - exit(1); - status = 1; -- xfree(*outfile); -- *outfile = NULL; - break; - } - } -@@ -528,7 +525,7 @@ main(int argc, char *argv[]) - 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); diff --git a/extra/efivar/patches/no-add-needed.patch b/extra/efivar/patches/no-add-needed.patch deleted file mode 100644 index bc5d205d..00000000 --- a/extra/efivar/patches/no-add-needed.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/src/include/defaults.mk b/src/include/defaults.mk -index 511f4da..3825ef0 100644 ---- a/src/include/defaults.mk -+++ b/src/include/defaults.mk -@@ -47,7 +47,6 @@ LDFLAGS ?= - override _CCLDFLAGS := $(CCLDFLAGS) - override _LDFLAGS := $(LDFLAGS) - override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \ -- -Wl,--add-needed \ - -Wl,--build-id \ - -Wl,--no-allow-shlib-undefined \ - -Wl,--no-undefined-version \ -@@ -89,7 +88,6 @@ override _HOST_LDFLAGS := $(HOST_LDFLAGS) - override _HOST_CCLDFLAGS := $(HOST_CCLDFLAGS) - override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \ - $(_HOST_LDFLAGS) $(_HOST_CCLDFLAGS) \ -- -Wl,--add-needed \ - -Wl,--build-id \ - -Wl,--no-allow-shlib-undefined \ - -Wl,-z,now \ -diff --git a/src/include/gcc.specs b/src/include/gcc.specs -index ef28e2b..d85e865 100644 ---- a/src/include/gcc.specs -+++ b/src/include/gcc.specs -@@ -5,4 +5,4 @@ - + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches - - *link: --+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%