New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gobjectIntrospection: fix incorrect GIR shared library paths #37381
Conversation
Cherry picked for easy reviewing, does not apply to gobject introspection in master though. |
Failure on aarch64-linux (full log) Attempted: gobjectIntrospection Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: gobjectIntrospection Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: gobjectIntrospection Partial log (click to expand)
|
+ and len(options.fallback_libpath) > 0: | ||
+ match = os.path.join(options.fallback_libpath, match) | ||
+ shlibs.append(match) | ||
+ shlibs.append(os.path.join(options.fallback_libpath, m.group(1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing fallback_libpath
is known to be empty when dealing with absolute paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a component is an absolute path, all previous components are thrown away and joining continues from the absolute path component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested the _ldd_nix_pattern function minimally, and it seemed to do the job :)
When a library path contained the library name it was eagerly matched libfwupd.so.2 => /build/fwupd-1.0.5/build/libfwupd/libfwupd.so.2 (0x00007ffff7bbd000) ^^^^^^^^^^^^^^^^^^^^^^ libgweather-3.so.15 => /build/libgweather-3.28.0/build/libgweather/libgweather-3.so.15 (0x00007ffff7bae000) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ which lead to a broken shared library path in the generated GIR file. This patch allows the soname on the left-hand side of the arrow to be matched to avoid the trap of the right-hand side. A negative lookahead had to be added to select the store path, since only the first match is taken into account. libglib-2.0.so.0 => /nix/store/dqlc8y4phlg1hmdbwkhqfwhnxcac88d1-glib-2.56.0/lib/libglib-2.0.so.0 (0x00007ffff6400000) This will not fix non-GNU platforms, where the soname is not printed first, but we cannot do much without structured ldd output. Closes: NixOS#34988
31d1d1b
to
e468c04
Compare
Motivation for this change
When a library path contained the library name it was eagerly matched
which lead to a broken shared library path in the generated GIR file.
This patch allows the soname on the left-hand side of the arrow to
be matched to avoid the trap of the right-hand side. A negative
lookahead had to be added to select the store path, since only
the first match is taken into account.
This will not fix non-GNU platforms, where the soname is not printed
first, but we cannot do much without structured ldd output.
Closes: #34988
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)cc @hedning