Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

unexpand: final newline prevents conversion of leading Unicode blanks

オープン 初心者向け
#15,898 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

2026年10月27日 から。

  • #15925 @Ybucaille による — オープン

評価

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

調査の方向性

src/uu/unexpand/src/unexpand.rsの512~523行付近にあるunexpand_bufの高速パスから始め、Unicodeの空白処理の前に、改行で終わる入力をどのように扱うか追ってください。issueのコマンドで再現し、デフォルトモードと-aを比較してください。デフォルトモードで先頭のU+3000文字が、最後の改行を伴うタブに変換され、関連するunexpandのテストが通れば完了です。

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

説明

U - unexpand

In a UTF-8 locale, unexpand leaves leading Unicode blanks unchanged when the line ends in a newline. Removing that newline makes the same blanks convert to a tab. GNU coreutils 9.12 converts them in both cases.

Reproduced on main c1f172886c6643f61ffde5a1ce3db0aaf14e182b on Linux, in both debug and release builds:

python3 -c 'print("\u3000" * 4 + "X")' |
  LC_ALL=C.UTF-8 coreutils unexpand | od -An -tx1

The input is four U+3000 IDEOGRAPHIC SPACE characters (eight display columns), followed by X and a newline.

Expected, as printed by GNU unexpand 9.12:

09 58 0a

Actual:

e3 80 80 e3 80 80 e3 80 80 e3 80 80 58 0a

The same command with unexpand -a produces the expected tab. So does default unexpand if the final newline is omitted. --first-only has the same failure as default mode.

The first fast path in unexpand_buf (src/uu/unexpand/src/unexpand.rs:512-523) checks only for ASCII space and tab before copying a newline-terminated buffer unchanged. This bypasses the Unicode blank handling later in the function.

I compared 416 cases against GNU 9.12 across 13 Unicode blank characters, two UTF-8 locales, file/pipe input, with/without a final newline, and four option sets. Both uutils builds had the same 104 mismatches, all in default/--first-only mode with a final newline. All 44 existing unexpand integration tests pass.

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

環境構築

Codespaces で開く

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

はじめの一歩

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

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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