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 791991 - Broken shared-library value in gir files on *BSD when builddir includes the name of the library
Broken shared-library value in gir files on *BSD when builddir includes the n...
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
Other FreeBSD
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Reported: 2017-12-27 18:53 UTC by Ting-Wei Lan
Modified: 2018-01-20 12:04 UTC
See Also:
GNOME target: ---
GNOME version: ---

giscanner: Fix shared library name finding on *BSD (1.24 KB, patch)
2017-12-27 18:59 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2017-12-27 18:53:12 UTC
Sometimes the name of a project includes 'lib', such as libgepub, libgusb, libgxps. If we build them in a directory having the same name as the library, giscanner/ can wrongly match the name of current working directory with _ldd_library_pattern when reading the output of ldd command.

For example, I put the source of libgepub in /home/lantw44/gnome/source/libgepub and build it in /home/lantw44/gnome/build/libgepub. Since the library is named 'libgepub' and the full path of working directory also includes the name 'libgepub', it will match the first line of ldd output, which is the full path to the executable built by g-ir-scanner. This causes library loading to fail when using the typelib because its shared-library attribute is wrong.

This is what I found in Gepub-0.6.gir:

<namespace name="Gepub"

This kind of wrong values can also be found in GXPS-0.1.gir and GUsb-1.0.gir.

On GNU/Linux, the ldd command provided by glibc doesn't print the input filename to output when only one file is specified, so this problem never happen.

On FreeBSD, DragonflyBSD, NetBSD, OpenBSD, the ldd command always print the input filename before showing the list of libraries, so it is possible for the pattern to match the input filename itself before matching libraries.

Here are some ldd output examples.


$ ldd /usr/bin/uptime (0x00007ffefeffa000) => /lib64/ (0x00007feba9118000) => /lib64/ (0x00007feba8e8e000) => /lib64/ (0x00007feba8c8a000) => /lib64/ (0x00007feba88a7000) => /lib64/ (0x00007feba8688000) => /lib64/ (0x00007feba836e000) => /lib64/ (0x00007feba8166000) => /lib64/ (0x00007feba7f40000) => /lib64/ (0x00007feba7d2b000) => /lib64/ (0x00007feba7b02000) => /lib64/ (0x00007feba78eb000)
	/lib64/ (0x00007feba9542000) => /lib64/ (0x00007feba76d6000) => /lib64/ (0x00007feba7452000)


$ ldd /usr/bin/uptime
/usr/bin/uptime: => /lib/ (0x800826000) => /lib/ (0x800a34000) => /lib/ (0x800c37000) => /lib/ (0x800e54000) => /lib/ (0x801068000) => /lib/ (0x801420000)


$ ldd /usr/bin/uptime
/usr/bin/uptime: => /lib/ (0x80045a000) => /lib/ (0x800464000)


$ ldd /usr/bin/uptime
        -lkvm.6 => /usr/lib/
        -lgcc_s.1 => /usr/lib/
        -lc.12 => /usr/lib/
        -lutil.7 => /usr/lib/


        Start            End              Type Open Ref GrpRef Name
        000001ad50200000 000001ad50405000 exe  1    0   0      /usr/bin/uptime
        000001b0294da000 000001b0296e4000 rlib 0    1   0      /usr/lib/
        000001af8ed59000 000001af8f039000 rlib 0    1   0      /usr/lib/
        000001afe9700000 000001afe9700000 rtld 0    1   0      /usr/libexec/
Comment 1 Ting-Wei Lan 2017-12-27 18:59:22 UTC
Created attachment 366025 [details] [review]
giscanner: Fix shared library name finding on *BSD

ldd commands on *BSD always print the name of the input file regardless
of the number of arguments, so we have to ignore this line to avoid
matching it with _ldd_library_pattern.
Comment 2 Ting-Wei Lan 2018-01-13 07:37:25 UTC
Ping ... This problem causes gnome-documents to fail to load EPUB files because it cannot load libgepub.
Comment 3 Ting-Wei Lan 2018-01-18 06:51:27 UTC
Ping again ... I think this is a trivial patch which should not take much time to review.
Comment 4 Emmanuele Bassi (:ebassi) 2018-01-20 10:55:22 UTC
Review of attachment 366025 [details] [review]:

Comment 5 Ting-Wei Lan 2018-01-20 12:04:23 UTC
Attachment 366025 [details] pushed as f9788b2 - giscanner: Fix shared library name finding on *BSD