[pacman-dev] Duplicated requiredby conclusion

Nagy Gabor ngaba at petra.hos.u-szeged.hu
Sun Apr 1 17:03:00 EDT 2007


Hi!
Yes, we fixed this problem: We didn't check the existency of the
entry before inserting it to the requiredby field. But how could
duplicated entries appear? Update is a remove-then-install process, so
we simply remove the package first (and removing it from requiredby
fields), then install it (which is not installed now, so that is not
listed in any requiredby fields).

The answer: That remove process is not a real remove transaction (a
pseudo transaction is created); look into add.c(389):
====
_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, ...
====
Wow, the transaction type is UPGRADE (this is mainly for logging imho).
But look into trans.c/_alpm_trans_update_depends(342):
====
				if(trans->type == PM_TRANS_TYPE_REMOVE) {
					void *data = NULL;
					rqdby = alpm_list_remove(rqdby,	pkgname, _alpm_str_cmp, &data);
					FREE(data);
					deppkg->requiredby = rqdby;
				} else {
					if(!alpm_list_find_str(rqdby, pkgname)) {
						rqdby = alpm_list_add(rqdby, strdup(pkgname));
						deppkg->requiredby = rqdby;
					}
				}
====
So, we want to add it, instead of removing. After adding
"if(!alpm_list_find_str(rqdby, pkgname))", this is not so dangerous
(but needless), but this a _very odd_ method. However, this is
absolutely not safe yet:
If the remove was successful, but we cannot install the package, we get
false requiredby entries.

Bye, Nagy Gabor




More information about the pacman-dev mailing list