uutils/coreutils

fmt: line-wrapping differs from gnu implementation in some situations

Open

#10.095 geöffnet am 7. Jan. 2026

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.852 Forks)batch import
U - fmtgood first issue

Repository-Metriken

Stars
 (23.246 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 9T 14h) (216 gemergte PRs in 30 T)

Beschreibung

Description

When trying to come across edge cases in the non utf-8 fmt PR I came across that some outputs to fmt were not matching due to the line breaks being inserted in different places

Examples:


  $ printf 'aa bb cc dd ee' | /usr/bin/fmt -w 8
GNU
  aa
  bb cc
  dd ee

uutils
  aa bb cc
  dd ee


  $ printf '漢 字 test 日 本 語' | /usr/bin/fmt -w 10
GNU
  漢 字
  test 日
  本 語

uutils
  漢 字 test
  日 本 語


  $ printf '漢字 test 日本語' | /usr/bin/fmt -w 15
GNU
  漢字 test
  日本語

uutils
  $ printf '漢字 test 日本語' | uutils fmt -w 15
  漢字 test 日本語

Where to fix:

src/uu/fmt/src/linebreak.rs is the file that has the logic

Contributor Guide