NetBSD-Bugs archive

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

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



The following reply was made to PR bin/60499; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/60499: printf(1) doesn't support positional arguments
 (%n$...)
Date: Sat, 25 Jul 2026 11:47:09 +0300

 On Sat, Jul 25, 2026 at 02:25:01 +0000, Robert Elz via gnats wrote:
 
 >    | printf(1) doesn't seem to support positional parameters "%n$..."
 >    | Issue 8 seems to prescribe it:
 >  
 >  It does.   If it didn't, we would most likely have support!
 >  
 >  The problem is that I simply find the spec in POSIX absurd, so rather
 >  that implement that, I implemented (committed really) nothing.
 
 I'm confused...  "It does" and "implemented nothing" is kinda
 contradictory.
 
   $ /usr/bin/printf '%s %s\n' a b
   a b
   $ /usr/bin/printf '%2$s %1$s\n' a b
   printf: %2$: invalid directive
 
 
 
 >  It wouldn't however handle people who have decided that printf(1)'s
 >  positional params can be (ab)used to do all kinds of other tricks, like
 >  the one you are attempting above,
 
 Guilty as charched.  But I often find implicit loop in printf
 massively convenient :)
 
 
 >  there's just a little less opportunity to show off just
 >  how clever you are.
 
 I don't think our shell is easily impressed, it's seen worse, and
 no-one else sees those snippets of shell code that I type into my
 emacs buffer only to immediately C-u M-| sh <RET> it.
 
 
 -uwe
 



Home | Main Index | Thread Index | Old Index