NetBSD-Bugs archive

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

bin/60499: printf(1) doesn't support positional arguments (%n$...)



>Number:         60499
>Category:       bin
>Synopsis:       printf(1) doesn't support positional arguments (%n$...)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 24 21:30:01 +0000 2026
>Originator:     Valery Ushakov
>Release:        NetBSD 11.99
>Organization:
>Environment:
NetBSD aurinko 11.99.7 NetBSD 11.99.7 (ULTRA1) #0: Thu Jul 23 00:59:41 MSK 2026  uwe@supi:/home/uwe/work/netbsd/cvs/src/sys/arch/sparc64/compile/ULTRA1 sparc64

>Description:
printf(1) doesn't seem to support positional parameters "%n$..."

Issue 8 seems to prescribe it:

  https://pubs.opengroup.org/onlinepubs/9799919799/utilities/printf.html

though bash doesn't seem to do it either.
>How-To-Repeat:
I wrote

  printf '\tR%1$d, G%1$d = R%1$d,\n' $(seq 0 7)

expecting it to generate me a bit of code (shell-command-on-region)
but

$ printf: %1$: invalid directive
R$


PS: note also, how the format is not checked in advance and the initial
prefix is printed.

Shameless plug:

  https://hg.sr.ht/~nbuwe/printf_checkformat

is like our fmtcheck(3) but does positional parameters.

>Fix:




Home | Main Index | Thread Index | Old Index