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

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

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

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

2026年10月31日 から。

  • #16079 @DuncanBentley による — オープン

評価

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

調査の方向性

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.

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

説明

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.

主要言語
Rust
スター
24.3k
フォーク
2.1k
平均マージ
2日 9時間
マージ済み PR(30日)
396

環境構築

Codespaces で開く

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

はじめの一歩

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

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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