← 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

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.

Suggested action: close stale

Reason: The issue is ~7 years old (2510 days) with zero comments, no labels, and no maintainer interaction, and it references snapcraft 1.x-era concepts (snapcraftctl pull, override-pull) that no longer exist in the current craft-parts/craft-application-based architecture. The --debug shell behavior is now implemented in craft-application (acad93da 'feat: implement, --shell, --shell-after, --debug'), so the original reproduction context is from an unsupported version and the specific scenario is no longer applicable as written.

Impact: 35 Quick Win: 15.75 Staleness: 90 Complexity: 55 Confidence: 55 Support Request: 10

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
qwen/qwen3.8-27b
Impact: 35
Quick Win: 15.75
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 40
Confidence: 90
Support Request: 10
close stale Snapcraft's --debug mode fails to preserve environment variables when dropping into a shell after a command failure, hindering reproduction. Unlabelled and inactive for ~6.7 years.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1917639 --debug drops me into an unexpected directory snapcraft (launchpad) open Snapcraft 4.5.1 --debug drops the user into /root instead of the override-stage script's working directory. Reported ~5.5 years ago, zero comments, no labels, no maintainer interaction. Related Launchpad bugs 1848513 (env vars) and 1848732 (snapcraftctl) still open.
78%
#1784372 snapcraft and other snap commands don't support a --debug for behind the scenes debugging information snapcraft (launchpad) open Feature request (2018) for a --debug flag on snapcraft/snap CLI commands to expose backend API/network activity for diagnosing hangs. Unlabelled, zero comments, no maintainer engagement in ~7 years. Current code already offers unified verbosity levels (quiet/brief/verbose/debug/trace) via --verbose/--verbosity/CRAFT_VERBOSITY_LEVEL and a --debug shell option, largely superseding the ask.
73%