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 765905 - GI_TYPELIB_PATH does not override g_irepository_prepend_search_path() anymore
GI_TYPELIB_PATH does not override g_irepository_prepend_search_path() anymore
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2016-05-02 14:36 UTC by Carlos Garnacho
Modified: 2016-05-05 17:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
installed-tests: Avoid usage of GI_TYPELIB_PATH to override lookups (2.67 KB, patch)
2016-05-05 10:28 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2016-05-02 14:36:18 UTC
This bug is spawn in reaction to:

https://bugzilla.gnome.org/show_bug.cgi?id=765735#c12
https://bugzilla.gnome.org/show_bug.cgi?id=765735#c13

The TL;DR of it is: As of gobject-introspection bd475c0 (in master), GI_TYPELIB_PATH does no longer override paths added in code through g_irepository_prepend_search_path().

This has implications in how does gjs/installed-tests expect to use the in-tree private libraries when running make check.

Right now, only later g_irepository_prepend_search_path() calls may override earlier ones, so two possible approaches to fix this are:

- Adding an extra envvar for gjs-context.cpp to lookup the GjsPrivate directory, which can then be overriden in Makefile-test.am

- Doing an ad-hoc call to g_irepository_prepend_search_path(g_getenv ("TOP_BUILDDIR")) in gjs/installed-tests/gjs-unit.cpp, although it should ensure that this is performed after the call in gjs_context_class_init().
Comment 1 Cosimo Cecchi 2016-05-02 15:00:54 UTC
If I understand the problem correctly, and the fallout is only limited to the tests, I am leaning towards the ad-hoc call to g_irepository_prepend_search_path() from the test runner.
Comment 2 Carlos Garnacho 2016-05-02 15:52:38 UTC
As far as gjs is concerned, I think it's only limited to tests indeed. More generically, the referred bug could be read as "don't rely on GI_TYPELIB_PATH if you want to run code entirely from inside your project tree". AFAICS gjs is doing the right thing in the other seemingly affected places:

https://git.gnome.org/browse/gjs/tree/modules/package.js#n125
https://git.gnome.org/browse/gjs/tree/modules/package.js#n236
Comment 3 Cosimo Cecchi 2016-05-05 04:10:52 UTC
Sounds good then - want to prepare a patch? :-)
Comment 4 Carlos Garnacho 2016-05-05 10:28:14 UTC
Created attachment 327335 [details] [review]
installed-tests: Avoid usage of GI_TYPELIB_PATH to override lookups

As of gobject-introspection bd475c00d96, this environment variable won't
override the search paths set through g_irepository_prepend_search_path,
so use this function in tests, ensuring that it overrides search paths
added internally by the GjsContext.
Comment 5 Carlos Garnacho 2016-05-05 10:31:54 UTC
Note that there is one test that is failing here (testUtf8 in installed-tests/js/testEverythingBasic.js) both with and without this patch, skipping that one, the rest seems to work ok. I also triple checked that the search paths are in the expected order.
Comment 6 Cosimo Cecchi 2016-05-05 12:32:49 UTC
Review of attachment 327335 [details] [review]:

Looks good, thanks.
Comment 7 Cosimo Cecchi 2016-05-05 12:34:06 UTC
(In reply to Carlos Garnacho from comment #5)
> Note that there is one test that is failing here (testUtf8 in
> installed-tests/js/testEverythingBasic.js) both with and without this patch,
> skipping that one, the rest seems to work ok. I also triple checked that the
> search paths are in the expected order.

Thank you - I think the other failure is known and is bug 761068.
Comment 8 Carlos Garnacho 2016-05-05 17:13:07 UTC
Yup, looks like that one :). Pushing this patch.
Comment 9 Carlos Garnacho 2016-05-05 17:13:45 UTC
Attachment 327335 [details] pushed as 482d251 - installed-tests: Avoid usage of GI_TYPELIB_PATH to override lookups