[Bug 293214] m4 eval(neg,radix,min) does not pad wide enough
[email protected] Mon, 16 Feb 2026 16:22:58 +0000
| Newsgroups | gmane.os.freebsd.devel.standards |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293214
Bug ID: 293214
Summary: m4 eval(neg,radix,min) does not pad wide enough
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: standards
Assignee: [email protected]
Reporter: [email protected]
The POSIX wording for m4 eval
(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m4.html) includes
"The third argument, if specified, sets the minimum number of digits in the
result." which mirrors the wording for specifying precision as in
printf("%.*d", 4, -10) outputting "-0010" with four digits but overall width 5.
GNU m4 1.4.5 changed its implementation to comply with that POSIX wording back
in 2006. However, BSD m4 still behaves as if it is using printf("%0*d", 4,
-10) which outputs "-010" (ie. a minimum field width with zero-padding, rather
than minimum number of digits).
While minor, this difference in behavior means that BSD m4 cannot always be
used as a drop-in replacement to GNU m4, on tests such as:
echo 'eval(-10, 10, 4) | m4'
--
You are receiving this mail because:
You are the assignee for the bug.