aboutcode-org / aboutcode-org/scancode-toolkit

extractcode crash with certain symbolic links on Windows 10

Đang mở
#2,155 2 bình luận 0 reaction 2 người được giao Được @pombredanne nhận Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
2.6k
Fork
791
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
5

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.