NetBSD-Bugs archive

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

Re: bin/21970 (printf(1) breaks when format begins with "-")



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

From: Alan Barrett <apb%cequrux.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/21970 (printf(1) breaks when format begins with "-")
Date: Tue, 4 Nov 2008 09:26:56 +0200

 On Mon, 27 Nov 2006, Alan Barrett wrote:
 > I don't buy the argument that "OPTIONS None" in SUSv3 means "anybody who
 > uses printf(1) needs to insert "--" to guarantee that the format is not
 > misinterpreted as an option".  At least, not unless somebody can point
 > to text in SUSv3 that says so.
 
 I have now found text in SUSv3 that supports the argument that I
 rejected before.
 
 Under "Utility Description Defaults" at
 <http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html
 #tag_01_11>, under the "OPTIONS" subheading, it says
 
 "       When this section is listed as "None.", it means that the
 "       implementation need not support any options. Standard utilities
 "       that do not accept options, but that do accept operands, shall
 "       recognize "--" as a first argument to be discarded.
 
 I am now convinced that NetBSD's printf(1) utility's handling of the
 "--" option is correct per SUSv3.  Treating a format argument that
 just happens to begin with "-" as if it was an unrecognised option is
 probably also allowed as an implementation extension, though I haven't
 found specific text to support that theory.
 
 The only remaining problem is that this use of "--" is poorly
 documented.  I will work on that when I have time.
 
 --apb (Alan Barrett)
 


Home | Main Index | Thread Index | Old Index