Environment keyword not parsed correctly

Bug #1676244 reported by TS on 2017-03-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
High
Unassigned

Bug Description

Found this after testing Kyle's answer here: http://stackoverflow.com/questions/42991501/snapcraft-custom-ld-library-path/43003557#43003557

When using variable interpolation in the `environment` keyword in a snapcraft.yaml like so:

```
environment:
  LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/lapack
  TEST_A: $LD_LIBRARY_PATH:/test
  TEST_B: $SNAP_USER_COMMON:/hello/world
```

The resulting environment variables (obtained by executing `snap run --shell myapp; env`) have some interesting duplication going on:

```
LD_LIBRARY_PATH=:/snap/myapp/x11/usr/lib/lapack::/snap/myapp/x11/usr/lib/lapack/usr/lib/lapack
TEST_A=:/snap/myapp/x11/usr/lib/lapack::/snap/myapp/x11/usr/lib/lapack/usr/lib/lapack:/test
TEST_B=/root/snap/myapp/common:/hello/world:/hello/world
```

The same happens when building the `git` demo (https://github.com/snapcore/snapcraft/blob/master/demos/git/snap/snapcraft.yaml) in `strict` confinement. Results in:

```
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/snap/git/x2/libexec/git-core:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/snap/git/x2/libexec/git-core/libexec/git-core
GIT_TEMPLATE_DIR=/snap/git/x2/share/git-core/templates/share/git-core/templates
```

This only happens when interpolating variables (ie using $PATH, $SNAP etc). Everything is fine when using absolute paths.

TS (geotob) on 2017-03-27
description: updated
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

This got fixed in master https://github.com/snapcore/snapd/commit/3de712bf and will be part of the upcoming stable release 2.24.

Changed in snappy:
importance: Undecided → High
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers