[Bug 1518150] Re: A Chinese character in the snapcraft.yaml crashes the snapcraft

Sergio Schvezov sergio.schvezov at canonical.com
Tue Dec 1 18:09:49 UTC 2015


With a code point U+20021

We get 
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 33, in <module>
    snapcraft.main.main()
  File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 148, in main
    args.func(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 98, in assemble
    snap(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 79, in snap
    cmd(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 307, in cmd
    config = _load_config()
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 373, in _load_config
    _config = snapcraft.yaml.Config()
  File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 98, in __init__
    self.data = _snapcraft_yaml_load()
  File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 324, in _snapcraft_yaml_load
    return yaml.load(fp)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 70, in load
    loader = Loader(stream)
  File "/usr/lib/python3/dist-packages/yaml/loader.py", line 34, in __init__
    Reader.__init__(self, stream)
  File "/usr/lib/python3/dist-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/usr/lib/python3/dist-packages/yaml/reader.py", line 135, in determine_encoding
    self.update(1)
  File "/usr/lib/python3/dist-packages/yaml/reader.py", line 169, in update
    self.check_printable(data)
  File "/usr/lib/python3/dist-packages/yaml/reader.py", line 144, in check_printable
    'unicode', "special characters are not allowed")
yaml.reader.ReaderError: unacceptable character #x20021: special characters are not allowed
  in "snapcraft.yaml", position 96


** Also affects: pyyaml (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to pyyaml in Ubuntu.
https://bugs.launchpad.net/bugs/1518150

Title:
  A Chinese character in the snapcraft.yaml crashes the snapcraft

Status in Snapcraft:
  Fix Committed
Status in pyyaml package in Ubuntu:
  New

Bug description:
  In my snapcraft.yaml's summay, it contains an unrecoginized unicode
  space (between Piglow and API). When I try to use snapcraft to compile
  my project, it crashes:

  name: piglow2
  version: 1.0
  vendor: XiaoGuo, Liu <xiaoguo.liu at canonical.com>
  summary: Piglow API
  description: This is the webserver API to control the piglow
  icon: icon.png

  services:
    piglow2:
      start: bin/piglow2

  parts:
    piglow:
      plugin: go
      source: ./src/piglow2

  The output is like:

  ubuntu at a5ceb8ea0825:~/work/piglow2$ snapcraft
  Traceback (most recent call last):
    File "/usr/local/bin/snapcraft", line 4, in <module>
      __import__('pkg_resources').run_script('snapcraft==0.5', 'snapcraft')
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 735, in run_script
      self.require(requires)[0].run_script(script_name, ns)
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1652, in run_script
      exec(code, namespace, namespace)
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/EGG-INFO/scripts/snapcraft", line 33, in <module>
      snapcraft.main.main()
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/main.py", line 149, in main
      args.func(args)
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 103, in assemble
      snap(args)
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 85, in snap
      cmd(args)
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 346, in cmd
      config = _load_config()
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/cmds.py", line 412, in _load_config
      _config = snapcraft.yaml.Config()
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/yaml.py", line 97, in __init__
      self.data = _snapcraft_yaml_load()
    File "/usr/local/lib/python3.4/dist-packages/snapcraft-0.5-py3.4.egg/snapcraft/yaml.py", line 312, in _snapcraft_yaml_load
      return yaml.load(fp)
    File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 70, in load
      loader = Loader(stream)
    File "/usr/lib/python3/dist-packages/yaml/loader.py", line 34, in __init__
      Reader.__init__(self, stream)
    File "/usr/lib/python3/dist-packages/yaml/reader.py", line 85, in __init__
      self.determine_encoding()
    File "/usr/lib/python3/dist-packages/yaml/reader.py", line 124, in determine_encoding
      self.update_raw()
    File "/usr/lib/python3/dist-packages/yaml/reader.py", line 178, in update_raw
      data = self.stream.read(size)
    File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
      return codecs.ascii_decode(input, self.errors)[0]

  Attached please find the snapcraft.yaml, and my project is at:

  https://github.com/liu-xiao-guo/piglow2

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapcraft/+bug/1518150/+subscriptions



More information about the foundations-bugs mailing list