sort -Rfu can return multiple records for the same case-insensitive key

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

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

Từ ngày 18/11/2026.

  • #16700 của @costajohnt — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
30/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

Read the random comparator in src/uu/sort/src/sort.rs around lines 2885–2899 and the existing test_random_ignore_case test. Reproduce the reported command with LC_ALL=C and --random-source=/dev/zero, then add coverage using two case-insensitive keys. Done means -Rfu emits one row for each distinct first-field key; check the open pull request #16700 before starting.

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

Mô tả

U - sort

Shuffling a ticket list and asking for one row per owner can give the same owner two entries.

printf 'Alice ticket-1\nalice ticket-2\nXena ticket-3\n' |
  LC_ALL=C sort -Rfu -k1,1 --random-source=/dev/zero

On uutils 0.12.0 and main at 293a724 (Linux x86_64), this exits 0 and prints:

Alice ticket-1
Xena ticket-3
alice ticket-2

There are two distinct first-field keys under -f, so any shuffle should emit exactly two rows. GNU 9.12 emits tickets 1 and 3. Removing -R and --random-source makes uutils do the same. The fixed random source just makes the failing order repeatable.

The random comparator treats Alice and alice as equal when compared directly, but hashes their original spellings when comparing either to Xena. They can land on opposite sides of Xena, so adjacent deduplication misses them. The existing test_random_ignore_case covers eight spellings of one word. A second distinct key exercises the missing comparison.

Ngôn ngữ chính
Rust
Star
24.4k
Fork
2.2k
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
402

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.