Line-ending check: catch UTF-16 text that Git treats as binary

Đang mở
#57 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
62/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, python
Lĩnh vực
devtools

Hướng nghiên cứu

Start with tools/ci/check_line_endings.py and the output of git ls-files --eol, which the script already relies on to classify files as i/crlf, i/mixed or i/-text. For entries reported as i/-text whose extension is not a real binary type, read the first bytes and fail on a UTF-16/UTF-32 byte-order mark or on CR LF. Done when a temporary git repository test shows the script failing for a UTF-16 CR LF .txt file and passing for a .png.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area: build-ci build

tools/ci/check_line_endings.py rejects files that git ls-files --eol reports as i/crlf or i/mixed. A file Git classifies as binary by content is reported as i/-text and passes, and that includes UTF-16 text (every ASCII character is followed by a NUL byte), with CR LF inside. Windows PowerShell 5.1 writes UTF-16 with CR LF by default (> and Out-File), so such a file is easy to commit by accident.

Nothing breaks today: the maps and vectors whose bytes matter are checked by SHA-256 in their own tests. It is only the UTF-8 / LF convention that can slip.

To do

  • For i/-text entries whose extension is not on a short list of real binary types, read the first bytes and fail on a UTF-16 / UTF-32 byte-order mark or on CR LF.
  • A CPU test: a temporary git repository with a UTF-16 CR LF .txt and a .png; the script must fail for the first file only.
Ngôn ngữ chính
C++
Star
12
Fork
2
Merge trung bình
3 giờ 10 phút
Pull request đã merge (30 ngày)
171

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phantoslayer21/wronggpu

Tất cả issue của phantoslayer21/wronggpu

Issue tương tự

Thêm issue về C++

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.