Re: AW: [PATCH] fix:awk: CONVFMT segfaults with %n, wrong output with %p

Hans Ulli Kroll via busybox <[email protected]> Wed, 06 May 2026 10:14:20 +0200
Newsgroups gmane.linux.busybox
Message-ID <[email protected]>
On Wed, 2026-05-06 at 13:37 +1000, Alexis via busybox wrote:
> "Schindler, Dietmar - OTPS via busybox" <[email protected]> 
> writes:
> 
> > The output cannot be wrong, because according to
> > https://pubs.opengroup.org/onlinepubs/9799919799/utilities/awk.html
> > and
> > https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap05.html:
> > 
> > "If any character sequence in the format string begins with a 
> > '%'
> > character, but does not form a valid conversion specification, 
> > the
> > behavior is unspecified."

Thanks for the hint/link

So segfault is an *expected* unspecified behavior 
;-)

> 
> i'd be interested to know what other awk implementations (e.g. One 
> True Awk, mawk) do here ....
> 

For the true awk you must go back in time, 50 years I think.

awk is older than opengroup and POSIX

AFAIR this was the beginning of the programming language C

And other tools like sed, grep, also world famous ed (pun intended).
A *one* line editor you can basically run on a computer attached to a
teletype.

On computers with a *few kilobytes* of RAM.

This is reason for unspecified, you have no memory left for error
printing.

Here is a list of other awk implementations
http://www.shelldorado.com/articles/awkcompat.html

Ulli