summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/apk-tools/0001-db-fix-checksum-storing-to-db.patch73
-rw-r--r--main/apk-tools/APKBUILD7
2 files changed, 78 insertions, 2 deletions
diff --git a/main/apk-tools/0001-db-fix-checksum-storing-to-db.patch b/main/apk-tools/0001-db-fix-checksum-storing-to-db.patch
new file mode 100644
index 00000000..c54fe73b
--- /dev/null
+++ b/main/apk-tools/0001-db-fix-checksum-storing-to-db.patch
@@ -0,0 +1,73 @@
+From c1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7 Mon Sep 17 00:00:00 2001
+From: Timo Teras <timo.teras@iki.fi>
+Date: Thu, 30 Jul 2009 11:55:59 +0300
+Subject: [PATCH] db: fix checksum storing to db
+
+also take precautions in audit code if the db is missing the
+checksum.
+---
+ src/audit.c | 7 +++----
+ src/database.c | 8 ++++++--
+ 2 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/audit.c b/src/audit.c
+index 31965df..76bd492 100644
+--- a/src/audit.c
++++ b/src/audit.c
+@@ -69,10 +69,9 @@ static int audit_directory(apk_hash_item item, void *ctx)
+ } else {
+ dbf = apk_db_file_query(db, bdir, APK_BLOB_STR(de->d_name));
+ if (dbf != NULL) {
+- if (apk_file_get_info(tmp, dbf->csum.type, &fi) < 0)
+- continue;
+-
+- if (apk_checksum_compare(&fi.csum, &dbf->csum) == 0)
++ if (dbf->csum.type != APK_CHECKSUM_NONE &&
++ apk_file_get_info(tmp, dbf->csum.type, &fi) == 0 &&
++ apk_checksum_compare(&fi.csum, &dbf->csum) == 0)
+ continue;
+
+ reason = 'U';
+diff --git a/src/database.c b/src/database.c
+index 968d55e..16ae94b 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1458,6 +1458,7 @@ static int apk_db_install_archive_entry(void *_ctx,
+ diri->dir->name, file->name);
+ r = apk_archive_entry_extract(ae, is, alt_name,
+ extract_cb, ctx);
++ memcpy(&file->csum, &ae->csum, sizeof(file->csum));
+ } else {
+ if (apk_verbosity >= 3)
+ apk_message("%s", ae->name);
+@@ -1502,7 +1503,8 @@ static void apk_db_purge_pkg(struct apk_database *db, struct apk_package *pkg,
+ hash = apk_blob_hash_seed(key.filename, diri->dir->hash);
+ if (!(diri->dir->flags & APK_DBDIRF_PROTECTED) ||
+ (apk_flags & APK_PURGE) ||
+- (apk_file_get_info(name, file->csum.type, &fi) == 0 &&
++ (file->csum.type != APK_CHECKSUM_NONE &&
++ apk_file_get_info(name, file->csum.type, &fi) == 0 &&
+ apk_checksum_compare(&file->csum, &fi.csum) == 0))
+ unlink(name);
+ if (apk_verbosity >= 3)
+@@ -1565,6 +1567,7 @@ static void apk_db_migrate_files(struct apk_database *db,
+ if ((diri->dir->flags & APK_DBDIRF_PROTECTED) &&
+ (r == 0) &&
+ (ofile == NULL ||
++ ofile->csum.type == APK_CHECKSUM_NONE ||
+ apk_checksum_compare(&ofile->csum, &fi.csum) != 0)) {
+ /* Protected directory, with file without
+ * db entry, or local modifications.
+@@ -1575,7 +1578,8 @@ static void apk_db_migrate_files(struct apk_database *db,
+ ofile->csum.type != file->csum.type)
+ apk_file_get_info(name, file->csum.type, &fi);
+ if ((apk_flags & APK_CLEAN_PROTECTED) ||
+- apk_checksum_compare(&file->csum, &fi.csum) == 0)
++ (file->csum.type != APK_CHECKSUM_NONE &&
++ apk_checksum_compare(&file->csum, &fi.csum) == 0))
+ unlink(tmpname);
+ } else {
+ /* Overwrite the old file */
+--
+1.6.3.3
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 9deff540..96d7d35b 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,11 +1,12 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.0_pre17
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
depends=
makedepends="zlib-dev openssl-dev pkgconfig"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-db-fix-checksum-storing-to-db.patch
"
@@ -15,6 +16,7 @@ license=GPL-2
build() {
cd "$srcdir/$pkgname-$pkgver"
sed -i -e 's:-Werror::' Make.rules
+ patch -p1 -i ../0001-db-fix-checksum-storing-to-db.patch || return 1
make || return 1
make DESTDIR="$pkgdir" install
@@ -27,4 +29,5 @@ build() {
ln -s apk apk_version
}
-md5sums="4d31c9ae51b357a8514e99a8750af0b6 apk-tools-2.0_pre17.tar.bz2"
+md5sums="4d31c9ae51b357a8514e99a8750af0b6 apk-tools-2.0_pre17.tar.bz2
+d7944308cefe6f5fc45a24e1840d087e 0001-db-fix-checksum-storing-to-db.patch"