← Back to issue list

--debug does not expose appropriate environment variables

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1848513
Type
issue
State
open
Author
~racb
Labels
—
Created
Updated
Closed
—

Current evaluation

The `--debug` failure shell launches bare bash without the failed action's Snapcraft or part environment, preventing faithful command reproduction. The old report remains unlabelled and untriaged.

Suggested action: needs triage

Reason: There are no labels or maintainer comments; the sole comment is the reporter noting that they use `--use-lxd`. Current `launch_shell()` still runs `bash` without supplying the failed action's environment or context, but implementation requires defining which per-part variables and state should be preserved.

Evaluated by: mr-cal-bot

Impact: 42 Quick Win: 10 Complexity: 58 Confidence: 88 Actionability: 57

Issue body

It's great that when a command fails I am dropped into a shell. However if the failing command relied on environment variables, those variables aren't set and so I can't reproduce the same failure. There are two cases when this happens. 1) During an override such as an override-pull, where I expect SNAPCRAFT_* to be set (from https://snapcraft.io/docs/t/environment-variables-that-snapcraft-exposes/7569) 2) Inside a command that snapcraft itself ran. For example, if "snapcraftctl pull" runs "pip install" which fails, I expect to be able to run the command that failed (from the debug output) in the shell and see the same failure. This doesn't happen because the Python-specific environment variables aren't propagated.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 42
Quick Win: 10
Complexity: 58
Confidence: 88
Actionability: 57
needs triage The `--debug` failure shell launches bare bash without the failed action's Snapcraft or part environment, preventing faithful command reproduction. The old report remains unlabelled and untriaged.
stealth/space-bunny-alpha
Impact: 44
Quick Win: 13
Complexity: 57
Confidence: 91
Actionability: 68
needs triage Debug and lifecycle shells still launch plain bash without Snapcraft/part environment context, preventing reliable reproduction; the old, unlabelled report remains untriaged.
stealth/space-bunny-alpha
Impact: 48
Quick Win: 9
Complexity: 70
Confidence: 91
Actionability: 63
needs triage The open, untriaged report identifies missing lifecycle, part, and plugin environment variables in --debug’s shell. Current code launches Bash with only the parent process environment, preventing faithful failure reproduction.
qwen/qwen3.8-27b
Impact: 35
Quick Win: 16
Staleness: 90
Complexity: 55
Confidence: 55
Support Request: 10
close stale Snapcraft --debug drops user into a shell on command failure but does not propagate the environment variables (SNAPCRAFT_* and Python-specific vars) the failing command relied on, so the failure cannot be reproduced. 7 years old, no labels, no maintainer interaction.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 45
Confidence: 80
Support Request: 10
close stale Debug shell fails to preserve SNAPCRAFT_* and Python-specific environment variables, blocking failure reproduction. Untriaged and inactive for over six years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 35
Confidence: 80
Support Request: 10
close stale --debug flag drops into a shell but fails to preserve environment variables, preventing accurate reproduction of build failures. Unaddressed for over 6 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 40
Confidence: 80
Support Request: 10
close stale Snapcraft's --debug mode fails to preserve environment variables when dropping into a shell after command failures, hindering reproduction. Unlabeled, no maintainer response, inactive for ~6.7 years.

Update history

Date Change
created

Related issues

Issue Project State Summary Similarity
#4959 `--debug` does not enter a shell for failures during post-prime or packing snapcraft closed Fixed in Snapcraft 8.4.1: core24 --debug now opens a shell after post-prime or packing failures via craft-application PR #436 (ab55ec81).
72%