[pacman-dev] _alpm_sortbydeps is slow and buggy

Nagy Gabor ngaba at petra.hos.u-szeged.hu
Sat Apr 14 05:42:44 EDT 2007


Hi!

As I see, the algorithm is correct (but slow) anyway, and (n-1) steps
are enough. I won't go into details, but one can think to this
algorithm as if we ensure the order of foo[i] and its dependencies in
the ith step, where foo[i] is the ith in the topological sorted list.
So the graph contains a circle <=> n-1 steps are not enough.
As a hotfix, plz change sqrt(n) to n-1 (or n) and remove libm; and
you can replace "possible dependency cycle detected" to "dependency
cycle detected".

Bye, ngaba

PS.: This function is not so important, because depcheck is done before
this (I think we should merge the 2 functions to efficiency). 




More information about the pacman-dev mailing list