diff --git a/bin/xbps-bin/install.c b/bin/xbps-bin/install.c index bdbe73c9..c780b833 100644 --- a/bin/xbps-bin/install.c +++ b/bin/xbps-bin/install.c @@ -612,10 +612,11 @@ xbps_exec_transaction(bool yes) trans->dict = xbps_repository_get_transaction_dict(); if (trans->dict == NULL) { - rv = errno; + xbps_dbg_printf("Empty transaction dictionary: %s\n", + strerror(errno)); goto out; } - if (rv == ENOENT) { + if (errno == ENOENT) { /* * Bail out if there are unresolved deps. */ diff --git a/lib/regpkgdb_dictionary.c b/lib/regpkgdb_dictionary.c index 18fcdb4d..d84fca63 100644 --- a/lib/regpkgdb_dictionary.c +++ b/lib/regpkgdb_dictionary.c @@ -75,8 +75,9 @@ xbps_regpkgdb_dictionary_get(void) regpkgdb_dict = prop_dictionary_internalize_from_zfile(plist); if (regpkgdb_dict == NULL) { free(plist); - xbps_dbg_printf("[regpkgdb] cannot internalize " - "regpkgdb_dict %s\n", strerror(errno)); + if (errno != ENOENT) + xbps_dbg_printf("[regpkgdb] cannot internalize " + "regpkgdb_dict %s\n", strerror(errno)); return NULL; } free(plist); diff --git a/lib/repository_finddeps.c b/lib/repository_finddeps.c index a1bfa2b8..8a8d8ef4 100644 --- a/lib/repository_finddeps.c +++ b/lib/repository_finddeps.c @@ -113,6 +113,7 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg) prop_object_t obj; size_t idx = 0; bool add_pkgdep, pkgfound, update_pkgdep; + int rv = 0; assert(trans_dict != NULL); assert(reqpkg != NULL); @@ -148,6 +149,12 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg) } if (strcmp(pkgnamedep, curpkgnamedep) == 0) { pkgfound = true; + if (strcmp(curver, pkgver) == 0) { + free(curpkgnamedep); + free(pkgnamedep); + rv = EEXIST; + goto out; + } /* * if new dependency version is greater than current * one, store it. @@ -158,6 +165,7 @@ add_missing_reqdep(prop_dictionary_t trans_dict, const char *reqpkg) add_pkgdep = false; free(curpkgnamedep); free(pkgnamedep); + rv = EEXIST; goto out; } update_pkgdep = true; @@ -180,7 +188,7 @@ out: return errno; } - return 0; + return rv; } static int diff --git a/lib/repository_findpkg.c b/lib/repository_findpkg.c index ef0144bf..a124573c 100644 --- a/lib/repository_findpkg.c +++ b/lib/repository_findpkg.c @@ -213,18 +213,17 @@ xbps_repository_get_transaction_dict(void) * return the dictionary, the client should always * check if that's the case. */ - if (rv == ENOENT) - return trans_dict; - - return NULL; + return trans_dict; } /* * Add total transaction installed/download sizes * to the transaction dictionary. */ - if (compute_transaction_sizes() != 0) + if ((rv = compute_transaction_sizes()) != 0) { + errno = rv; return NULL; + } /* * Remove the "missing_deps" array now that it's not needed. diff --git a/lib/sortdeps.c b/lib/sortdeps.c index d23d00a0..d50926f6 100644 --- a/lib/sortdeps.c +++ b/lib/sortdeps.c @@ -74,8 +74,11 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps) * If there are missing dependencies, bail out. */ missingdeps = prop_dictionary_get(chaindeps, "missing_deps"); - if (prop_array_count(missingdeps) > 0) + if (prop_array_count(missingdeps) > 0) { + xbps_dbg_printf("missing dependencies! won't " + "continue sorting\n"); return ENOENT; + } sorted = prop_array_create(); if (sorted == NULL)