← Back to issue list

elf: avoid duplicating rpath entries

View original Github issue

Metadata

Project
snapcraft
Number
#2019
Type
pull request
State
merged
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #2019 as commit e7b9d745c, preventing repeated $ORIGIN-based RPATH entries so each needed path appears once.

Resolution: closed resolved

Reason: PR #2019 was merged as commit e7b9d745c. The change deduplicates $ORIGIN-based RPATH entries, with integration tests verifying the corrected ELF output on Xenial and Bionic.

Evaluated by: mr-cal-bot

No scores available.

Issue body

One path is enough for '$ORIGIN' based rpaths. 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`? ----- On `bionic`: ``` (snapcraft) ubuntu@snapcraft-bionic-dev:~/source/snapcraft$ SNAPCRAFT_TEST_KEEP_DATA_PATH=/home/ubuntu/test python3 -m unittest -v -b run tests.integration.general.test_elf.OriginRPATHTestCase run (unittest.loader._FailedTest) ... ok test_origin (tests.integration.general.test_elf.OriginRPATHTestCase) tests.integration.general.test_elf.OriginRPATHTestCase.test_origin ... ok ---------------------------------------------------------------------- Ran 2 tests in 161.552s OK ``` On `xenial`: ``` (snapcraft) ubuntu@snapcraft-xenial-dev:~/source/snapcraft$ SNAPCRAFT_TEST_KEEP_DATA_PATH=/home/ubuntu/test python3 -m unittest -v -b run tests.integration.general.test_elf.OriginRPATHTestCase run (unittest.loader._FailedTest) ... ok test_origin (tests.integration.general.test_elf.OriginRPATHTestCase) tests.integration.general.test_elf.OriginRPATHTestCase.test_origin ... ok ---------------------------------------------------------------------- Ran 2 tests in 163.682s OK ``` And without the fix we see something like ``` $ readelf -d prime/usr/bin/python3 Dynamic section at offset 0x270 contains 31 entries: Tag Type Name/Value 0x000000000000000f (RPATH) Library rpath: [$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN/../../lib/x86_64-linux-gnu:/snap/core/current/lib/x86_64-linux-gnu] ... ``` Instead of ``` $ readelf -d prime/usr/bin/python3 Dynamic section at offset 0x270 contains 31 entries: Tag Type Name/Value 0x000000000000000f (RPATH) Library rpath: [$ORIGIN/../../lib/x86_64-linux-gnu:/snap/core/current/lib/x86_64-linux-gnu] ... ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #2019 as commit e7b9d745c, preventing repeated $ORIGIN-based RPATH entries so each needed path appears once.
stealth/space-bunny-alpha — closed resolved Merged PR #2019 via commit e7b9d745c, deduplicating repeated $ORIGIN-based ELF RPATH entries so each library path appears only once.
qwen/qwen3.6-35b-a3b — — 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.
qwen3.6-35b-a3b-mtp-q6 — — Merged fix preventing duplicate $ORIGIN rpath entries in ELF binaries. The change ensures a single rpath is set, verified by passing integration tests on Bionic and Xenial.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1896 elf: do not strip rpaths that contain $ORIGIN snapcraft merged Merged PR #1896 preserved ELF rpaths containing $ORIGIN during stripping; commit c543156ff implemented the fix.
81%