On 04/04/2026 22:18, Karl Berry wrote:
I ran
echo in | fmt -w 9999 >/tmp/out
and was surprised to get the error:
fmt: invalid width: '9999': Numerical result out of range
Why is it fmt's business to decide what value is acceptable?
Does POSIX require this arbitrary limit?
I don't see the limit documented in coreutils.texi or fmt --help.
This is with fmt (GNU coreutils) 8.32. Sorry if it is fixed in a newer
release.
Rationale: I was using fmt as a quick way to concatenate a bunch of
short lines into one. I am aware there are many other ways to do it. -k
From the code:
/* FIXME: Remove these arbitrary limits. */#define MAXWORDS 1000
#define MAXCHARS 5000
-w is limited to MAXCHARS/2
thanks,
Padraig.