[pacman-dev] [PATCH] libalpm/package.c : fix requiredby with multiple providers.
The code didn't match the following comment : "A depends on B through n depends <=> A listed in B's requiredby n times" Because of the usage of break instead of continue, it stopped at n=1. I was surprised to see this case happens in real, that's how I noticed the bug: wine depends on both freeglut and glut, while freeglut provides glut. So when installing wine, the update_depends function listed wine twice in freeglut's requiredby. But the compute_requiredby function (used when installing freeglut, and used by testdb) listed wine only once in freeglut's requiredby. That made testdb unhappy. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/package.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 38e6e4c..cd33ca2 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -543,7 +543,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg) _alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'\n", cachepkgname, pkg->name); reqs = alpm_list_add(reqs, strdup(cachepkgname)); - break; + continue; } } } -- 1.5.3.4
On 10/18/07, Chantry Xavier <shiningxc@gmail.com> wrote:
The code didn't match the following comment : "A depends on B through n depends <=> A listed in B's requiredby n times"
Because of the usage of break instead of continue, it stopped at n=1.
I was surprised to see this case happens in real, that's how I noticed the bug: wine depends on both freeglut and glut, while freeglut provides glut.
So when installing wine, the update_depends function listed wine twice in freeglut's requiredby. But the compute_requiredby function (used when installing freeglut, and used by testdb) listed wine only once in freeglut's requiredby. That made testdb unhappy.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/package.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 38e6e4c..cd33ca2 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -543,7 +543,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg) _alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'\n", cachepkgname, pkg->name); reqs = alpm_list_add(reqs, strdup(cachepkgname)); - break; + continue; } } } -- 1.5.3.4
Good catch. I'll pull this into my tree later tonight. -dan
Good catch. I'll pull this into my tree later tonight. Indeed, this is really nice catch. I don't want to bother you, but do we need the line continue? ;-) And we don't need the satisfies variable neither. Bye, ngaba
---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
On Thu, Oct 18, 2007 at 06:09:56PM +0200, Nagy Gabor wrote:
Good catch. I'll pull this into my tree later tonight. Indeed, this is really nice catch. I don't want to bother you, but do we need the line continue? ;-) And we don't need the satisfies variable neither.
lol, of course, you are perfectly right, I edited that blindly without thinking :) Attaching the updated patch.
participants (4)
-
Chantry Xavier
-
Dan McGee
-
Nagy Gabor
-
Xavier