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

オープン
#16,692 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@costajohnt がすでに取り組んでいます。

2026年11月18日 から。

  • #16700 @costajohnt による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust
領域
cli

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
24.4k
フォーク
2.2k
平均マージ
2日 23時間
マージ済み PR(30日)
402

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。