Sometimes I will run two snapcraft cleanbuild
at the same time, usually because one is very long running, and while I wait for it to finish, I want to do something else. This breaks.
alan@hal:~$ snapcraft --version
snapcraft, version 2.33+git39.f820733
alan@hal:~$ lxd --version
2.16
Steps to reproduce
mkdir foo bar
cd foo
snapcraft init
cd ../bar
snapcraft init
Then in two terminals, run snapcraft cleanbuild
a few seconds apart, one in ./foo
and one in ./bar
. One (the first one to be started) will finish successfully. The second will fail with the following issue:-
Looking up assertion ['account-key', 'public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul']
Looking up assertion ['snap-declaration', 'snap-name=core']
Looking up assertion ['snap-revision', 'snap-revision=2462', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776']
Adding assertion core_2462.assert
Installing /run/core_2462.snap
2017-08-28T17:37:42Z INFO cannot auto connect core:core-support-plug to core:core-support: (slot auto-connection), existing connection state "core:core-support-plug core:core-support" in the way
core 16-2.26.14 from 'canonical' installed
Stopping local:snapcraft-oversqueamishly-dispossessory-annmarie
Traceback (most recent call last):
File "/snap/snapcraft/433/bin/snapcraft", line 11, in <module>
load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
File "/snap/snapcraft/433/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/snap/snapcraft/433/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/snap/snapcraft/433/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/snap/snapcraft/433/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
run(prog_name='snapcraft')
File "/snap/snapcraft/433/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/433/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/433/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/snapcraft/433/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/433/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 188, in cleanbuild
lifecycle.cleanbuild(project_options, remote)
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 357, in cleanbuild
metadata=config.get_metadata(), remote=remote).execute()
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 140, in execute
self._inject_snapcraft()
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 185, in _inject_snapcraft
self._inject_snap('snapcraft')
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 214, in _inject_snap
'snap-id={}'.format(id)],
File "/snap/snapcraft/433/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 244, in _inject_assertions
with open(filepath, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/alan/snap/lxd/common/snapcraft.tmp/snapcraft_433.assert'
Looks to me like the “snapcraft.tmp” directory should have a generated name, not a static one.