[pacman-dev] Broken database with wrong requiredby fields
Xavier
shiningxc at gmail.com
Mon Jul 16 03:29:32 EDT 2007
On Sat, Jul 14, 2007 at 04:16:46PM -0400, Dan McGee wrote:
> Hello,
>
> This is an automated email from the git hooks/update script, it was
> generated because a ref change was pushed to the repository.
>
> Updating branch, master,
> via f0ea21cffca62c566c5e4d2c540c70fb891b9f4c (commit)
> via ce1fb07436279b2ac70bdad91cf81db550292322 (commit)
> via edcefb1d58115d4b5ae65e258f7eb53f33d21172 (commit)
> via b5ab4bffb785aa92c89ff2fee1c0c9a980367cd0 (commit)
> via 9f9086573a74311913f0d86f5d1e826f2996b35a (commit)
> from 1c9f30b9fab998e2d89dd307a90122618d746cb6 (commit)
>
> - Log -----------------------------------------------------------------
> commit f0ea21cffca62c566c5e4d2c540c70fb891b9f4c
> Author: Dan McGee <dan at archlinux.org>
> Date: Sat Jul 14 09:34:39 2007 -0400
>
> Ensure requiredby entries are removed during an upgrade
>
> This fixes the failure of the requiredby004 pactest in a not so pretty way,
> but it gets the job done. I purposely used the extremely long name of
> PM_TRANS_TYPE_REMOVEUPGRADE to be both clear and in the hope that someone
> else will figure out a better solution.
>
> Original idea from Nagy Gabor, patch updated and cleaned for current code.
>
> Signed-off-by: Dan McGee <dan at archlinux.org>
>
I'm wondering if all the wrong requiredby entries caused by this bug is a
problem or not.
Anyway, I was curious about how broken my current database was, so I made a very
hackish change to pacman to check it.
It isn't meant for inclusion, it's just for showing that it's done very
easily, and so you can run it on your own database to see how it is.
If it's useful, we might then discuss about how it could be properly
implemented (probably just another query option, but which one and also
in which file should that little check function go ?).
First the result here :
src/pacman/pacman -Q | grep wrong
wrong requiredby field ffmpeg for package amrnb
wrong requiredby field libldap for package db
wrong requiredby field skype for package dbus
wrong requiredby field libglade for package docbook-xml
wrong requiredby field gcc-gcj for package libart-lgpl
wrong requiredby field gtk2 for package libjpeg
wrong requiredby field pidgin for package libnetworkmanager
wrong requiredby field audacious-plugins for package libsamplerate
wrong requiredby field centericq for package libstdc++5
wrong requiredby field screen for package pam
wrong requiredby field sshfs for package pkgconfig
wrong requiredby field pycairo for package python-numeric
wrong requiredby field skype for package qt
wrong requiredby field openoffice-base for package ttf-bitstream-vera
wrong requiredby field kazehakase for package xulrunner
I checked several of these, in each case it's dependencies that were dropped during an upgrade.
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 0f149b2..7dde740 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -83,4 +83,26 @@ int pacman_deptest(alpm_list_t *targets)
return(retval);
}
+
+int pacman_check(pmpkg_t *pkg)
+{
+ int retval = 0;
+ alpm_list_t *reqs, *deps;
+
+ for(reqs = alpm_pkg_get_requiredby(pkg); reqs; reqs = reqs->next) {
+ int found = 0;
+ char *reqname = reqs->data;
+ pmpkg_t *reqpkg = alpm_db_get_pkg(alpm_option_get_localdb(), reqname);
+ for(deps = alpm_pkg_get_depends(reqpkg); deps && !found; deps = deps->next) {
+ pmdepend_t *dep = alpm_splitdep(deps->data);
+ found = alpm_depcmp(pkg, dep);
+ }
+ if(!found) {
+ printf("wrong requiredby field %s for package %s\n", reqname, alpm_pkg_get_name(pkg));
+ retval++;
+ }
+ }
+ return(retval);
+}
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/query.c b/src/pacman/query.c
index f6c6b5d..87b2a82 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -390,6 +390,8 @@ int pacman_query(alpm_list_t *targets)
const char *pkgname = alpm_pkg_get_name(pkg);
const char *pkgver = alpm_pkg_get_version(pkg);
+ pacman_check(pkg);
+
if(config->op_q_info) {
dump_pkg_full(pkg, config->op_q_info);
}
@@ -433,6 +435,8 @@ int pacman_query(alpm_list_t *targets)
continue;
}
+ pacman_check(pkg);
+
/* find a target */
if(config->op_q_info) {
dump_pkg_full(pkg, config->op_q_info);
More information about the pacman-dev
mailing list