After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759613 - dependencies should be resilient against search paths and directory ordering
dependencies should be resilient against search paths and directory ordering
Status: RESOLVED FIXED
Product: libpeas
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: libpeas-maint
libpeas-maint
Depends on:
Blocks:
 
 
Reported: 2015-12-18 04:16 UTC by Christian Hergert
Modified: 2015-12-19 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch implementing topological sort (9.42 KB, patch)
2015-12-18 04:16 UTC, Christian Hergert
none Details | Review
engine: use topological sort to resolve dependency graph (9.46 KB, patch)
2015-12-18 11:21 UTC, Christian Hergert
none Details | Review
Fix sorting of PeasEngine:plugin-list (3.92 KB, patch)
2015-12-19 22:55 UTC, Garrett Regier
committed Details | Review

Description Christian Hergert 2015-12-18 04:16:33 UTC
Created attachment 317598 [details] [review]
patch implementing topological sort

Previously, if a plugin info was discovered with dependencies before it's dependency was discovered, there was a chance that the ordering would be undefined.

Instead, this uses topological sort and reapplies the sorting after every addition so that delayed dependencies can be applied.

Since this uses a GList for everything, I switched the GQueue plugin_list back to a GList *plugin_list.
Comment 1 Ignacio Casal Quinteiro (nacho) 2015-12-18 11:16:11 UTC
Review of attachment 317598 [details] [review]:

Apart from the typo, not sure what to say. What I would expect is an unit test though.

::: libpeas/peas-engine.c
@@ +238,3 @@
+    add_to_sorted:
+      if (depth == -1)
+        /* we failed to reolsve the dependency, so push to the end */

typo
Comment 2 Christian Hergert 2015-12-18 11:18:46 UTC
We already have some unit tests for dependency solving, which this passes. The difficulty is that it is hard to control the order of children in the directory inode. However, maybe we can play with search paths to force it to happen.
Comment 3 Christian Hergert 2015-12-18 11:21:42 UTC
Created attachment 317623 [details] [review]
engine: use topological sort to resolve dependency graph

Previously, if a plugin info was discovered with dependencies before it's
dependency was discovered, there was a chance that the ordering would be
undefined.

Instead, this uses topological sort and reapplies the sorting after every
addition so that delayed dependencies can be applied.

Since this uses a GList for everything, I switched the GQueue plugin_list
back to a GList *plugin_list.
Comment 4 Garrett Regier 2015-12-19 22:55:21 UTC
Created attachment 317680 [details] [review]
Fix sorting of PeasEngine:plugin-list

The new "better order" ended up breaking the order to be correct in regards to dependencies.
Comment 5 Garrett Regier 2015-12-19 22:57:59 UTC
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.