[pacman-dev] [PATCH] libalpm/package.c : fix requiredby with multiple providers.

Chantry Xavier shiningxc at gmail.com
Thu Oct 18 07:35:09 EDT 2007


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 at 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





More information about the pacman-dev mailing list