elf: add handling and patching helpers
Metadata
Current evaluation
Merged into main following reviewer approval and passing CI checks. Introduces ELF binary listing and dynamic linker location helpers, adding handling and patching utilities to the elf module while increasing test coverage.
Suggested action: —
No scores available.
Issue body
Implement functions to list ELF binaries in a given directory and to
locate the ELF dynamic linker.
Co-authored-by: Kyle Fazzari <kyrofa@ubuntu.com>
Co-authored-by: Chris Patterson <chris.patterson@canonical.com>
Co-authored-by: Sergio Schvezov <sergio.schvezov@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@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] Have you successfully run `make lint`?
- [x] Have you successfully run `pytest tests/unit`?
-----
CRAFT-1190
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged into main following reviewer approval and passing CI checks. Introduces ELF binary listing and dynamic linker location helpers, adding handling and patching utilities to the elf module while increasing test coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Introduces ELF binary listing and dynamic linker location helpers. Co-authored by Kyle Fazzari, Chris Patterson, and Sergio Schvezov. The merge increased overall coverage by 0.09% with 92.68% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Adds ELF handling and patching helpers to list binaries and locate the dynamic linker. Co-authored by Fazzari, Patterson, and Schvezov. Increased overall coverage by 0.09%. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3839 elf: add elf file handler class | snapcraft | merged | Merged into main. Introduces an ELF file handler class with extraction helpers, ported from Snapcraft 6.x. Approved by a reviewer, rebased on main, and merged with a 0.46% test coverage increase. | |
| #3841 elf: add elf file patcher | snapcraft | merged | Merged an ELF file patcher using patchelf, ported from Snapcraft 6.x. Approved by one reviewer, passed CI checks, and increased test coverage by 0.26%. Resolves CRAFT-1191. | |
| #2746 elf: handle missing dependencies not found on system | snapcraft | merged | Merged updates to handle missing ELF dependencies when ldd fails to resolve them. The change prevents filtering unresolved libraries, refactors ldd parsing for reliability, and adds unit tests. Approved by one reviewer and passed CI checks. | |
| #3985 elf: patch elf files for classic mode | snapcraft | merged | Merged into main. Patches ELF binaries for classic mode to use the base snap interpreter and libraries, or bundled components if libc is staged, when enable-patchelf is enabled. Approved, passed CI, and merged. | |
| #1873 elf: cleaner patchelf experience | snapcraft | merged | Merged improvements to patchelf handling. The change uses the system patchelf by default, copies files to prevent hard-link conflicts, and provides fallback instructions. Approved by two reviewers and passed CI checks before merging. | |
| #2663 elf: handle invalid elf files | snapcraft | merged | Merged changes to handle invalid ELF files by catching elftools exceptions and silently ignoring them. Includes a regression test, passed CI, and achieved 100% diff coverage. Resolves LP #1838098. | |
| #1979 pluginhandler: simplify logic when elf patching is required | snapcraft | merged | Merged changes simplifying ELF patching logic in the pluginhandler. The update reduced code by 38 lines across six files, received reviewer approval, and passed checks before integration. | |
| #1798 elf: strip the .note.go.buildid to make room for patching elf | snapcraft | merged | Merged. Strips the .note.go.buildid section from ELF binaries to resolve patchelf compatibility issues and fix build failures. Approved after passing CI checks. Introduces a newer patchelf build-snap dependency to ensure correct header patching. | |
| #1989 elf: don't parse elf more than necessary | snapcraft | merged | Merged a single-line change optimizing ELF parsing to avoid unnecessary work, yielding a minor performance improvement. Approved by a maintainer and passed CI checks. | |
| #1950 elf: better debug messages | snapcraft | merged | Merged pull request polishing ELF debug messages for linker and library exclusion checks. Changes eliminate repetitive logging and reduce unnecessary calls. Approved by reviewers, passed CI, and successfully integrated. |