Snapcraft does not take the environment variables into account during build
Metadata
Current evaluation
Snap packaging fails when an app command references an app-defined JAVA_HOME; snap pack reports $JAVA_HOME paths as missing. The report has a YAML reproducer and literal-path workaround, but no labels or maintainer discussion.
Suggested action: needs triage
Reason: The issue is still open with no labels or maintainer comments, so it has not been assessed. The supplied YAML reproduces `snap pack` rejecting `$JAVA_HOME/bin/java` as a missing literal path, and the direct-path workaround demonstrates a concrete impact, but whether app-command variable expansion is intended requires maintainer review.
Evaluated by: mr-cal-bot
Impact:
48
Quick Win:
15
Complexity:
62
Confidence:
78
Actionability:
82
Issue body
snapcraft.yaml:
name: test-app
version: dev
summary: TODO summary
description: TODO description
base: core22
grade: devel
confinement: devmode
parts:
app-jar:
source: ./build/libs/
source-type: local
plugin: dump
stage-packages:
- openjdk-17-jdk # TODO headless?
apps:
server:
command: $JAVA_HOME/bin/java -jar app.jar
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
PATH: $JAVA_HOME/bin:$PATH
Build output:
Cannot pack snap file: Command '['snap', 'pack', '--filename', 'test-app_dev_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. (2023/01/09 16:17:11.345666 container.go:215: in snap "test-app": path "$JAVA_HOME" does not exist
2023/01/09 16:17:11.345698 container.go:215: in snap "test-app": path "$JAVA_HOME/bin/java" does not exist
2023/01/09 16:17:11.345702 container.go:215: in snap "test-app": path "$JAVA_HOME/bin" does not exist
error: cannot pack "/root/prime": snap is unusable due to missing files)
Failed to execute pack in instance.
Workaround: the command should not use environment variables.
command: usr/lib/jvm/java-17-openjdk-amd64/bin/java -version
Discussion: https://forum.snapcraft.io/t/simple-java-application/33429/13
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
48
Quick Win:
15
Complexity:
62
Confidence:
78
Actionability:
82
|
needs triage | Snap packaging fails when an app command references an app-defined JAVA_HOME; snap pack reports $JAVA_HOME paths as missing. The report has a YAML reproducer and literal-path workaround, but no labels or maintainer discussion. | |
| stealth/space-bunny-alpha |
Impact:
40
Quick Win:
13
Complexity:
48
Confidence:
76
Actionability:
62
|
needs triage | Needs triage: a core22 Java snap fails to pack when apps.command uses $JAVA_HOME, which snap treats as a literal path. A direct executable path works; a matching Launchpad report remains open. | |
| stealth/space-bunny-alpha |
Impact:
35
Quick Win:
13
Complexity:
50
Confidence:
80
Actionability:
72
|
needs triage | Snap pack rejects $JAVA_HOME in an app command despite declaring JAVA_HOME. The reproducible report remains unassessed, with no confirmed fix or maintainer determination of expected behavior. | |
| stealth/space-bunny-alpha |
Impact:
30
Quick Win:
8
Complexity:
68
Confidence:
90
Actionability:
82
|
needs triage | An open core22 recipe using $JAVA_HOME in apps.server.command fails during snap pack; replacing it with a relative literal path works. No maintainer response or resolution is recorded. | |
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
50
Quick Win:
30
Staleness:
85
Complexity:
40
Confidence:
40
Support Request:
20
|
needs triage | Environment variables in snapcraft command field not expanded during build, causing pack failure | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
20
Confidence:
90
Support Request:
90
|
close not a bug | Snapcraft fails to pack due to unexpanded environment variables in the command field. No maintainer response in over 3.5 years. The behavior is expected, as command environment variables are evaluated at runtime, not during the build phase. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
40
Confidence:
80
Support Request:
10
|
close stale | Snapcraft fails to resolve environment variables in the command field during build. Issue is 3.5 years old with no activity; reporter provided a workaround. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
40
Confidence:
85
Support Request:
10
|
close stale | Reports snapcraft failing to expand environment variables during pack, causing build failures. Unlabelled, zero comments, and inactive for over 3.5 years. Author provided a hardcoded path workaround. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
95
Complexity:
40
Confidence:
85
Support Request:
65
|
close stale | Snapcraft fails to expand environment variables in app commands during build, causing missing path errors. No maintainer response, inactive for over three years. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
No related issues found above the similarity threshold.