I've noticed a bug while trying to amend an SBOM generated with the Conan cyclonedx tool with license data from the Conan _collected_license_files
(using conan install --deployer=licenses
) on Windows. On Linux it seems to run without any problems (tested on Ubuntu). I've attached a reduced file set that will reproduce this error.
Error on Windows:
WARNING: License text not found - No text for the license (Unrar), in component (PURL[pkg:conan/[email protected]]), was found. An empty string was added as text.
INFO: License text added - The text of the license (CppTest_EULA), in component (PURL[pkg:conan/[email protected]]), was added.
INFO: License text added - The text of the license (License_Jlink), in component (PURL[pkg:conan/[email protected]]), was added.
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Appl\Python\Lib\site-packages\cdxev_main.py", line 631, in
sys.exit(main())
^^^^^^
File "C:\Appl\Python\Lib\site-packages\cdxev_main.py", line 40, in main
return args.cmd_handler(args)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Appl\Python\Lib\site-packages\cdxev_main_.py", line 462, in invoke_amend
amend(sbom, args.license_path)
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\command.py", line 32, in run
walk_components(sbom, _do_amend, skip_meta=True)
File "C:\Appl\Python\Lib\site-packages\cdxev\auxiliary\sbomFunctions.py", line 307, in walk_components
_recurse(sbom["components"], func, *args, **kwargs)
File "C:\Appl\Python\Lib\site-packages\cdxev\auxiliary\sbomFunctions.py", line 296, in _recurse
func(component, *args, **kwargs)
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\command.py", line 55, in _do_amend
operation.handle_component(component)
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\operations.py", line 230, in handle_component
process_license(
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\process_license.py", line 90, in process_license
add_text_from_folder_to_license_with_name(
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\process_license.py", line 152, in add_text_from_folder_to_license_with_name
license_text = get_license_text_from_folder(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Appl\Python\Lib\site-packages\cdxev\amend\process_license.py", line 211, in get_license_text_from_folder
license_text = f.read()
^^^^^^^^
File "C:\Appl\Python\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 219: character maps to
Output on Linux:
WARNING: License text not found - No text for the license (Unrar), in component (PURL[pkg:conan/[email protected]]), was found. An empty string was added as text.
INFO: License text added - The text of the license (CppTest_EULA), in component (PURL[pkg:conan/[email protected]]), was added.
INFO: License text added - The text of the license (License_Jlink), in component (PURL[pkg:conan/[email protected]]), was added.
INFO: License text added - The text of the license (SLA0048), in component (PURL[pkg:conan/stm32cubeprog]), was added.
Writing output to: My application_1.0.0_20240423T061253.cdx.json
error_reproduction.zip