elf: add elf file handler class
Metadata
Current evaluation
PR #3839 was merged into main as commit 6830dc69c, porting the Snapcraft 6.x ElfFile handler into snapcraft/elf/_elf_file.py with helpers, ELF errors, and unit tests (CRAFT-1192).
Resolution: closed resolved
Reason: The pull request was approved and merged into main; commit 6830dc69c ("elf: add elf file handler class (#3839)") introduced snapcraft/elf/_elf_file.py with the ElfFile class, later consumed by elf_utils and the library linter.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Add a class that represents and provides helpers to extract basic
information from ELF files. This is a port of the corresponding
class from Snapcraft 6.x.
Co-authored-by: Kyle Fazzari <kyrofa@ubuntu.com>
Co-authored-by: James Henstridge <james@jamesh.id.au>
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-1192
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | PR #3839 was merged into main as commit 6830dc69c, porting the Snapcraft 6.x ElfFile handler into snapcraft/elf/_elf_file.py with helpers, ELF errors, and unit tests (CRAFT-1192). | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in PR #3839 (6830dc69c), adding an ELF file handler and helpers to extract basic ELF information, ported from Snapcraft 6.x. | |
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged an ELF file handler class to extract basic ELF information, ported from Snapcraft 6.x. The author addressed feedback, rebased on main, and passed all checks. The merge increased code coverage by 0.46%. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#3871
(confidence 45%)
5ec2faf8a (meta: get content provider dirs from snap metadata, #3871) soon after touched the elf package for provider dirs.
-
Related To:
canonical/snapcraft#4075
(confidence 40%)
a6bb3bf1b later adjusted patchelf test mocking for the new ElfFile dependency loading.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3841 elf: add elf file patcher | snapcraft | merged | Merged PR #3841 in commit e03a971b3, adding a patchelf-based ELF file patcher ported from Snapcraft 6.x for CRAFT-1191. | |
| #2663 elf: handle invalid elf files | snapcraft | merged | PR #2663 merged as commit 89490853e: snapcraft/elf/elf_utils.py now catches elftools ELFError (and CorruptedElfFile) during dependency scanning and silently skips invalid ELF files, with a regression test for LP #1838098. | |
| #75 refactor: rewrite elf file support | debcraft | merged | Merged as c841273, replacing Snapcraft-derived ELF handling with deb-oriented library dependency support. Symbol support was deferred to follow-up work. | |
| #3840 elf: add handling and patching helpers | snapcraft | merged | Merged in snapcore/snapcraft#3840 via commit 8a9914510, adding helpers to enumerate ELF binaries and locate architecture-specific dynamic linkers. | |
| #1913 elf: pyelftools to parse ELF files rather than readelf | snapcraft | merged | Merged PR #1913 (commit 9e4e88629): snapcraft.internal.elf.ElfFile now parses ELF files with pyelftools instead of shelling out to readelf, handling weak refs outside DT_NEEDED; cut test build times roughly in half. | |
| #2929 elf: fixes for corrupt shared objects | snapcraft | merged | Merged PR snapcore/snapcraft#2929 (commit 051f24e07, Feb 2020) catching elftools ConstructErrors as CorruptedElfFileError and skipping corrupt shared objects during library crawling. | |
| #72 Refactor ELF file handling | debcraft | closed | ELF handling was rewritten for Debcraft’s .deb workflow in merged PR #75 (commit c841273), replacing Snapcraft-derived code with shared-library dependency support; symbol handling was deferred. | |
| #1744 elf: conversion from libraries | snapcraft | merged | Merged as ec7ba948a: converted snapcraft/internal/libraries.py into ELF-focused elf.py with type hints and mypy fixes, fixing #1666. Reviewer syntax/lint concerns were handled by follow-up PR #1745 (flake8 upgrade). |