stack trace when description or summary contain non-ascii characters

Bug #1737571 reported by Daniel Manrique
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Fix Released
Cris Dywan

Bug Description

I think disallowing non-ASCII characters is by design due to the message I get:

yaml.reader.ReaderError: unacceptable character #x1f4a9: special characters are not allowed
  in "snapcraft.yaml", position 145

This is clear and concise but it comes at the end of a traceback:

Traceback (most recent call last):
  File "/snap/snapcraft/924/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.37', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/924/usr/lib/python3.6/site-packages/pkg_resources/", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/924/usr/lib/python3.6/site-packages/pkg_resources/", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/924/usr/lib/python3.6/site-packages/pkg_resources/", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/924/usr/lib/python3.6/site-packages/pkg_resources/", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/cli/", line 19, in <module>
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/cli/", line 124, in run
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/cli/", line 140, in snap
    project_options, directory=directory, output=output)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 45, in snap
    execute('prime', project_options)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 61, in execute
    config = snapcraft.internal.load_config(project_options)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/internal/project_loader/", line 24, in load_config
    return Config(project_options)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/internal/project_loader/", line 98, in __init__
    snapcraft_yaml = _snapcraft_yaml_load(self.snapcraft_yaml_path)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/snapcraft/internal/project_loader/", line 267, in _snapcraft_yaml_load
    return yaml.load(fp)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 70, in load
    loader = Loader(stream)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 34, in __init__
    Reader.__init__(self, stream)
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 85, in __init__
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 135, in determine_encoding
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 169, in update
  File "/snap/snapcraft/924/lib/python3.6/site-packages/yaml/", line 144, in check_printable
    'unicode', "special characters are not allowed")
yaml.reader.ReaderError: unacceptable character #x1f4a9: special characters are not allowed
  in "snapcraft.yaml", position 145

This message should be friendlier.

I used snapcraft 2.37 from the beta channel snap (revision 924).

Here's my snapcraft.yaml:

name: hello-roadmr-1
version: 2017-12-11-02
summary: say hello more nicely
confinement: strict
grade: stable
description: hello-roadmr's friendly test 💩

  - amd64

    command: echo "hello"

    plugin: nil

Note I've appended a 💩 character to the end of the description.

Interestingly, though, a few emoji *are* accepted; for instance, the snowflake (❄️).

Tags: stacktrace
Cris Dywan (kalikiana)
tags: added: stacktrace
Changed in snapcraft:
assignee: nobody → Christian Dywan (kalikiana)
Cris Dywan (kalikiana)
Changed in snapcraft:
status: New → In Progress
Revision history for this message
Cris Dywan (kalikiana) wrote :

This is an upstream bug - at the same time, we should be handling the error since this exception also applies to characters that are indeed invalid.

Revision history for this message
Cris Dywan (kalikiana) wrote :
Changed in snapcraft:
importance: Undecided → Medium
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.