hardinfo icon indicating copy to clipboard operation
hardinfo copied to clipboard

Bug: Problematic Module Load Ordering

Open CamberLoid opened this issue 2 years ago • 0 comments

Description

When launching with no parameters (all modules), modules benchmark.so and computer.so failed to be loaded due to undefined symbols (see log below) which are in devices.so. This leads to an unexpected prompt asking user to load computer.so, along with the missing of benchmark.so-related features.

In hardinfo/utils.c: https://github.com/lpereira/hardinfo/blob/10f9789e95b735931805b7eb684ae43ac6f29353/hardinfo/util.c#L966-L971

I think this may be caused by an undefined order returned from g_dir_read_name(). Document (see references) says "The order of entries returned from this function is not defined", and make other modules load before devices.so.

I managed to write a patch as a workaround which may fix the problem, but I am not confident about it and not going to create a pull request about this. The patch makes function modules_load() call module_load((gchar *) "devices.so") before traversing modules directory.

Build with -DHARDINFO_GTK3='ON'

References:

  • https://docs.gtk.org/glib/method.Dir.read_name.html
  • Patch: https://gist.github.com/CamberLoid/c250eb2d581ee7c45d11610168684202

Log

(full: https://gist.github.com/CamberLoid/c597378249c693749f953c90caea90b2)

*** /usr/src/debug/hardinfo-git/hardinfo/hardinfo/util.c:558 (ui_init) *** initializing gtk+ UI
*** /usr/src/debug/hardinfo-git/hardinfo/hardinfo/hardinfo.c:114 (main) *** loading all modules
*** /usr/src/debug/hardinfo-git/hardinfo/shell/iconcache.c:27 (icon_cache_init) *** initializing icon cache
*** /usr/src/debug/hardinfo-git/hardinfo/hardinfo/util.c:744 (module_load) *** gmodule resource for ``/home/camber/aur/hardinfo-git/pkg/hardinfo-git/usr/lib/hardinfo/modules/computer.so'' is (nil) (/home/camber/aur/hardinfo-git/pkg/hardinfo-git/usr/lib/hardinfo/modules/computer.so: undefined symbol: memory_devices_get_system_memory_types_str)
*** /usr/src/debug/hardinfo-git/hardinfo/hardinfo/util.c:811 (module_load) *** cannot g_module_open(``computer.so''). permission problem?
*** /usr/src/debug/hardinfo-git/hardinfo/hardinfo/util.c:813 (module_load) *** loading module computer.so failed: /home/camber/aur/hardinfo-git/pkg/hardinfo-git/usr/lib/hardinfo/modules/computer.so: undefined symbol: memory_devices_get_system_memory_types_str

CamberLoid avatar Oct 08 '22 12:10 CamberLoid