← Back to issue list

Environment is being set for classic snaps

View original Github issue

Metadata

Project
snapcraft
Number
#4187
Type
issue
State
closed
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Classic-confinement snaps no longer receive top-level LD_LIBRARY_PATH and PATH; fixed by merged PR #4216 in commit 9b6e58337.

Resolution: closed resolved

Reason: Snapcraft now omits the default top-level LD_LIBRARY_PATH and PATH for classic-confinement snaps. The fix was merged in PR #4216 as commit 9b6e58337.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description The top level _environment_ with `LD_LIBRARY_PATH` and `PATH` is being set for snaps set to `classic` _confinement_ when using `core22` as a _base_. This can cause application crashes. In previous bases we made use of the `command-chain` and did not export these environment variables when going `classic` ### To Reproduce - Create a `core22` base snap - Set `confinement: classic` - Run `snapcraft prime --shell-after` - Run `grep -A3 '^environment:' ../prime/meta/snap.yaml` to verify that the wrong keywords are there ### Environment N/A ### snapcraft.yaml ```yaml name: snapcraft base: core22 summary: easily create snaps description: | Snapcraft aims to make upstream developers' lives easier and as such is not a single toolset, but instead is a collection of tools that enable the natural workflow of an upstream to be extended with a simple release step into Snappy. adopt-info: snapcraft confinement: classic license: GPL-3.0 assumes: - snapd2.43 apps: snapcraft: environment: PATH: "$SNAP/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # https://github.com/lxc/pylxd/pull/361 PYLXD_WARNINGS: "none" command: bin/python $SNAP/bin/snapcraft completer: snapcraft-completion .... ``` ### Relevant log output ```shell $ cat /snap/snapcraft/current/meta/snap.yaml name: snapcraft version: 7.4.0.post7+gitd67a3d5b summary: easily create snaps description: | Snapcraft aims to make upstream developers' lives easier and as such is not a single toolset, but instead is a collection of tools that enable the natural workflow of an upstream to be extended with a simple release step into Snappy. license: GPL-3.0 architectures: - amd64 base: core22 assumes: - snapd2.43 apps: snapcraft: command: bin/python $SNAP/bin/snapcraft completer: snapcraft-completion environment: PATH: $SNAP/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PYLXD_WARNINGS: none confinement: classic grade: devel environment: LD_LIBRARY_PATH: ${SNAP_LIBRARY_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}:$SNAP/lib:$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH hooks: configure: environment: PATH: $SNAP/bin ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Classic-confinement snaps no longer receive top-level LD_LIBRARY_PATH and PATH; fixed by merged PR #4216 in commit 9b6e58337.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #4216 (commit 9b6e58337): Snapcraft now omits top-level LD_LIBRARY_PATH and PATH for classic-confinement snaps.
qwen/qwen3.6-35b-a3b — — Closed without comments or resolution, likely abandoned. The bug involved incorrect top-level environment variables being applied to classic confinement snaps on core22, causing application crashes.
qwen/qwen3.6-35b-a3b — — Closed without documented resolution. The report detailed incorrect top-level environment variable injection for core22 classic confinement snaps, causing crashes. No fix, comments, or status update were provided.
qwen/qwen3.6-35b-a3b — — Fixed. Snapcraft was updated to stop injecting top-level environment variables for classic core22 snaps, resolving the crash issue.
qwen3.6-35b-a3b-mtp-q6 — — Closed without comments or resolution. Top-level environment variables incorrectly applied to classic core22 snaps were not addressed, indicating the report was abandoned or superseded by later base updates.

Update history

No update history recorded yet.

Related work

Related issues

Issue Project State Summary Similarity
#4216 meta: omit LD_LIBRARY_PATH and PATH in classic confinement snapcraft merged Merged PR #4216 (commit 9b6e58337) omits default LD_LIBRARY_PATH and PATH for classic-confinement snaps, resolving #4187.
80%
#4159 Environment stops working in snapcraft if defined snapcraft closed PATH and LD_LIBRARY_PATH are now retained when top-level environment variables are defined for core22+, via merged PR #3741 (ec190695c).
75%
#1635 snap: remove leaking LD_LIBRARY_PATH snapcraft merged Merged as da9181487: PR #1635 removed LD_LIBRARY_PATH leakage from snapcraft-classic, fixing LP #1723208 and preventing breakage on hosts such as Trusty.
73%
#1656187 Support core path in classic snaps for library paths snapcraft (launchpad) closed Classic-snap core library path support was delivered by merged PR #1047 in commit 6276bca73, including wrapper LD_LIBRARY_PATH handling using /snap/core/current.
72%
#1670749 classic confinement requires manually setting PATH and PYTHONPATH snapcraft (launchpad) open Classic snaps may need explicit PATH/PYTHONPATH, but the reporter and snappy team said this was by design; current metadata handling intentionally omits injected PATH and library paths.
72%