bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#79497: fmt breaks lines when it does not need to


From: PƔdraig Brady
Subject: bug#79497: fmt breaks lines when it does not need to
Date: Wed, 7 Jan 2026 17:22:13 +0000
User-agent: Mozilla Thunderbird Beta

On 23/09/2025 18:00, Bruno Haible wrote:
Hi PƔdraig,

Thanks for answering. So, we have the multibyte problem and the
newline-included problem.

PƔdraig Brady wrote:
The code seems to follow the man page and includes the \n in the char count.
Note fold -w does not count the newline which is what I'd expect.

I ran this test case with various 'fmt' implementations:

$ echo 'Hello world' | fmt -w 11
Hello
world
$ echo 'Hello world' | fmt -w 12
Hello world

The minimum -w option that produces a single line:

GNU              12
macOS, FreeBSD   11
NetBSD           11   (-g 10 -w 11)
OpenBSD          11
AIX, Solaris     12

So, the BSD implementations don't count the newline.
The attached aligns the -w interpretation with fold(1), and BSD fmt(1).

Not closing this bug until we get full multi-byte support.

cheers,
Padraig

Attachment: fmt-w-inclusive.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]