elf: remove dependency on magic
Metadata
Current evaluation
Merged PR #1870 in commit d20b9678d, replacing python-magic with readelf for ELF parsing and cleaning up the implementation.
Resolution: closed resolved
Reason: PR #1870 was merged as commit d20b9678d, completing the migration away from python-magic and implementing ELF parsing with readelf.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Migrate to using readelf which we already use and do a general cleanup.
LP: #1742504
- [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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1870 in commit d20b9678d, replacing python-magic with readelf for ELF parsing and cleaning up the implementation. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1870 (commit d20b9678d), replacing python-magic with readelf for ELF parsing and cleaning up the implementation. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #1870 (d20b9678d), replacing the python-magic dependency with readelf for ELF handling and cleaning up the implementation following cross-architecture review. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Replaced python-magic dependency with readelf for ELF parsing, including general code cleanup. Validated across i386, armhf, and arm64 architectures. Approved by reviewer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged replacing python-magic with readelf for ELF parsing. Verified across i386, armhf, and arm64, this update aligns with existing tooling, improves cross-architecture reliability, and avoids pyelfutils maintenance overhead. |
Update history
No update history recorded yet.
Related work
-
Superseded By:
snapcraft#1913
(confidence 96%)
Later merged PR #1913 replaced the readelf implementation with pyelftools while retaining removal of the magic dependency.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2000 elf: remove dead code | snapcraft | merged | Merged PR #2000 in adc0d3692 removed the unused ELF magic-string return after parsing logic moved to ElfFile. | |
| #1742504 magic.mgc, 1: Warning: offset `' invalid | snapcraft (launchpad) | closed | Fixed by merged PR snapcore/snapcraft#1870 (d20b9678d), replacing python-magic ELF detection with readelf and eliminating magic.mgc warnings and architecture-specific crashes. | |
| #1899 elf: readelf dependency | snapcraft | closed | Closed unmerged; its environment-specific readelf dependency work was replaced by merged PR #1902 (d338ef5c7), which used bundled tools when running as a snap. | |
| #1989 elf: don't parse elf more than necessary | snapcraft | merged | Merged #1989 (commit 393ba2c63) to avoid parsing ELF files more than necessary, reducing redundant work for a small performance gain. |