-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Description
File contains the following line:
LicenseConcluded: LicenseRef-foo/bar
which is invalid due to the slash.
This results in a big ugly error.
The exception should be catched.
pyspdxtools -i slash.spdx
Traceback (most recent call last):
File "/opt/homebrew/bin/pyspdxtools", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/clitools/pyspdxtools.py", line 61, in main
document: Document = parse_file(infile)
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/parse_anything.py", line 25, in parse_file
return tagvalue_parser.parse_from_file(file_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/tagvalue/tagvalue_parser.py", line 12, in parse_from_file
document: Document = parser.parse(data)
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/tagvalue/parser.py", line 524, in parse
self.yacc.parse(text, lexer=self.lex)
File "/opt/homebrew/lib/python3.11/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/tagvalue/parser.py", line 236, in p_license
p[0] = get_spdx_licensing().parse(p[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 540, in parse
tokens = list(self.tokenize(
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 604, in tokenize
for token in tokens:
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 997, in replace_with_subexpression_by_license_symbol
for token_group in token_groups:
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 936, in build_token_groups_for_with_subexpression
tokens = list(tokens)
^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 598, in <genexpr>
tokens = (t for t in tokens if t.string and t.string.strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 922, in build_symbols_from_unknown_tokens
for symtok in build_token_with_symbol():
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 902, in build_token_with_symbol
toksym = LicenseSymbol(string)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/license_expression/__init__.py", line 1214, in __init__
raise ExpressionError(
license_expression.ExpressionError: Invalid license key: the valid characters are: letters and numbers, underscore, dot, colon or hyphen signs and spaces: 'LicenseRef-foo/bar'
maxhbr
Metadata
Metadata
Assignees
Labels
No labels