elf: clear the current runpath before setting the rpath
Metadata
Current evaluation
Merged changes that clear existing RUNPATH before setting RPATH in ELF files, resolving issue #2071. Approved and passed CI.
Suggested action: —
No scores available.
Issue body
Given https://github.com/NixOS/patchelf/issues/94 we may find ourselves
in a situation where given an elf file with an existing RUNPATH, a
proper RPATH may not be set.
Resolve #2071
Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes that clear existing RUNPATH before setting RPATH in ELF files, resolving issue #2071. Approved and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Clears existing RUNPATH before setting RPATH in ELF files, resolving issue #2071 where pre-existing RUNPATH prevented proper RPATH configuration. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to resolve #2071. The change clears an existing RUNPATH before setting RPATH in ELF files, preventing path conflicts during binary patching. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2019 elf: avoid duplicating rpath entries | snapcraft | merged | Merged fix preventing duplicate $ORIGIN rpath entries in ELF binaries. Approved by reviewer, passed unit and integration tests, and updated two files to generate a single rpath entry. | |
| #1781 many: set rpath for elf files for classic | snapcraft | merged | Merged. Configures rpath for ELF files in classic confinement using $ORIGIN and patchelf to eliminate LD_LIBRARY_PATH dependencies, resolving #1663. Approved after resolving CLA checks and transient CI failures. | |
| #1988 elf: only set rpaths to libs of the same arch | snapcraft | merged | Merged after reviewer approval. Fixes LP #1752964 by restricting ELF rpath resolution to libraries matching the target architecture alongside soname, preventing incorrect selection when multiple architectures exist in the core snap. |