Tern is unable to scan using Scancode-Toolkit.
With Tern only the image can be scanned and results in an report.
tern report -f spdxjson -w "container.tar" -o "result.spdx.json" -x scancode
2022-12-21 20:48:28,485 - DEBUG - __main__ - Starting...
2022-12-21 20:48:28,485 - DEBUG - prep - Setting up...
2022-12-21 20:48:28,486 - DEBUG - rootfs - Running command: chmod +x /usr/local/lib/python3.9/dist-packages/tern/tools/fs_hash.sh
2022-12-21 20:48:28,488 - DEBUG - run - Starting analysis...
2022-12-21 20:48:28,496 - DEBUG - rootfs - Running command: tar -tf /workspace/workspace/9a44489b-96c1-49f7-a627-cbffc58e366b/upload/extracted/binaries/test.tar
2022-12-21 20:48:28,498 - DEBUG - rootfs - Running command: tar -x -f /workspace/workspace/9a44489b-96c1-49f7-a627-cbffc58e366b/upload/extracted/binaries/test.tar -C /root/.tern/temp
2022-12-21 20:48:28,504 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/3e571912155d9bac1a5285bf1c21105bea53585f77a159316eed491882710ab2/layer.tar
2022-12-21 20:48:28,507 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/3e571912155d9bac1a5285bf1c21105bea53585f77a159316eed491882710ab2/layer.tar -C /root/.tern/temp/3e571912155d9bac1a5285bf1c21105bea53585f77a159316eed491882710ab2/contents
2022-12-21 20:48:28,528 - DEBUG - rootfs - Running command: /usr/local/lib/python3.9/dist-packages/tern/tools/fs_hash.sh /root/.tern/temp/3e571912155d9bac1a5285bf1c21105bea53585f77a159316eed491882710ab2/contents
2022-12-21 20:48:28,632 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/eb2f2a3b73763d543b7256e39e4a42ea190bd18a1e1c8197aaefa6ae5005ae94/layer.tar
2022-12-21 20:48:28,634 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/eb2f2a3b73763d543b7256e39e4a42ea190bd18a1e1c8197aaefa6ae5005ae94/layer.tar -C /root/.tern/temp/eb2f2a3b73763d543b7256e39e4a42ea190bd18a1e1c8197aaefa6ae5005ae94/contents
2022-12-21 20:48:28,635 - DEBUG - rootfs - Running command: /usr/local/lib/python3.9/dist-packages/tern/tools/fs_hash.sh /root/.tern/temp/eb2f2a3b73763d543b7256e39e4a42ea190bd18a1e1c8197aaefa6ae5005ae94/contents
2022-12-21 20:48:28,639 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/cf9a1a27ba287bed93e131f5cb5831b706905811bf91d5e6b5b323187d7cac92/layer.tar
2022-12-21 20:48:28,641 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/cf9a1a27ba287bed93e131f5cb5831b706905811bf91d5e6b5b323187d7cac92/layer.tar -C /root/.tern/temp/cf9a1a27ba287bed93e131f5cb5831b706905811bf91d5e6b5b323187d7cac92/contents
2022-12-21 20:48:28,643 - DEBUG - rootfs - Running command: /usr/local/lib/python3.9/dist-packages/tern/tools/fs_hash.sh /root/.tern/temp/cf9a1a27ba287bed93e131f5cb5831b706905811bf91d5e6b5b323187d7cac92/contents
2022-12-21 20:48:28,646 - DEBUG - rootfs - Running command: tar -tf /root/.tern/temp/ac1cc3694703233d4731e335b6bd4cedc7bd6fe00dead7b76068f1653b147d3a/layer.tar
2022-12-21 20:48:28,647 - DEBUG - rootfs - Running command: tar -x -f /root/.tern/temp/ac1cc3694703233d4731e335b6bd4cedc7bd6fe00dead7b76068f1653b147d3a/layer.tar -C /root/.tern/temp/ac1cc3694703233d4731e335b6bd4cedc7bd6fe00dead7b76068f1653b147d3a/contents
2022-12-21 20:48:28,649 - DEBUG - rootfs - Running command: /usr/local/lib/python3.9/dist-packages/tern/tools/fs_hash.sh /root/.tern/temp/ac1cc3694703233d4731e335b6bd4cedc7bd6fe00dead7b76068f1653b147d3a/contents
2022-12-21 20:48:28,652 - DEBUG - common - Loading packages from cache: layer "d1a00b82ba"
2022-12-21 20:48:28,654 - DEBUG - common - Loading files from cache: layer "d1a00b82ba"
2022-12-21 20:48:28,657 - DEBUG - rootfs - Running command: /usr/local/bin/scancode -ilpcu --quiet --timeout 300 -n 5 --json - /root/.tern/temp/3e571912155d9bac1a5285bf1c21105bea53585f77a159316eed491882710ab2/contents
Traceback (most recent call last):
File "/usr/local/bin/tern", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/tern/__main__.py", line 311, in main
do_main(args)
File "/usr/local/lib/python3.9/dist-packages/tern/__main__.py", line 123, in do_main
crun.execute_image(args)
File "/usr/local/lib/python3.9/dist-packages/tern/analyze/default/container/run.py", line 80, in execute_image
cimage.default_analyze(full_image, args)
File "/usr/local/lib/python3.9/dist-packages/tern/analyze/default/container/image.py", line 70, in default_analyze
passthrough.run_extension_layer(image_obj.layers[0], options.extend,
File "/usr/local/lib/python3.9/dist-packages/tern/analyze/passthrough.py", line 92, in run_extension_layer
return mgr.driver.execute_layer(image_layer, redo)
File "/usr/local/lib/python3.9/dist-packages/tern/extensions/scancode/executor.py", line 219, in execute_layer
file_list, package_list = collect_layer_data(image_layer)
File "/usr/local/lib/python3.9/dist-packages/tern/extensions/scancode/executor.py", line 162, in collect_layer_data
files.append(get_scancode_file(f))
File "/usr/local/lib/python3.9/dist-packages/tern/extensions/scancode/executor.py", line 65, in get_scancode_file
fd.copyrights = [c['value'] for c in file_dict['copyrights']]
File "/usr/local/lib/python3.9/dist-packages/tern/extensions/scancode/executor.py", line 65, in <listcomp>
fd.copyrights = [c['value'] for c in file_dict['copyrights']]
KeyError: 'value'
Tern can call Scancode-Toolkit without errors.
Describe the bug
Tern is unable to scan using Scancode-Toolkit.
With Tern only the image can be scanned and results in an report.
To Reproduce
Scan Alpine based image using Tern + Scancode-Toolkit
Error in terminal
Expected behavior
Tern can call Scancode-Toolkit without errors.
Environment you are running Tern on