Skip to content

Better rpath fix #790

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

Merged
merged 2 commits into from
Jan 21, 2023
Merged

Better rpath fix #790

merged 2 commits into from
Jan 21, 2023

Conversation

yosifkit
Copy link
Member

This reverts #785 and then only changes rpath for python3.x binaries and not the libraries in /usr/local/lib/python3.x/lib-dynload/ since they use system libraries like libssl (so $ORIGIN/../lib doesn't work for them).

Hopefully this should also fix issues like #786 or #787

Broken, current version:

$ docker run -it --rm python:3.9 bash
root@8f5b65b7cd6b:/# readelf --dynamic /usr/local/lib/python3.9/lib-dynload/_ssl.cpython-39-x86_64-linux-gnu.so

Dynamic section at offset 0x24d58 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/../lib:$ORIGIN/../lib]
...
root@8f5b65b7cd6b:/# # but ldd somehow still works 🤷
root@8f5b65b7cd6b:/# ldd /usr/local/lib/python3.9/lib-dynload/_ssl.cpython-39-x86_64-linux-gnu.so
	linux-vdso.so.1 (0x00007fff459dd000)
	libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fabee010000)
	libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fabedd1c000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fabedcfa000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fabedb25000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fabedb1f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fabee0da000)

\
# https://github.com/docker-library/python/issues/784
# prevent accidental usage of a system installed libpython of the same version
bin="$(readlink -ve /usr/local/bin/python3)"; \
Copy link
Member

Choose a reason for hiding this comment

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

+ readlink -ve /usr/local/bin/python3
readlink: unrecognized option: e
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.

Usage: readlink [-fnv] FILE

Display the value of a symlink

	-f	Canonicalize by following all symlinks
	-n	Don't add newline
	-v	Verbose
+ bin=

Classic BusyBox 😄

Not the libraries in /usr/local/lib/python3.x/lib-dynload/ since they use system libraries like libssl (so `$ORIGIN/../lib` doesn't work for them)
@tianon tianon merged commit 6aba522 into docker-library:master Jan 21, 2023
@tianon tianon deleted the better-rpath branch January 21, 2023 00:27
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Jan 21, 2023
Changes:

- docker-library/python@6aba522: Merge pull request docker-library/python#790 from infosiftr/better-rpath
- docker-library/python@a1af335: Only change rpath for python3.x binary
- docker-library/python@5de3a27: Revert "Fix path to libpython shared-library in python binaries"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants