Skip to content
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

extensions: pre/append_dir: support rpath tokens by not using eval #3128

Merged
merged 3 commits into from
May 28, 2020
Merged

extensions: pre/append_dir: support rpath tokens by not using eval #3128

merged 3 commits into from
May 28, 2020

Conversation

merlijn-sebrechts
Copy link
Contributor

@merlijn-sebrechts merlijn-sebrechts commented May 17, 2020

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh tests/unit?

This commit changes the prepend_dir and append_dir functions to not use eval and to not check whether the directory exists when the path contains tokens. This makes it possible to use rpath tokens in the LD_LIBRARY_PATH. These tokens are useful to create paths which support multi-arch apps.

More info about rpath tokens: ld.so man page, Using LD_PRELOAD mixed 64bit/32bit environment in Linux.

These versions of pre/append_dir and rpath tokens are already used in the sommelier-core script to support Wine, which uses both 32-bit and 64-bit libraries when it runs 32-bit windows apps. The PhotoScape snap is built using sommelier-core.

Note about compatibility

This PR makes sure we don't break things when earlier scripts in the command-chain use rpath tokens in LD_LIBRARY_PATH.

However, we can't yet use rpath tokens in LD_LIBRARY_PATH in desktop-helpers itself, because later scripts in the command-chain might still use the old pre/append_dir functions. At least one snap on GitHub uses the old functions together with a gnome extension.

Using rpath tokens in desktop-helpers will thus break backwards compatibility; we can only use it for new extensions and/or new bases.

Note: This PR is another small step towards having better tooling to support 32-bit desktop apps in snapcraft.

This commit changes the prepend_dir and append_dir functions to not use eval
and to not check whether the directory exists when the path contains tokens.

This makes it possible using rpath tokens in the LD_LIBRARY_PATH, so that
it can contain paths which support multi-arch binaries.
@merlijn-sebrechts
Copy link
Contributor Author

merlijn-sebrechts commented May 18, 2020

@sergiusens I don't know why travis keeps failing on the katkin plugin tests. I restarted it about three times now, but I still get the same result. Do you know what's going on here?

@sergiusens
Copy link
Collaborator

Thanks for the commit, the catkin failure seems to be just a 404 on the ROS repo, so probably an archive update (in case you were unaware, the error can be unfolded and inspected, but in any case I have no expectation of you having to know what this unrelated error is all about)

@sergiusens sergiusens added the enhancement New features or optimizations label May 18, 2020
Copy link
Contributor

@cjp256 cjp256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about local -n, neat!

@sergiusens sergiusens added bug Actual bad behavior that don't fall into maintenance or documentation and removed enhancement New features or optimizations labels May 27, 2020
@hellsworth
Copy link

lgtm!! I built this, then used this snapcraft to build photoscape (which uses sommelier-core that implements the rtokens) and all looked fine to me.

@sergiusens sergiusens merged commit 2af888d into canonical:master May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants