diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-05 16:26:46 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-05 16:26:46 +0000 |
commit | 6185b4b44addc295026dab7128ae161146fed984 (patch) | |
tree | cdcd85f6a24acdb339b5c33a59623db9e348f486 /main/apk-tools | |
parent | af3ef82a15ac611eeea4beec92050f80839f4e5e (diff) | |
download | aports-6185b4b44addc295026dab7128ae161146fed984.tar.bz2 aports-6185b4b44addc295026dab7128ae161146fed984.tar.xz |
main/apk-tools: fix segfault for info --exist
and remove unused patches
Diffstat (limited to 'main/apk-tools')
4 files changed, 31 insertions, 151 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 deleted file mode 100644 index c54fe73b4..000000000 --- a/main/apk-tools/0001-db-fix-checksum-storing-to-db.patch +++ /dev/null @@ -1,73 +0,0 @@ -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/0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch b/main/apk-tools/0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch new file mode 100644 index 000000000..f0f918a59 --- /dev/null +++ b/main/apk-tools/0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch @@ -0,0 +1,26 @@ +From 2cfca5b6ed658433419f9b581b3ba30f34c973c4 Mon Sep 17 00:00:00 2001 +From: Timo Teras <timo.teras@iki.fi> +Date: Wed, 5 Aug 2009 19:10:54 +0300 +Subject: [PATCH] info: fix a --exists to work if the name is non-existant + +--- + src/info.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/src/info.c b/src/info.c +index a222b8c..073dc80 100644 +--- a/src/info.c ++++ b/src/info.c +@@ -94,6 +94,9 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db, + continue; + + name = dep.name; ++ if (name->pkgs == NULL) ++ continue; ++ + for (j = 0; j < name->pkgs->num; j++) { + pkg = name->pkgs->item[j]; + if (apk_pkg_get_state(pkg) == APK_PKG_INSTALLED) +-- +1.6.3.3 + diff --git a/main/apk-tools/0001-io-fix-corruption-of-big-files-on-mmap-write.patch b/main/apk-tools/0001-io-fix-corruption-of-big-files-on-mmap-write.patch deleted file mode 100644 index 4261ce521..000000000 --- a/main/apk-tools/0001-io-fix-corruption-of-big-files-on-mmap-write.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 67108bf07a67811ea91fc965f3f1592a4a70044e Mon Sep 17 00:00:00 2001 -From: Timo Teras <timo.teras@iki.fi> -Date: Fri, 31 Jul 2009 10:50:15 +0300 -Subject: [PATCH] io: fix corruption of big files on mmap write - -remember to increment destination pointer; and munmap the proper -base address. ---- - src/io.c | 27 +++++++++++++-------------- - 1 files changed, 13 insertions(+), 14 deletions(-) - -diff --git a/src/io.c b/src/io.c -index 18e89d3..3929ba1 100644 ---- a/src/io.c -+++ b/src/io.c -@@ -114,21 +114,19 @@ size_t apk_istream_splice(void *stream, int fd, size_t size, - { - static void *splice_buffer = NULL; - struct apk_istream *is = (struct apk_istream *) stream; -- unsigned char *buf = MAP_FAILED; -- size_t bufsz, done = 0, r, togo, mmapped = 0; -+ unsigned char *buf, *mmapbase = MAP_FAILED; -+ size_t bufsz, done = 0, r, togo; - - bufsz = size; - if (size > 128 * 1024) { - if (ftruncate(fd, size) == 0) -- buf = mmap(NULL, size, PROT_READ | PROT_WRITE, -- MAP_SHARED, fd, 0); -- if (buf != MAP_FAILED) { -- mmapped = 1; -- if (bufsz > 2*1024*1024) -- bufsz = 2*1024*1024; -- } -+ mmapbase = mmap(NULL, size, PROT_READ | PROT_WRITE, -+ MAP_SHARED, fd, 0); -+ if (bufsz > 2*1024*1024) -+ bufsz = 2*1024*1024; -+ buf = mmapbase; - } -- if (!mmapped) { -+ if (mmapbase == MAP_FAILED) { - if (splice_buffer == NULL) - splice_buffer = malloc(256*1024); - buf = splice_buffer; -@@ -149,13 +147,14 @@ size_t apk_istream_splice(void *stream, int fd, size_t size, - if (r < 0) - goto err; - -- if (!mmapped) { -+ if (mmapbase == MAP_FAILED) { - if (write(fd, buf, r) != r) { - if (r < 0) - r = -errno; - goto err; - } -- } -+ } else -+ buf += r; - - done += r; - if (r != togo) -@@ -163,8 +162,8 @@ size_t apk_istream_splice(void *stream, int fd, size_t size, - } - r = done; - err: -- if (mmapped) -- munmap(buf, size); -+ if (mmapbase != MAP_FAILED) -+ munmap(mmapbase, size); - return r; - } - --- -1.6.3.3 - diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index 2f0b37e38..215e7d04d 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,12 +1,13 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=apk-tools pkgver=2.0_rc1 -pkgrel=0 +pkgrel=1 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static" depends= makedepends="zlib-dev openssl-dev pkgconfig" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 + 0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch " @@ -16,6 +17,7 @@ license=GPL-2 build() { cd "$srcdir/$pkgname-$pkgver" sed -i -e 's:-Werror::' Make.rules + patch -p1 -i ../0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch || return 1 make || return 1 make static || return 1 @@ -35,4 +37,5 @@ static() { "$subpkgdir"/sbin/apk.static } -md5sums="f790182792a41841e6932ae0b6737a43 apk-tools-2.0_rc1.tar.bz2" +md5sums="f790182792a41841e6932ae0b6737a43 apk-tools-2.0_rc1.tar.bz2 +87dd230bf89f429db06dcad96be235c0 0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch" |