aboutcode-org / aboutcode-org/scancode-toolkit

Broken regexp in is_relative_path()

Đang mở
#531 12 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug text extraction
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ả

`textcode.strings.is_relative_path()` is completely broken:

```pycon
>>> from textcode.strings import is_relative_path
>>> is_relative_path("/usr")
Traceback (most recent call last):
File "", line 1, in
File "/home/jwilk/.local/lib/python2.7/site-packages/textcode/strings.py", line 200, in
relative = re.compile('^(?:([^/]|\.\.)[\w_\-]+/.*$', re.IGNORECASE).match
File "/usr/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
```

Tested against git HEAD (bca0af4a6ff10f4ef0bef6459f2f06a17d21f9f6).

Found using [pydiatra](https://github.com/jwilk/pydiatra).

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.