-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Overwrite soname in place if there is room #159
base: master
Are you sure you want to change the base?
Conversation
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.
This worked for me, thanks.
Cliff Woolley
NVIDIA Corp
Any reason this was not merged? |
It would be great if you can create a regression test case in tests directory. |
@domenkozar I agree 100%. Is there documentation on how to run the tests and how to write a new one? I didn't see anything at first glance. I don't have much time for this, and I apologize for that, but I don't see me adding a test unless it's very clear and straightforward. Thanks for your hard work on patchelf! It's extremely useful for us. |
OK, thanks for your help. |
@reidpr if you provide a binary and a small bash script to call patchelf and assert it works (and confirm it doesn't with the old patchelf) that should be sufficient. |
issue #44. */ | ||
if (newSoname.size() <= sonameSize) { | ||
debug("overwriting old SONAME with new...\n"); | ||
strcpy(soname, newSoname.c_str()); |
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.
Since we already know the size of newSoname
, memcpy is the better choice:
strcpy(soname, newSoname.c_str()); | |
memcpy(soname, newSoname.c_str(), newSoname.size() + 1); |
debug("overwriting old SONAME with new...\n"); | ||
strcpy(soname, newSoname.c_str()); | ||
changed = true; | ||
return; |
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.
This functionality will have to change now @reidpr
I introduced new changes that always do this->rewriteSections();
after each changed = true
This is to support multiple commands on a single invocation.
I agree that this is not an ideal tracking each return
.
I would like to figure out how to do a destructor for each method and then apply this->rewriteSections();
only if changed == true
.
Either way this code will produce errors for now if done with other commands.
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 opened https://github.com/NixOS/patchelf/pull/363/files# to help make this simpler.
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.
Hello, thanks for the heads up. I still hope (after 3 years) this PR will get merged, but I don't have time to maintain it.
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.
Please see my latest message.
This addresses issue #44 for the case where the new soname is the same or shorter than the old.
It's not great code. I'm not a C++ programmer, and I couldn't figure out how to make the overwrite idiomatic. So, it uses C string functions.
But, it does work for us.