Skip to content

scancode license scan produces invalid yaml #3219

Description

@AyanSinhaMahapatra

Description

Please leave a brief description of the bug or feature request:

scancode license scan now has license references by default, and as license texts
often has whitespace to the left, this leads to invalid yaml output when --license
option is used.

How To Reproduce

Tell us how to reproduce the issue.

From scancode latest develop:

./configure --clean && ./configure --dev
scancode -clipeu --classify --summary samples --yaml output.yaml
python
> import saneyaml
> path = "path/to/output.yaml"
>  data = saneyaml.load(open(path).read())

This results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ayansinha/nexB/write_access/scancode-toolkit/venv/lib/python3.8/site-packages/saneyaml.py", line 62, in load
    return yaml.load(s, Loader=loader)
  File "/home/ayansinha/nexB/write_access/scancode-toolkit/venv/lib/python3.8/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
  File "/home/ayansinha/nexB/write_access/scancode-toolkit/venv/lib/python3.8/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "yaml/_yaml.pyx", line 673, in yaml._yaml.CParser.get_single_node
  File "yaml/_yaml.pyx", line 687, in yaml._yaml.CParser._compose_document
  File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
  File "yaml/_yaml.pyx", line 845, in yaml._yaml.CParser._compose_mapping_node
  File "yaml/_yaml.pyx", line 729, in yaml._yaml.CParser._compose_node
  File "yaml/_yaml.pyx", line 806, in yaml._yaml.CParser._compose_sequence_node
  File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
  File "yaml/_yaml.pyx", line 847, in yaml._yaml.CParser._compose_mapping_node
  File "yaml/_yaml.pyx", line 860, in yaml._yaml.CParser._parse_next_event
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 561, column 9
did not find expected key
  in "<unicode string>", line 600, column 40

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? (Windows/MacOS/Linux) ubuntu 20.04
  • What version of scancode-toolkit was used to generate the scan file? 32.0.0rc1
  • What installation method was used to install/run scancode? (pip/source download/other) source checkout

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions