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

Lazily copy libraries before modifying and rework add_library() #192

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

JonathonReinhart
Copy link
Owner

@JonathonReinhart JonathonReinhart commented Oct 4, 2021

This PR was motivated by noticing this line:

https://github.com/JonathonReinhart/staticx/blob/159fba33/staticx/api.py#L177

I think this could cause some symlinks to get missed if --strip was passed.

I decided to just re-write this code to be safer, and also only copy libraries lazily before we modify them.

The order of operations looks to be correct:

INFO:root:Processing library libnss_files.so.2 (/lib/x86_64-linux-gnu/libnss_files.so.2)
INFO:root:Adding Symlink libnss_files.so.2 => libnss_files-2.31.so
INFO:root:Copying /lib/x86_64-linux-gnu/libnss_files-2.31.so to /tmp/staticx-archive-4hx7iz7r/libnss_files-2.31.so
INFO:root:Stripping library /tmp/staticx-archive-4hx7iz7r/libnss_files-2.31.so
DEBUG:root:Running ['strip', '/tmp/staticx-archive-4hx7iz7r/libnss_files-2.31.so']
INFO:root:Adding /tmp/staticx-archive-4hx7iz7r/libnss_files-2.31.so as libnss_files-2.31.so

@JonathonReinhart JonathonReinhart merged commit a30e35e into master Oct 4, 2021
@JonathonReinhart JonathonReinhart deleted the lazy-copy-library branch October 4, 2021 03:13
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.

1 participant