snapcraft clean crashes on snapcraft.yaml with bad indent
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
snapcraft felt it was important I share this with you :-)
Running snapcraft on Ubuntu 19.04.
$ snapcraft --version
snapcraft, version 2.43.1+18.10
The log:
$ snapcraft clean
Sorry, an error occurred in Snapcraft:
Traceback (most recent call last):
File "/usr/bin/
load_
...
File "/usr/lib/
while not self.check_
File "/usr/lib/
self.
File "/usr/lib/
"expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.
in "snapcraft.yaml", line 19, column 3
expected <block end>, but found '<block mapping start>'
in "snapcraft.yaml", line 36, column 4
We would appreciate it if you created a bug report at
https:/
The snapcraft.yaml provoking the crash (note the inconsistent indent level between the two parts):
name: fpm
version: 1.1
summary: Effing Package Management
description: |
Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://
grade: devel
confinement: devmode
apps:
fpm:
environment:
RUBYLIB: $SNAP/usr/
GEM_HOME: $SNAP/gems
GEM_PATH: $SNAP
command: ruby $SNAP/bin/fpm
parts:
fpm:
source: .
plugin: nil
build-packages:
- build-essential
- ruby-dev
- rubygems-
- libreadline-dev
- libssl-dev
- libtinfo-dev
stage-packages:
- ruby
- rubygems-
override-build: |
snapcraftctl build
gem install fpm -i $SNAPCRAFT_
mangle-shebang:
plugin: nil
after: [fpm]
override-build: |
snapcraftctl build
sed -i 's/#!\/
Removing the extra space at the start of the 'mangle-shebang:' line worked around the problem
I believe I am experiencing the same bug:
Sorry, an error occurred in Snapcraft: snapcraft" , line 11, in <module> entry_point( 'snapcraft= =2.43.1+ 18.4', 'console_scripts', 'snapcraft')() python3/ dist-packages/ click/core. py", line 722, in __call__ python3/ dist-packages/ click/core. py", line 697, in main python3/ dist-packages/ click/core. py", line 1043, in invoke invoke( self, ctx) python3/ dist-packages/ click/core. py", line 895, in invoke self.callback, **ctx.params) python3/ dist-packages/ click/core. py", line 535, in invoke python3/ dist-packages/ click/decorator s.py", line 17, in new_func context( ), *args, **kwargs) python3/ dist-packages/ snapcraft/ cli/_runner. py", line 93, in run forward( lifecyclecli. commands[ "snap"] ) python3/ dist-packages/ click/core. py", line 553, in forward python3/ dist-packages/ click/core. py", line 535, in invoke python3/ dist-packages/ snapcraft/ cli/lifecycle. py", line 136, in snap steps.PRIME, parts=[], **kwargs) python3/ dist-packages/ snapcraft/ cli/lifecycle. py", line 30, in _execute **kwargs) python3/ dist-packages/ snapcraft/ cli/_options. py", line 68, in get_project yaml_file_ path=snapcraft_ yaml_file_ path, python3/ dist-packages/ snapcraft/ project/ _project. py", line 48, in __init__ snapcraft_ yaml_file_ path=snapcraft_ yaml_file_ path) python3/ dist-packages/ snapcraft/ project/ _project_ info.py" , line 32, in __init__ __raw_snapcraft = _load_yaml( yaml_file_ path=snapcraft_ yaml_file_ path) python3/ dist-packages/ snapcraft/ project/ _project_ info.py" , line 65, in _load_yaml python3/ dist-packages/ yaml/__ init__. py", line 94, in safe_load python3/ dist-packages/ yaml/__ init__. py", line 72, in load get_single_ data() python3/ dist-packages/ yaml/constructo r.py", line 35, in get_single_data single_ node() python3/ dist-packages/ yaml/composer. py", line 36, in get_single_node document( ) python3/ dist-packages/ yaml/composer. py", line 55, in compose_document node(None, None) python3/ dist-packages/ yaml/composer. py", line 84, in compose_node mapping_ node(anchor) python3/ dist-packages/ yaml/composer. py", line 133, in compose_ mapping_ node node(node, item_key) python3/ dist-packages/ yaml/composer. py", line 84, in compose_node
Traceback (most recent call last):
File "/usr/bin/
load_
File "/usr/lib/
return self.main(*args, **kwargs)
File "/usr/lib/
rv = self.invoke(ctx)
File "/usr/lib/
return Command.
File "/usr/lib/
return ctx.invoke(
File "/usr/lib/
return callback(*args, **kwargs)
File "/usr/lib/
return f(get_current_
File "/usr/lib/
ctx.
File "/usr/lib/
return self.invoke(cmd, **kwargs)
File "/usr/lib/
return callback(*args, **kwargs)
File "/usr/lib/
project = _execute(
File "/usr/lib/
project = get_project(
File "/usr/lib/
snapcraft_
File "/usr/lib/
self.info = ProjectInfo(
File "/usr/lib/
self.
File "/usr/lib/
yaml_contents = yaml.safe_load(fp) # type: ignore
File "/usr/lib/
return load(stream, SafeLoader)
File "/usr/lib/
return loader.
File "/usr/lib/
node = self.get_
File "/usr/lib/
document = self.compose_
File "/usr/lib/
node = self.compose_
File "/usr/lib/
node = self.compose_
File "/usr/lib/
item_value = self.compose_
File "/usr/lib/
node = self.compose_ma...