← Back to issue list

Snapcraft fails to prime part containg device files

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1752766
Type
issue
State
closed
Author
~jamesh
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #1976 (commit ef3309f3c) fixed device-node priming by limiting ELF inspection to regular files and symlinks.

Resolution: closed resolved

Reason: The defect was resolved by merged PR #1976, committed as ef3309f3c, which skipped device nodes during ELF inspection. The later revert reference was retracted by the maintainer as a wrong-bug report.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I was recently working on a patch to the core snap, and ran into some travis CI failures that looks like a Snapcraft bug: https://travis-ci.org/snapcore/core/builds/348051901 This appears to be using snapcraft 2.39.3 from xenial-updates, and the end of the log shows the following failure: File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 513, in prime elf_files = elf.get_elf_files(self.primedir, snap_files) File "/usr/lib/python3/dist-packages/snapcraft/internal/elf.py", line 568, in get_elf_files if ElfFile.is_elf(path): File "/usr/lib/python3/dist-packages/snapcraft/internal/elf.py", line 152, in is_elf with open(path, 'rb') as bin_file: OSError: [Errno 6] No such device or address: '/build/prime/dev/midi01' It is trying to open a device file to check whether it looks like an ELF binary. Maybe it should be doing an "os.path.isfile()" check before hand, to check whether it has a regular file or not?

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #1976 (commit ef3309f3c) fixed device-node priming by limiting ELF inspection to regular files and symlinks.
stealth/space-bunny-alpha — closed resolved Device-node priming was fixed by merged PR #1976 (commit ef3309f3c), limiting ELF inspection to regular files and symlinks.
stealth/space-bunny-alpha — closed resolved Fixed via PR #1976: ELF detection now considers only regular files, preventing device nodes from causing failures during priming.
qwen/qwen3.6-35b-a3b — — Closed without a direct fix. Snapcraft crashes when priming parts with device files, throwing an OSError during ELF detection. The bug was likely abandoned or resolved in newer Snapcraft versions.
qwen/qwen3.6-35b-a3b — — Closed without documented resolution. Snapcraft crashes when priming device files by attempting to read them as ELF binaries. The suggested os.path.isfile guard was never implemented or verified in the thread.
qwen/qwen3.6-35b-a3b — — Closed without resolution, likely abandoned. Snapcraft crashed when priming parts containing device files because it attempted to open them as ELF binaries. A file type check was suggested to prevent the error.
qwen3.6-35b-a3b-mtp-q6 — — Closed without documented resolution. Snapcraft crashed when priming device files by attempting to read them as ELF binaries. No patch or workaround was applied.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#1976 (confidence 100%)

    Merged fix for restricting ELF inspection to regular files and symlinks.

Related issues

Issue Project State Summary Similarity
#1838098 snapcraft prime fails if it finds an invalid ELF file snapcraft (launchpad) closed Snapcraft now skips invalid ELF files during priming; PR #2663 was merged in commit 89490853e.
78%
#1660696 Snapcraft is testing file collisions on unbuilt parts snapcraft (launchpad) closed Collision detection ran on not-yet-built parts, causing file-not-found failures (dump plugin with custom build). Fixed by PR #1405 (commit dbdc4b5a6), merged into snapcraft; bug was acknowledged by maintainers.
73%
#1757094 snapcraft in edge channel (2.39.2+git46.c22d7e2) fails to cross-compile kernel snapcraft (launchpad) closed Cross-compile priming was fixed by snapcore/snapcraft#2012, merged as eae356003, skipping ELF dependency and linker checks for non-app snaps such as kernel snaps.
70%