pluginhandler: support using patchelf on strict snaps
Metadata
Current evaluation
Adds enable-patchelf build attribute to opt into rpath and interpreter patching for strict snaps. Feature applies per-part. Review resolved naming and command-chain handling. Merged following a commit revert.
Suggested action: —
No scores available.
Issue body
- [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] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
Patchelf is automatically used on classic snaps to patch the rpath and interpreter of ELF files in the snap to find things in the snap itself without requiring LD_LIRARY_PATH to be set, etc. This is usually desired, but in the cases that it's not, the snapcraft CLI supports a `no-patchelf` build attribute to disable this behavior.
There are situations where strictly-confined snaps could benefit from this behavior as well (e.g. content sharing, plugin models, etc.). Add a new build attribute called `enable-patchelf` to opt in to rpath and interpreter patching in a strictly-confined snap.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Adds enable-patchelf build attribute to opt into rpath and interpreter patching for strict snaps. Feature applies per-part. Review resolved naming and command-chain handling. Merged following a commit revert. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Introduces the enable-patchelf build attribute to allow rpath and interpreter patching in strictly-confined snaps. Applied per-part, it replaces no-patchelf with disable-patchelf for naming parity and adjusts command-chain generation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Introduces an enable-patchelf build attribute to opt into rpath and interpreter patching for strictly-confined snaps. Implementation supports part-by-part configuration and adjusts command-chain behavior following naming and scope discussions. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1987 pluginhandler: add option to disable patchelf for a part | snapcraft | merged | Merged an update to the pluginhandler introducing an option to disable patchelf for a specific part. Approved by one reviewer, passed all tests, and applied with 53 additions and 4 deletions across five files. | |
| #1850 pluginhandler: patch and handle elf files on glibc mismatch | snapcraft | merged | Merged. Resolves glibc mismatches in ELF files by fetching libc6 from the host, priming it, and using its dynamic loader instead of the base snap's. Approved by two reviewers and closes issues #1668 and #1669. | |
| #1967 project_loader: improve the logic to install patchelf as a build tool | snapcraft | merged | Merged changes improving patchelf installation logic by excluding it on xenial/armhf and xenial/s390x due to broken builds. Users must provide it manually or use the build-snap. Approved and merged after clarifying error handling and architecture exclusions. | |
| #1888 elf: make patchelf a dependency | snapcraft | merged | Merged after reviewer approval and CI checks. The change corrects patchelf handling by removing it from build_tools and properly configuring it as a dependency via debian/control for deb packages and snapcraft bundling for snaps. | |
| #2005 pluginhandler: special case go patchelf failures for classic confinement | snapcraft | merged | Merged. Adds a warning for patchelf failures in classic confinement Go snaps and cleans up bases/libc6 logic. Approved after reviewer questions regarding patchelf crash output were addressed. | |
| #2012 pluginhandler: only do elf checking and patching for type app | snapcraft | merged | Merged changes restricting ELF checking and patching to app-type snaps, removing unnecessary libc6 ABI/API checks for other types. Resolves LP: #1757094. Approved and passed CI. | |
| #2021 pluginhandler: only resort to elf mangling if the snap type is app | snapcraft | merged | Merged a fix restricting ELF mangling to app-type snaps only. Approved, passed CI, and updated one file with 12 additions and 4 deletions. |