From: Eric Fahlgren Date: Fri, 6 Jun 2025 15:19:15 +0000 (-0700) Subject: apk-tools: update to git HEAD (2025-06-06) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f244ff22d904f9cd9ea733a3d0cd1bc3a834bb67;p=thirdparty%2Fopenwrt.git apk-tools: update to git HEAD (2025-06-06) 3efd75dc7e49 crypto: fix segfault when passing --hash 51306cf1424e test: export APK_CONFIG=/dev/null b91e9e17ceb6 build: mark scdoc dependency as native 123fa05b787a build: mark lua interpreter dependency as native 5fbb85426ea0 libfetch: fix fetch_err* for negative error codes 1458737d58c2 db, index: fix 'index' loading of old index cbd1e6b49add add: use solver error when arch is incompatible f66d84fcd42d doc: update apk-package(5) regarding arch validation f5df274d248c test: don't use temporary files for diffing output 42034f7961f0 apk: allow per-applet option to override group options b6ca99d44119 serializer: start_array(num=-1) indicates unknown amount 14881b9ffb2e query: a new api and applet to search and output information dd2255e10ee9 package: use apk_array_foreach ae17b61de83b info: use apk_array_foreach 6d4471f55ada solver: use apk_array_foreach 7951798121c1 db: use apk_array_foreach 5e3cac4ccb85 commit: use apk_array_foreach 86c725d97afd db: allocate protected paths with balloc 0fe23ce1a501 array: make apk_array_foreach* evaluate end only once a50f7ea2dd02 io_url_wget: correctly init wget_out on apk_io_url_init call 2cdfdd86e3d4 commit: Fix 'upgrade' typo on cache-pre-download 3fb50f645203 Add man page for protected_paths.d 652a1365aa30 fetch: account existing files to progress 0257acf6b120 doc: remove .d from apk-protected_paths(5) man page name aeb74de67818 db: include index file name for APK_REPOTYPE_NDX 6ec4fe6fa334 mkpkg: handle apk_blob_split failure c47b6e17fe6d extract: handle apk_blob_split failure b7c6b0b468d7 mkpkg: print error message when using forbidden fields b9483c46bdf9 fetch: fix APK_BLOB_STRLIT used with char argument d495be9e9f25 adbsign: fix recompressing when alg is NONE or level is 0 5348babed78e mkndx: fix memory leak when with large dependency list in v2 packages 11dd5923f6a1 mkndx: don't return ADB_ERROR from mkndx_parse_v2meta 8415dbf6df42 mkndx: reset pkginfo on error 684bef440cde mkndx: remove workaround for abuild license field a94fa1878df9 pkg: move same origin check after replaces check 3abcd400bdbf pkg: fix package repos after 16th missing 216ac57b7a1a arch: reserve wasi32 architecture name for WASI APKs 3761e38d1a00 add wasi32/wasi64 reservations to apk-package(5) 68c1fa58113e dot: only initialize qs->mode.empty_matches_all once 56019c5ed390 {blob,tar,adb}: avoid overflow when pulling numbers 5112b60c4440 index: only check file name for old index 345863787484 db: fix ${name} check in apk_db_get_pkg_by_name 5ce64d14ead8 manifest: replace memset 0 with apk_blob_pushed 7765f134215d info: include name and version when --all is used d2ca47f9f3b4 fix indentation 33c822e93267 build: install apk_repoparser.h header 0762b25eb2ad ctx: initialize progress_char in apk_ctx_init 0a3fa796a532 doc: fix typos 10a184f3f43d search: fix incorrect error when no match was found aa9502dc3720 ctx: fix closing of root_fd 2ac55a0f26bd io: fix id_cache when root_fd is 0 c39b22fe49c7 fetch: fix outdir_fd when openat returns 0 9d42be2316fc meson: Build Python module using standard Meson python build functions 48c6e526ee6f meson: Allow overriding the names of the Lua binary and pkgconfig file 249f0d937afb ci: Add build test on Fedora Linux 10dbdf7263eb pkg: replace files/dirs from packages that will be removed acae571db2b9 pkg: apk_pkg_replaces_{dir,file} access ipkgs consistently 8b0b567544b7 io: initialize 'r' in apk_dir_foreach_config_file 55ab583de9a3 io: fix undefined behaviour in apk_istream_get_delim deadab38aea9 db: flush progress notes after opening indexes 32b3a448c3e2 info: always show name/version for no-legacy-info dbba5797269b crypto: make crypto backend an implementation detail c0288de355e6 test: fix failing tests due to missing PATH_MAX definition 1863ccbf7abb make: remove -DCRYPTO_USE_* e2fb020c96ca apk: shared error message for invalid arguments 29040298f5de adb: fix handling of empty adb blocks 2aa08ec9da6a adb: fix exact comparison of objects containing arrays e475a2fab226 Update apk-v3.5.scd 76c629d79473 doc: combine --no-* and --* descriptions afc1ee46ca55 mkpkg: convert --rootnode to APK_OPT_BOOL 2c52e9415653 pkg: correctly check empty atoms in apk_package f384d7d11229 test: add tests for query 0c044cb8323d tests: fix permissions on replaces.sh 31bc2263a10f defines: make BIT() always return a 64-bit type dc86ad784eef solver: always resolve conflict names in install-if 8b6e9c9d6421 db, pkg: separate "virtual" repository for command line packages d7f77eb68aa5 adb: reduce alignment of ADB_TYPE_INT_64 to 32 bits 1ffd648aca45 array: generalize apk_deps_balloc to apk_array_balloc 2089f8a8225b adb, pkg, query: add support for 'recommends' 59c207b582cc array: generalize apk_deps_bclone to apk_array_bclone 617ba801f760 commit: fix size_diff on package removal 649859806c65 commit, upgrade: never suggest --force-broken-world 4f84ee8156e1 help: group option group help first 44a7498d6102 fetch: fix error reporting if package is not selected 7516cf61fe94 adb: return bool from adb_block_is_ext f47cb4bdac15 adb: validate signature header version specific size 1925de55beef adb, pkg: add support for custom tags f174f287b1b2 db, doc: update and document environment variables for scripts 603eeea614b5 upgrade: improve the mechanism to detect self-upgrade done 97c2d3318d8d upgrade: determine apk-tools package name from /proc/self/exe 088f88cdb6a5 build, test: fix limits.h including and testing selfupgrade 8acf4c0e95da pkg: export APK_PACKAGE for package scripts ab907a6b682e io: ignore dot files in apk_dir_foreach_file() f5e4cbc3900e info: make --legacy-info the default for the time being 7f1afedb7cae doc/apk-v3(5): document that multiple SIG blocks are allowed 2204c49b9d7e adb: validate block type before testing the allowed mask 9331888de6bd apk-tools-3.0.0_rc5 Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/19043 Signed-off-by: Robert Marko --- diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index f753b41f85b..f4ea0110d2c 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=2 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2025-02-08 -PKG_SOURCE_VERSION:=34771ccb7964b0e7cb5d1fc64bd1b83fe73296ba -PKG_MIRROR_HASH:=fddd0334fa2ce7cc7fedb2cc95ee800caf9cbe43d617c2e612e2f58fc30b14c2 +PKG_SOURCE_DATE:=2025-06-06 +PKG_SOURCE_VERSION:=9331888de6bd5b280d75112e5b2f7b55684db0ec +PKG_MIRROR_HASH:=cf5b3429ce9ee5e2c4705b0b8160adec6f300dd2a42f8190fb0953754dd5eaa5 PKG_VERSION=3.0.0_pre$(subst -,,$(PKG_SOURCE_DATE)) diff --git a/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch b/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch deleted file mode 100644 index 305e367727b..00000000000 --- a/package/system/apk/patches/0002-io_url_wget-correctly-init-wget_out-on-apk_io_url_in.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a50f7ea2dd023ef124c5209b487608b37dbeea7c Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sat, 1 Mar 2025 19:33:18 +0100 -Subject: [PATCH] io_url_wget: correctly init wget_out on apk_io_url_init call - -Commit fc7768c09497 ("io_url_wget: log wget output using apk_process -api") reworked the implementation but forgot to init the static wget_out -on calling apk_io_url_init. This cause APK to SIGFAULT on apk update or -apk add when actually using the WGET method to download remote packages. - -Fix this by setting wget_out with the passed out from apk_io_url_init. - -Reported-by: John Crispin -Fixes: fc7768c09497 ("io_url_wget: log wget output using apk_process api") -Signed-off-by: Christian Marangi ---- - src/io_url_wget.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/src/io_url_wget.c -+++ b/src/io_url_wget.c -@@ -48,4 +48,5 @@ void apk_io_url_set_redirect_callback(vo - - void apk_io_url_init(struct apk_out *out) - { -+ wget_out = out; - } diff --git a/package/system/apk/patches/0003-io-fix-undefined-behaviour-in-apk_istream_get_delim.patch b/package/system/apk/patches/0003-io-fix-undefined-behaviour-in-apk_istream_get_delim.patch deleted file mode 100644 index d32dd2541f7..00000000000 --- a/package/system/apk/patches/0003-io-fix-undefined-behaviour-in-apk_istream_get_delim.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 55ab583de9a35ea79d63b8058a131ef260d407a9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Mon, 21 Apr 2025 12:22:04 +0300 -Subject: [PATCH] io: fix undefined behaviour in apk_istream_get_delim - -Arithmetics on null pointer are undefined, so leave is->ptr -pointing to is->buf always. Rewrite the function to be -a bit more readable. - -ref #11064, #11105 ---- - src/io.c | 38 +++++++++++++++++++++----------------- - 1 file changed, 21 insertions(+), 17 deletions(-) - ---- a/src/io.c -+++ b/src/io.c -@@ -191,29 +191,33 @@ int apk_istream_get_max(struct apk_istre - - int apk_istream_get_delim(struct apk_istream *is, apk_blob_t token, apk_blob_t *data) - { -- apk_blob_t ret = APK_BLOB_NULL, left = APK_BLOB_NULL; -- int r = 0; -+ int r; -+ -+ if (is->err && is->ptr == is->end) { -+ *data = APK_BLOB_NULL; -+ return is->err < 0 ? is->err : -APKE_EOF; -+ } - - do { -- if (apk_blob_split(APK_BLOB_PTR_LEN((char*)is->ptr, is->end - is->ptr), token, &ret, &left)) -- break; -+ apk_blob_t left; -+ if (apk_blob_split(APK_BLOB_PTR_LEN((char*)is->ptr, is->end - is->ptr), token, data, &left)) { -+ is->ptr = (uint8_t*)left.ptr; -+ is->end = (uint8_t*)left.ptr + left.len; -+ return 0; -+ } - r = __apk_istream_fill(is); - } while (r == 0); - -- /* Last segment before end-of-file. Return also zero length non-null -- * blob if eof comes immediately after the delimiter. */ -- if (is->ptr && r > 0) -- ret = APK_BLOB_PTR_LEN((char*)is->ptr, is->end - is->ptr); -- -- if (!APK_BLOB_IS_NULL(ret)) { -- is->ptr = (uint8_t*)left.ptr; -- is->end = (uint8_t*)left.ptr + left.len; -- *data = ret; -- return 0; -+ if (r < 0) { -+ *data = APK_BLOB_NULL; -+ return apk_istream_error(is, r); - } -- if (r < 0) apk_istream_error(is, r); -- *data = APK_BLOB_NULL; -- return r < 0 ? r : -APKE_EOF; -+ -+ /* EOF received. Return the last buffered data or an empty -+ * blob if EOF came directly after last separator. */ -+ *data = APK_BLOB_PTR_LEN((char*)is->ptr, is->end - is->ptr); -+ is->ptr = is->end = is->buf; -+ return 0; - } - - static void blob_get_meta(struct apk_istream *is, struct apk_file_meta *meta) diff --git a/package/system/apk/patches/0010-app_list-add-full-print.patch b/package/system/apk/patches/0010-app_list-add-full-print.patch index dd334303109..13a7663f2d3 100644 --- a/package/system/apk/patches/0010-app_list-add-full-print.patch +++ b/package/system/apk/patches/0010-app_list-add-full-print.patch @@ -12,21 +12,17 @@ Signed-off-by: Christian Marangi --- a/src/app_list.c +++ b/src/app_list.c -@@ -27,6 +27,7 @@ struct list_ctx { - unsigned int match_depends : 1; +@@ -49,12 +49,53 @@ struct list_ctx { unsigned int match_providers : 1; + unsigned int match_depends : 1; unsigned int manifest : 1; ++ unsigned int installed : 1; /* Solely for print_full patch */ + unsigned int full : 1; - - struct apk_string_array *filters; }; -@@ -105,6 +106,40 @@ static void print_manifest(const struct - printf("%s " BLOB_FMT "\n", pkg->name->name, BLOB_PRINTF(*pkg->version)); - } +static void print_full(const struct apk_package *pkg, const struct list_ctx *ctx) +{ -+ struct apk_dependency *d; ++ struct apk_dependency d; + + printf("Package: %s\n", pkg->name->name); + printf("Version: " BLOB_FMT "\n", BLOB_PRINTF(*pkg->version)); @@ -34,7 +30,7 @@ Signed-off-by: Christian Marangi + int i = 0; + + printf("Depends: "); -+ foreach_array_item(d, pkg->depends) { ++ apk_array_foreach(d, pkg->depends) { + i++; + printf("%s%s", d->name->name, i < apk_array_len(pkg->depends) ? ", ": "\n"); + } @@ -43,7 +39,7 @@ Signed-off-by: Christian Marangi + int i = 0; + + printf("Provides: "); -+ foreach_array_item(d, pkg->provides) { ++ apk_array_foreach(d, pkg->provides) { + i++; + printf("%s%s", d->name->name, i < apk_array_len(pkg->provides) ? ", ": "\n"); + } @@ -58,35 +54,41 @@ Signed-off-by: Christian Marangi + printf("\n"); +} + - static void filter_package(const struct apk_database *db, const struct apk_package *pkg, const struct list_ctx *ctx, const struct apk_name *name) + static void print_package(const struct apk_database *db, const struct apk_name *name, const struct apk_package *pkg, const struct list_ctx *ctx) { - if (ctx->match_origin && !origin_matches(ctx, pkg)) return; -@@ -114,7 +149,9 @@ static void filter_package(const struct - if (ctx->upgradable && !is_upgradable(db, pkg)) return; - if (ctx->match_providers) printf("<%s> ", name->name); -- if (ctx->manifest) -+ if (ctx->full) + ++ if (ctx->full) { + print_full(pkg, ctx); -+ else if (ctx->manifest) - print_manifest(pkg, ctx); - else - print_package(db, pkg, ctx); -@@ -154,6 +191,7 @@ static int print_result(struct apk_datab ++ return; ++ } ++ + if (ctx->manifest) { + printf("%s " BLOB_FMT "\n", pkg->name->name, BLOB_PRINTF(*pkg->version)); + return; +@@ -96,6 +137,7 @@ static void print_package(const struct apk_database *db, const struct apk_name * OPT(OPT_LIST_depends, APK_OPT_SH("d") "depends") \ - OPT(OPT_LIST_installed, APK_OPT_SH("I") "installed") \ + OPT(OPT_LIST_installed, APK_OPT_SH("I")) \ OPT(OPT_LIST_manifest, "manifest") \ + OPT(OPT_LIST_full, "full") \ OPT(OPT_LIST_origin, APK_OPT_SH("o") "origin") \ - OPT(OPT_LIST_orphaned, APK_OPT_SH("O") "orphaned") \ + OPT(OPT_LIST_orphaned, APK_OPT_SH("O")) \ OPT(OPT_LIST_providers, APK_OPT_SH("P") "providers") \ -@@ -167,6 +205,9 @@ static int list_parse_option(void *pctx, - struct list_ctx *ctx = pctx; +@@ -109,6 +151,9 @@ static int list_parse_option(void *pctx, struct apk_ctx *ac, int opt, const char + struct apk_query_spec *qs = &ac->query; switch (opt) { + case OPT_LIST_full: + ctx->full = 1; + break; case OPT_LIST_available: - ctx->available = 1; - ctx->orphaned = 0; + qs->filter.available = 1; + break; +@@ -117,6 +162,7 @@ static int list_parse_option(void *pctx, struct apk_ctx *ac, int opt, const char + break; + case OPT_LIST_installed: + installed: ++ ctx->installed = 1; + qs->filter.installed = 1; + ac->open_flags |= APK_OPENF_NO_SYS_REPOS; + break;