Identify named pipes and sockets
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with identify/identify.py, especially tags_from_path, file_is_text, and parse_shebang_from_file, using the named-pipe and socket reproductions in the issue. Review Python's stat module as suggested. Done means identify-cli no longer hangs on named pipes or raises an error for socket files, with behavior for these file types established.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The current version (v1.4.0) can not identify named pipes and socket files.
I do not know if identify should work on this type of files, but I can show the reproduction, and can add a suggestion for fixing it.
Reproduction for named-pipes (in the last command it hangs):
$ mkfifo /tmp/my-custom-named-pipe
$ file /tmp/my-custom-named-pipe
/tmp/my-custom-named-pipe: fifo (named pipe)
$ identify-cli /tmp/my-custom-named-pipe
bt:
^CTraceback (most recent call last):
File "/usr/local/bin/identify-cli", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/identify/cli.py", line 23, in main
tags = sorted(func(args.path))
File "/usr/local/lib/python3.6/dist-packages/identify/identify.py", line 66, in tags_from_path
if file_is_text(path):
File "/usr/local/lib/python3.6/dist-packages/identify/identify.py", line 128, in file_is_text
with open(path, 'rb') as f:
KeyboardInterrupt
Reproduction for socket files:
$ python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('/tmp/my-custom-socket')"
$ file /tmp/my-custom-socket
/tmp/my-custom-socket: socket
$ identify-cli /tmp/my-custom-socket
bt:
Traceback (most recent call last):
File "/usr/local/bin/identify-cli", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/identify/cli.py", line 23, in main
tags = sorted(func(args.path))
File "/usr/local/lib/python3.6/dist-packages/identify/identify.py", line 59, in tags_from_path
shebang = parse_shebang_from_file(path)
File "/usr/local/lib/python3.6/dist-packages/identify/identify.py", line 172, in parse_shebang_from_file
with open(path, 'rb') as f:
OSError: [Errno 6] No such device or address: '/tmp/my-custom-socket'
My suggestion to fix these issues is to use stat module of python. With the help of this modul identify could check all other file types as well.
URL: https://docs.python.org/3/library/stat.html
If possible I can propose a PR with pleasure.
- Ngôn ngữ chính
- Python
- Star
- 297
- Fork
- 179
- Merge trung bình
- 10 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pre-commit/identify
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
pre-commit/identify#103 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
pre-commit/identify#61 · 2 bình luận ·
Tất cả issue của pre-commit/identify
Issue tương tự
-
#bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
apache/superset#44923 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
lawndoc/stack-back#123 ·
-
Add: EntuneĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AbdelStark/awesome-typesafe-jev#187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
repowise-dev/repowise#2966 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 2 ngày