diff options
-rw-r--r-- | main/apk-tools/0001-list-fix-segmentation-fault-with-virtual-packages.patch | 46 | ||||
-rw-r--r-- | main/apk-tools/APKBUILD | 7 |
2 files changed, 50 insertions, 3 deletions
diff --git a/main/apk-tools/0001-list-fix-segmentation-fault-with-virtual-packages.patch b/main/apk-tools/0001-list-fix-segmentation-fault-with-virtual-packages.patch new file mode 100644 index 0000000000..883d7bb86c --- /dev/null +++ b/main/apk-tools/0001-list-fix-segmentation-fault-with-virtual-packages.patch @@ -0,0 +1,46 @@ +From 5c4b90dfd48d476b9e7aae2ad6627dd6f03ac557 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> +Date: Fri, 29 Jun 2018 15:39:56 +0200 +Subject: [PATCH] list: fix segmentation fault with virtual packages + +Virtual packages have the origin pointer set to NULL. Trying to print it +using the BLOB_PRINTF macros causes a segmentation fault. + +Inspired by the `print_origin_name` function from `src/search.c` this +commit attempts to fix it by checking whether `pkg->origin` is NULL +before attempting to print it. If it is NULL the pkg name is printed +instead. + +Since printing the pkg name requires a different format string this +commit splits the printf call for printing the package line into +multiple ones. The output format shouldn't have changed at all though. +--- + src/list.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/list.c b/src/list.c +index 14f5fb5..e285e3f 100644 +--- a/src/list.c ++++ b/src/list.c +@@ -101,9 +101,15 @@ static const struct apk_package *is_upgradable(struct apk_name *name, const stru + + static void print_package(const struct apk_package *pkg, const struct list_ctx *ctx) + { +- printf(PKG_VER_FMT " " BLOB_FMT " {" BLOB_FMT "} (" BLOB_FMT ")", +- PKG_VER_PRINTF(pkg), BLOB_PRINTF(*pkg->arch), BLOB_PRINTF(*pkg->origin), +- BLOB_PRINTF(*pkg->license)); ++ printf(PKG_VER_FMT " " BLOB_FMT " ", ++ PKG_VER_PRINTF(pkg), BLOB_PRINTF(*pkg->arch)); ++ ++ if (pkg->origin != NULL) ++ printf("{" BLOB_FMT "}", BLOB_PRINTF(*pkg->origin)); ++ else ++ printf("{%s}", pkg->name->name); ++ ++ printf(" (" BLOB_FMT ")", BLOB_PRINTF(*pkg->license)); + + if (pkg->ipkg) + printf(" [installed]"); +-- +2.18.0 + diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index 3ef7fd1005..59016fdb97 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=apk-tools pkgver=2.10.0 -pkgrel=0 +pkgrel=1 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static" depends= @@ -13,7 +13,7 @@ if [ "$CBUILD" = "$CHOST" ]; then makedepends="$makedepends lua5.2-dev" fi source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz - " + 0001-list-fix-segmentation-fault-with-virtual-packages.patch" url="https://git.alpinelinux.org/cgit/apk-tools/" arch="all" @@ -82,4 +82,5 @@ luaapk() { mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/ } -sha512sums="96b840fa5fb7342bb5f6ad5c25e837f705299256e168130d6ef5c1940569df3e7dfa50d36128c0f9a76e662c80b342dd92a8270acd82b4eb91093020b599fcc6 apk-tools-2.10.0.tar.xz" +sha512sums="96b840fa5fb7342bb5f6ad5c25e837f705299256e168130d6ef5c1940569df3e7dfa50d36128c0f9a76e662c80b342dd92a8270acd82b4eb91093020b599fcc6 apk-tools-2.10.0.tar.xz +1e83e68b67dd66a0a8ccdbb6ca34ccb7748eff82d032d0d9101b7155a0ff768dc2a849e99387cb9970f0fd9ff5606d08fca9f3bd1a5a561b8b0995d97c69e971 0001-list-fix-segmentation-fault-with-virtual-packages.patch" |