From b01d144c6922384921f808b190430ad7aa114010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Sat, 1 Jan 2011 12:11:49 +0200 Subject: [PATCH] various: fix breakage from converting dependency versions to atoms The version now needs to be initialized atom always, since it's dereferenced in various places. --- src/del.c | 1 + src/fetch.c | 1 + src/info.c | 1 + src/state.c | 1 + src/upgrade.c | 6 ++++-- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/del.c b/src/del.c index f4437b9..695785f 100644 --- a/src/del.c +++ b/src/del.c @@ -51,6 +51,7 @@ static int del_main(void *ctx, struct apk_database *db, int argc, char **argv) name = apk_db_get_name(db, APK_BLOB_STR(argv[i])); dep = (struct apk_dependency) { .name = name, + .version = apk_blob_atomize(APK_BLOB_NULL), .result_mask = APK_DEPMASK_CONFLICT, }; diff --git a/src/fetch.c b/src/fetch.c index 9c32a11..b67a189 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -178,6 +178,7 @@ static int fetch_main(void *ctx, struct apk_database *db, int argc, char **argv) for (i = 0; i < argc; i++) { struct apk_dependency dep = (struct apk_dependency) { .name = apk_db_get_name(db, APK_BLOB_STR(argv[i])), + .version = apk_blob_atomize(APK_BLOB_NULL), .result_mask = APK_DEPMASK_REQUIRE, }; diff --git a/src/info.c b/src/info.c index 2a28a93..1b936f0 100644 --- a/src/info.c +++ b/src/info.c @@ -115,6 +115,7 @@ static int info_who_owns(struct info_ctx *ctx, struct apk_database *db, if (apk_verbosity < 1) { dep = (struct apk_dependency) { .name = pkg->name, + .version = apk_blob_atomize(APK_BLOB_NULL), .result_mask = APK_DEPMASK_REQUIRE, }; apk_deps_add(&deps, &dep); diff --git a/src/state.c b/src/state.c index 61ff563..0471850 100644 --- a/src/state.c +++ b/src/state.c @@ -523,6 +523,7 @@ static int reinstall_broken_package(struct apk_state *state, { struct apk_dependency dep0 = { .name = pkg->name, + .version = apk_blob_atomize(APK_BLOB_NULL), .result_mask = APK_DEPMASK_REQUIRE, }; return apk_state_lock_dependency(state, &dep0); diff --git a/src/upgrade.c b/src/upgrade.c index b54d6c0..be6a499 100644 --- a/src/upgrade.c +++ b/src/upgrade.c @@ -34,6 +34,7 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg { struct apk_state *state = NULL; struct apk_name_array *missing; + apk_blob_t *null_atom = apk_blob_atomize(APK_BLOB_NULL); int i, r = 0; apk_flags |= APK_UPGRADE; @@ -45,9 +46,10 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg for (i = 0; i < db->world->num; i++) { struct apk_dependency *dep = &db->world->item[i]; - if (dep->version && (apk_flags & APK_PREFER_AVAILABLE)) { + if (dep->version != null_atom && + (apk_flags & APK_PREFER_AVAILABLE)) { dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER; - dep->version = NULL; + dep->version = null_atom; } if (dep->name->pkgs->num != 0) r |= apk_state_lock_dependency(state, dep);