← Back to issue list

fix(linter): skip foreign-arch ELF files in library linter

View original Github issue

Metadata

Project
snapcraft
Number
#6249
Type
pull request
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Adds elf_machine to _ArchConfig and get_host_elf_machine() to elf_utils.py, and skips foreign-arch ELF files in the library linter to avoid QEMU segfaults and multi-GB core dumps. Unreviewed ~3.5 months; CLA check failing; issue #4373 still open.

Suggested action: needs review

Reason: The underlying bug is still live on main: library_linter.py still calls load_dependencies() on every ELF file with no arch check, and issue #4373 remains open, so the PR is not stale-irrelevant. However it has had zero reviewer engagement for ~3.5 months (last activity 107 days ago, 0 comments, 0 reviewers), carries 6 unresolved review comments, and the Canonical CLA CI check is failing — a maintainer needs to review and unblock it.

Impact: 50 Quick Win: 30.0 Staleness: 60 Complexity: 40 Confidence: 80

Issue body

The library linter calls load_dependencies() on every ELF file found in the prime directory. For foreign-arch builds (e.g. arm64 snap on an amd64 host) this invokes QEMU via binfmt to run the foreign binary, which fails with 'not a dynamic executable' errors and can SEGFAULT, producing multi-gigabyte core dumps. Add elf_machine field to _ArchConfig and get_host_elf_machine() to elf_utils.py. In library_linter.run(), skip any ELF file whose arch_tuple[2] (e_machine) does not match the host's expected value. Fixes: https://github.com/canonical/snapcraft/issues/4373 --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [ ] I've added or updated any relevant documentation. - [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing. - [ ] I've updated the relevant release notes.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30.0
Staleness: 60
Complexity: 40
Confidence: 80
needs review Adds elf_machine to _ArchConfig and get_host_elf_machine() to elf_utils.py, and skips foreign-arch ELF files in the library linter to avoid QEMU segfaults and multi-GB core dumps. Unreviewed ~3.5 months; CLA check failing; issue #4373 still open.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 20
Confidence: 85
needs review Adds architecture check to library linter to skip foreign-arch ELF files, preventing QEMU crashes and core dumps. Currently pending maintainer review with 6 unresolved comments and a failing CLA check.
qwen3.6-35b-a3b-mtp-q6
Staleness: 15
Complexity: 20
Confidence: 90
needs review Fixes a linter crash and SEGFAULT when processing foreign-arch ELF files by skipping mismatched architectures. Ready for review with passing tests.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 20
Confidence: 85
needs review Fixes library linter segfaults on foreign-arch builds by skipping ELF files that do not match the host architecture. The pull request passes all checks, has zero comments, and is awaiting review.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#4373 (confidence 90%)

    PR body explicitly states 'Fixes: canonical/snapcraft#4373'; issue is still open and the fix is not present in main, so this PR is the pending implementation of that fix.

Related issues

Issue Project State Summary Similarity
#4373 library linter fails on foreign archs and can't be disabled for core20 snapcraft open Snapcraft's library linter fails on foreign-arch ELF files (cross-compile) and cannot be disabled on core20, causing build failures and multi-GB core dumps. Triaged with a maintainer note to check ELF target arch; no fix landed yet.
76%