Skip to content

fmt: Crashes for some inputs (?) #6354

@BenWiederhake

Description

@BenWiederhake
$ yes a | head -n50 > 50a.txt
$ fmt -w 75 -g 10 50a.txt 
a a a a a a
a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
$ cargo run -q fmt -w 75 -g 10 50a.txt 
thread 'main' panicked at 'attempt to subtract with overflow', src/uu/fmt/src/linebreak.rs:242:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
a[$? = 101]

I have no idea why it crashes here. It seems to crash for any "goal" of 37 or less.

Might be related to #5162, might not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions