sort -nu: a comma after the decimal point can make distinct numbers compare equal
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The bug is in NumInfo::parse in src/uucore/src/lib/features/numeric_str_cmp.rs (around lines 131-137), which skips the thousands separator without checking whether a decimal point was already consumed. Reproduce with the two printf | LC_ALL=en_US.UTF-8 sort -nu examples in the issue and compare against GNU sort. Done when 1.2,9 and 1.29,0 both survive -nu, 1.2,9 sorts before 1.21,0 under -n, and 1,200.5 still equals 1200.50.
索引モデルが issue の本文から書いたものです。
説明
In en_US.UTF-8, sort -nu silently drops the second of two records with distinct decimal prefixes. Both implementations exit 0.
printf '%s\n' '1.2,9' '1.29,0' | LC_ALL=en_US.UTF-8 sort -nu
GNU prints both rows. uutils prints only 1.2,9. GNU stops the numeric prefix at the comma after the decimal point. uutils skips it and compares 1.29 with 1.290.
Plain sorting is also affected.
printf '%s\n' '1.2,9' '1.21,0' | LC_ALL=en_US.UTF-8 sort -n
GNU keeps the input order. uutils puts 1.21,0 first. With -t, -k1,1n -u, both retain both rows in the first example. Both correctly treat 1,200.5 and 1200.50 as equal with -nu.
Verified on x86_64 Linux with uutils 0.12.0, 0.13.0 and main at 8b16a3dca86ae91df73db3d375205eb7718c4c03 against GNU 9.7 and 9.12. Unlike #16735, this also reproduces with -k1,1n -u using the default field delimiter. NumInfo::parse skips the thousands separator without checking whether a decimal point has already been consumed. https://github.com/uutils/coreutils/blob/8b16a3dca86ae91df73db3d375205eb7718c4c03/src/uucore/src/lib/features/numeric_str_cmp.rs#L131-L137
- 主要言語
- Rust
- スター
- 24.4k
- フォーク
- 2.2k
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 402
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
split -n leaves bytes from a previous run in chunks that should be empty対応中かも @costajohnt が 2 日前に担当しました。 オープンU - split
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
dircolors: '=' is not escaped and '^'/'\\' do not toggle the backslash state, unlike GNU再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンU - dircolors
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
U - shred
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
chown -v: `+ID` spec echoed verbatim on a broken symlink対応中かも @sunsss123soldier が 7 日前に担当しました。 オープンgood first issue oss-scanner U - chown
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
marketing
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
S: Untriaged T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
libnyanpasu/clash-nyanpasu#6537 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 62/100
tauri-apps/tao#1445 ·
メンテナーはふだん 1 日以内に返信
-
bug P3
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
go good first issue test
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信