[pacman-dev] [patch] II. deps.c/checkdeps serious bugreport + upgrade060.py
Nagy Gabor
ngaba at petra.hos.u-szeged.hu
Sat Apr 21 12:58:42 EDT 2007
Hi!
My patch won't fix the problem, just cuts off a needless part from the
source (because depcmp takes care of provides too).
This bug is similar to the previous one. But I think this is a serious
one, because this occurs in case of -Su too (as bug I.), so can be very
common (whenever depends changed in sync repo).
----upgrade060.py----
self.description = "Try to upgrade 2 packages which would break deps"
lp1 = pmpkg("pkg1")
lp1.depends = ["pkg2=1.0-1"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2", "1.0-1")
lp2.requiredby = [ "pkg1" ]
self.addpkg2db("local", lp2)
p1 = pmpkg("pkg1", "1.0-2")
p1.depends = ["pkg2=1.0-1"]
self.addpkg(p1)
p2 = pmpkg("pkg2", "1.0-2")
self.addpkg(p2)
self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=1")
self.addrule("PKG_VERSION=pkg1|1.0-1")
self.addrule("PKG_VERSION=pkg2|1.0-1")
-------------------
You find the problem here around lines 323, we don't ensure that we
won't overwrite the local "satisfyer" package with a "non-satisfyer"
one. This could be fixed similarly to my previous patch, but imho that
would be too slow. An idea: we should temporarily attach to the old
packages in the pkgcache a "pointer" which points to the "new" target
(we found all old packages earlier); and this could be deleted at the
end of transaction (anyway, if the transaction is successful, we
always must modify that entries). The implementation is waiting for
you ;-)
-----patch----------
diff -Naur pacman-lib/lib/libalpm/deps.c pacman-lib.new/lib/libalpm/deps.c
--- pacman-lib/lib/libalpm/deps.c 2007-03-19 05:23:45.000000000 +0100
+++ pacman-lib.new/lib/libalpm/deps.c 2007-04-21 16:42:29.000000000 +0200
@@ -319,36 +320,12 @@
}
found = 0;
- /* check database for literal packages */
+ /* check database for satisfying packages */
for(k = _alpm_db_get_pkgcache(db); k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
found = alpm_depcmp(p, depend);
}
- /* check database for provides matches */
- if(!found) {
- alpm_list_t *m;
- for(m = _alpm_db_whatprovides(db, depend->name); m && !found; m = m->next) {
- /* look for a match that isn't one of the packages we're trying
- * to install. this way, if we match against a to-be-installed
- * package, we'll defer to the NEW one, not the one already
- * installed. */
- pmpkg_t *p = m->data;
- alpm_list_t *n;
- int skip = 0;
- for(n = packages; n && !skip; n = n->next) {
- pmpkg_t *ptp = n->data;
- if(strcmp(alpm_pkg_get_name(ptp), alpm_pkg_get_name(p)) == 0) {
- skip = 1;
- }
- }
- if(skip) {
- continue;
- }
- found = alpm_depcmp(p, depend);
- }
- FREELISTPTR(k);
- }
/* check other targets */
for(k = packages; k && !found; k = k->next) {
pmpkg_t *p = k->data;
--------------------
Bye, ngaba
More information about the pacman-dev
mailing list