sort --debug: key underlines are misaligned with control and multibyte characters

Đang mở
#16,076 1 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

@DuncanBentley đang làm issue này rồi.

Từ ngày 31/10/2026.

  • #16079 của @DuncanBentley — đang mở

Đá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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Start with the sort --debug implementation and the sort-debug-keys test in test_sort.rs; compare the annotation widths for control characters and multibyte characters under C and UTF-8 locales. The issue points to EXPECTED_DEBUG_KEY_ANNOTATION_LOCALE and LOCALE_FR_UTF8 as relevant test references. Done means debug underlines and indents match display-column behavior; an open linked pull request (#16079) already addresses this issue.

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

Mô tả

U - sort

sort --debug measures the key underline and its indent in bytes (ignoring only NUL). GNU measures them in display columns: control characters take no column, the tab (printed as >) takes one, and in a UTF-8 locale each character takes its display width.

$ printf 'a\x01b\n' | LC_ALL=C sort --debug 2>/dev/null
a^Ab
__        # GNU
___       # uutils

$ printf 'é日 b\n' | LC_ALL=en_US.UTF-8 sort --debug -k2 -k1,1 2>/dev/null
é日 b
   __     # GNU: indent 3 (é=1, 日=2)
___
_____
# uutils counts bytes: the key-2 underline is indented 5,
# and the next two underlines are 5 and 7 wide

The UTF-8 case is what GNU's sort-debug-keys test expects for 1² in fr_FR.UTF-8 (EXPECTED_DEBUG_KEY_ANNOTATION_LOCALE in test_sort.rs has a 23-wide underline where the C locale has 24). That test only runs when LOCALE_FR_UTF8 is set.

Checked on uutils main 824cdb271 against GNU coreutils 8.32.

Ngôn ngữ chính
Rust
Star
24.3k
Fork
2.1k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
396

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 uutils/coreutils

Tất cả issue của uutils/coreutils

Issue tương tự

Thêm issue về Rust

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.