Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment is being set for classic snaps #4187

Closed
sergiusens opened this issue Jun 1, 2023 · 0 comments · Fixed by #4216
Closed

Environment is being set for classic snaps #4187

sergiusens opened this issue Jun 1, 2023 · 0 comments · Fixed by #4216
Labels
bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@sergiusens
Copy link
Collaborator

sergiusens commented Jun 1, 2023

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

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

$ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant