snapcraft breaks with python app
Metadata
Current evaluation
Snapcraft wrongly rewrote a non-adapter app command into '/usr/bin/python3 $SNAP/...' which snapd rejected. Fixed by merged PR snapcore/snapcraft#2912, shipped in snapcraft 3.10.
Resolution: closed resolved
Reason: PR snapcore/snapcraft#2912 ('meta: do not prime commands with adapter == none', commit f9475e6f1) was merged and made snapcraft leave the command untouched when adapter is "none", avoiding the invalid absolute-path/python-prefixed command. The maintainer confirmed the fix landed as part of snapcraft 3.10.
Evaluated by: mr-cal-bot
No scores available.
Issue body
snapcraft version: 3.9.8, 3.9.9, and edge rev 4046
Following snapcraft.yaml fails to build
Snapcraft is trying to be smart and replaces usr/sbin/netplan with '/usr/bin/python3 $SNAP/usr/sbin/netplan' which then consequently fails internal check:
Failed to generate snap metadata: The specified command '/usr/bin/python3 $SNAP/usr/sbin/netplan' defined in the app 'netplan' does not match the pattern expected by snapd.
The command must consist only of alphanumeric characters, spaces, and the following special characters: / . _ # : $ -
Funny enough if one leave python as part of the snap, following line does pass the check:
'usr/bin/python3 $SNAP/usr/sbin/netplan'
Do we have check that command cannot start with '/' and at the same time auto generate such a command?
Shooting ourselves in own foot?
name: netplan-test
base: core18
version: '0.1'
summary: netplan test
description: |
This is my-snap's description. You have a paragraph or two to tell the
grade: stable
confinement: strict
parts:
netplan:
plugin: nil
stage-packages:
- netplan.io
stage:
- lib/netplan
- usr/sbin/netplan
- usr/share/netplan
apps:
netplan:
adapter: none
command: usr/sbin/netplan
environment:
PYTHONPATH: /usr/lib/python3/dist-packages:$PYTHONPATH
plugs:
- network
- network-bind
- network-setup-control
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft wrongly rewrote a non-adapter app command into '/usr/bin/python3 $SNAP/...' which snapd rejected. Fixed by merged PR snapcore/snapcraft#2912, shipped in snapcraft 3.10. | |
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft stopped rewriting commands when adapter is none, fixing Python/netplan command validation. Merged in #2912 (f9475e6f1) and released in Snapcraft 3.10. | |
| stealth/space-bunny-alpha | — | closed stale | The Python-app command validation issue was closed without a verified resolving PR or commit. The original report concerned an absolute interpreter path inserted by Snapcraft. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Snapcraft incorrectly auto-generated a command path starting with a slash, causing snapd validation failures. The report received no comments and was abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Snapcraft auto-generated invalid command paths starting with `/` for Python apps, causing snapd validation failures. No fix, discussion, or follow-up was provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned. Snapcraft incorrectly auto-generated a command path for a Python app, causing snapd validation failures. No fix was provided. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Abandoned. Snapcraft incorrectly auto-generates command paths starting with a slash for Python apps, triggering snapd validation failures. The report was closed without resolution due to inactivity. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#2912
(confidence 95%)
Merged PR cited in the closing comment; preserves command for adapter: none apps and adds unit/spread tests for none and python script cases.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1602379 'snapcraft' and 'snapcraft-parser' need to use '#!/usr/bin/env python3' in the shebang line | snapcraft (launchpad) | closed | Updated snapcraft and snapcraft-parser to use #!/usr/bin/env python3 via merged PR snapcore/snapcraft#649 (commit c156f111c). | |
| #1778716 snapcraft clean snapcraft fails as it cannot find python | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft PR #2171, which corrected Python plugin cleanup so `snapcraft clean snapcraft` no longer fails when python3 is unavailable. |