Skip to content

[gap] fmt: -g/--goal accepted but ignored — greedy fill instead of goal-width breaking #1049

Closed

Description

@caomengxuan666

Summary

GNU fmt breaks lines at the GOAL width (default 93% of -w), using a best-fit algorithm that avoids both overfull and nearly-full lines. WinuxCmd accepts -g but fills greedily to the full -w width.

Repro

printf 'one\ntwo\nthree\nfour\n' | fmt -w10
printf 'one two three four five six seven\n' | fmt -w10 -g9

GNU coreutils 8.32

one two
three
four          ('three four'=10 exceeds the 9-char goal)

one two
three
four five
six seven

WinuxCmd 1.0.6

one two
three four    (filled to exactly -w10; -g9 had no effect)
...

(Provides a precise mechanism for the divergence noted in #280.)

Activity

  1. added
    bug
    compat-gap
    on Sep 14, 2026
  2. caomengxuan666 commented on Sep 14, 2026

    @caomengxuan666
    MemberAuthor

    Fixed in release/v1.0.6 — verified against GNU coreutils 9.4 (WSL) with byte-identical or semantically identical output. See the GNU-parity commits on this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompat-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions