uutils / uutils/coreutils

fmt: --goal produces different output than GNU fmt

Open
#5,162 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #5269 by @tommady — closed without merging
U - fmt
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

When using -g/--goal, the output differs between uutils fmt and GNU fmt:

// uutils fmt
$ cargo run fmt tests/fixtures/fmt/one-word-per-line.txt --goal=7
this is
a file
with one
word per
line

// GNU fmt
$ fmt tests/fixtures/fmt/one-word-per-line.txt --goal=7
this is a
file with one
word per line

A test case for this issue was added in https://github.com/uutils/coreutils/pull/5159/files

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/fixtures/fmt/one-word-per-line.txt and the test case added in PR #5159. Reproduce the --goal=7 output difference, then trace the fmt implementation and compare its wrapping behavior with GNU fmt. Done means the test passes and uutils fmt produces the expected GNU-compatible output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.