From c45ef8500fcb6a44f1b3cf0a41df4ee0f6e8aa1d Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 23 Nov 2010 10:09:44 +0000 Subject: main/apk-tools: fixes for x86_64 (cherry picked from commit 594924c0158b4ee38801abad298d6763095433ae) --- ...01-db-fix-hash-lookups-on-64-bit-machines.patch | 28 +++++++++++++++++++++ ...-blob-fix-segfault-on-x86_64-with-virtual.patch | 29 ++++++++++++++++++++++ main/apk-tools/APKBUILD | 8 ++++-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 main/apk-tools/0001-db-fix-hash-lookups-on-64-bit-machines.patch create mode 100644 main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch diff --git a/main/apk-tools/0001-db-fix-hash-lookups-on-64-bit-machines.patch b/main/apk-tools/0001-db-fix-hash-lookups-on-64-bit-machines.patch new file mode 100644 index 000000000..327055723 --- /dev/null +++ b/main/apk-tools/0001-db-fix-hash-lookups-on-64-bit-machines.patch @@ -0,0 +1,28 @@ +From 37e8f803a531caac144b075a127f48b7c38fc747 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Tue, 23 Nov 2010 11:32:42 +0200 +Subject: [PATCH 1/2] db: fix hash lookups on 64-bit machines + +The hash is 'unsigned long' everywhere which is 64-bits (on 64-bit +boxes). Fix the one instance of it being 'unsigned int' since that +would be 32-bit and cause lookup failures on 64-bit boxes. +--- + src/apk_database.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/apk_database.h b/src/apk_database.h +index 249ddae..7b36978 100644 +--- a/src/apk_database.h ++++ b/src/apk_database.h +@@ -44,7 +44,7 @@ struct apk_db_file { + struct apk_db_dir { + apk_hash_node hash_node; + +- unsigned int hash; ++ unsigned long hash; + struct hlist_head files; + struct apk_db_dir *parent; + +-- +1.7.3.2 + diff --git a/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch b/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch new file mode 100644 index 000000000..2a84fd1c9 --- /dev/null +++ b/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch @@ -0,0 +1,29 @@ +From c9690b0e7cdb977184e9649cd1bd3688787c1fb5 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Tue, 23 Nov 2010 09:18:40 +0000 +Subject: [PATCH 2/2] blob: fix segfault on x86_64 with --virtual + +blob.ptr might be non-null on empty field in /var/lib/apk/installed +so we compare with blob length. + +This fixes a segfault on x86_64. +--- + src/blob.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/blob.c b/src/blob.c +index 83bcf80..70004e6 100644 +--- a/src/blob.c ++++ b/src/blob.c +@@ -18,7 +18,7 @@ char *apk_blob_cstr(apk_blob_t blob) + { + char *cstr; + +- if (blob.ptr == NULL) ++ if (blob.len == 0) + return strdup(""); + + if (blob.ptr[blob.len-1] == 0) +-- +1.7.3.2 + diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index b18e05618..90d41f685 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa pkgname=apk-tools pkgver=2.0.6 -pkgrel=1 +pkgrel=2 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static" depends= @@ -9,6 +9,8 @@ makedepends="zlib-dev openssl-dev pkgconfig" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 0001-io-db-id-cache-should-be-specific-to-database-root-n.patch 0002-db-fix-the-previous-commit.patch + 0001-db-fix-hash-lookups-on-64-bit-machines.patch + 0002-blob-fix-segfault-on-x86_64-with-virtual.patch " url="http://git.alpinelinux.org/cgit/apk-tools/" @@ -51,4 +53,6 @@ static() { md5sums="5933a61f91f44c5c534f8a62e6effb65 apk-tools-2.0.6.tar.bz2 20c2f3e406984af51c7cf69b69a1d874 0001-io-db-id-cache-should-be-specific-to-database-root-n.patch -01a86fb39a3d161221a57002b86b2a0d 0002-db-fix-the-previous-commit.patch" +01a86fb39a3d161221a57002b86b2a0d 0002-db-fix-the-previous-commit.patch +6d7492fc1d067e22c6fd055d6437bcc7 0001-db-fix-hash-lookups-on-64-bit-machines.patch +92fe4c249bc831e3e21a14751a98b8e3 0002-blob-fix-segfault-on-x86_64-with-virtual.patch" -- cgit v1.2.3