aboutcode-org / aboutcode-org/scancode-toolkit

extractcode crash with certain symbolic links on Windows 10

未關閉
#2,155 2 則留言 0 個 reaction 已指派 2 人 已被 @pombredanne 認領 在 GitHub 檢視
bug
主要語言
Python
星號
2.6k
分支
791
平均合併
1 天 12 小時
30 天內合併 PR
5

描述

### Description

extractcode has problems with symbolic links on Windows -> Leads to a crash.

[tar.utf8.tar.bz2.zip](https://github.com/nexB/scancode-toolkit/files/5041008/tar.utf8.tar.bz2.zip)

Please chatch the errors and prevent a crash. Possible work-around for the underlying issues:
- rename the symbolic links to some unique file name
- ignore the problematic symbolic links with a warning

### How To Reproduce
Download busybox-1.26.2 and try to run extractcode on it as follows. I attached the problematic archive.

c:\scancode-toolkit-3.1.1>extractcode --verbose C:\sources
Extracting archives...
Extracting: \busybox-1.26.2\busybox-1.26.2.tar.bz2-extract\busybox-1.26.2\testsuite\tar.utf8.tar.bz2
Traceback (most recent call last):
File "c:\scancode-toolkit-3.1.1\src\extractcode\extract.py", line 187, in extract_file
warns = extractor(abs_location, tmp_tgt) or []
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 134, in extract
for entry in list_entries(abs_location):
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 171, in list_entries
for entry in archive:
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 251, in iter
entry = Entry(self, entry_struct)
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 333, in __init__
self.symlink_path = self.get_path(symlink_path, symlink_path_w)
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 350, in get_path
path = func(self.entry_struct)
File "c:\scancode-toolkit-3.1.1\src\extractcode\libarchive2.py", line 500, in errcheck
raise ArchiveError(rc, archive_struct, archive_func)
extractcode.libarchive2.ArchiveError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scancode-toolkit-3.1.1\Scripts\extractcode-script.py", line 11, in
load_entry_point('scancode-toolkit', 'console_scripts', 'extractcode')()
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\scancode-toolkit-3.1.1\src\scancode\utils.py", line 70, in main
standalone_mode=standalone_mode, **extra)
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\scancode-toolkit-3.1.1\src\scancode\extract_cli.py", line 167, in extractcode
for xev in extraction_events:
File "c:\scancode-toolkit-3.1.1\lib\site-packages\click\_termui_impl.py", line 259, in next
rv = next(self.iter)
File "c:\scancode-toolkit-3.1.1\src\scancode\api.py", line 331, in extract_archives
for xevent in extract(location, kinds=default_kinds, recurse=recurse):
File "c:\scancode-toolkit-3.1.1\src\extractcode\extract.py", line 162, in extract
for xevent in extract(target, kinds, recurse):
File "c:\scancode-toolkit-3.1.1\src\extractcode\extract.py", line 154, in extract
for xevent in extract_file(loc, target, kinds):
File "c:\scancode-toolkit-3.1.1\src\extractcode\extract.py", line 192, in extract_file
errors = [str(e).strip(' \'"')]
TypeError: __str__ returned non-string (type NoneType)

### System configuration

Windows 10 x64
scancode-toolkit-3.1.1
installed from source with git clone

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。