[pacman-dev] [PATCH] Minor fixes in sync.c and deps.c.
* memleak found by Nagy in checkdeps * an useless line found by Nagy in resolvedeps * data wasn't set to the missing dependencies in sync_prepare Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/deps.c | 5 +++-- lib/libalpm/sync.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 4a4f654..e9d3966 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -339,12 +339,14 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps, } for(k = alpm_pkg_get_depends(p); k; k = k->next) { + char *missdepstring; pmdepend_t *depend = k->data; - char *missdepstring = alpm_dep_get_string(depend); if(!alpm_depcmp(oldpkg, depend)) { continue; } + missdepstring = alpm_dep_get_string(depend); + /* OK, we don't want to break this depend */ /* 1. for efficiency we check newpkg first if we are in the upgrade list */ @@ -670,7 +672,6 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, if(!sync) { continue; } - found = alpm_depcmp(sync, missdep); found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove); if(!found) { continue; diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index f6fa318..5e58400 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -670,7 +670,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync if(deps) { pm_errno = PM_ERR_UNSATISFIED_DEPS; ret = -1; - FREELIST(deps); + *data = deps; goto cleanup; } } -- 1.5.3.6
* data wasn't set to the missing dependencies in sync_prepare
Hmm. I remember that I didn't really know what to do here. alpm_sync_prepare should automagically resolve dependencies. So "usually" this should be an empty list (I mean alpm_resolvedeps should report the error or this should be an empty list). If this is not an empty list, the error message may say nothing, because this is a "manipulated" upgrade and remove list, what's more this may be misleading. The same holds for alpm_resolvedeps errors: User does a "pacman -S foo" and get something like "cannot satisfy bar dependency of baz"... This is not very informative... But I can admit, that this is probably better than nothing. ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
participants (2)
-
Chantry Xavier
-
Nagy Gabor