IEEE Std 1003.2-1992 Interpretation #87


Copyright © 1996 IEEE. All rights reserved.


IInterpretation Number:	87
Topic: 	 ar
Relevant Clauses:	6.1
Interpretation request
I would like to request an official, binding interpretation from the IEEE 
concerning the following point in 
IEEE Std 1003.2-1992 (POSIX.2).
POSIX.2 clause 6.1 specifies the semantics of the "ar" utility. My question 
regards the behavior of "ar" 
when invoked with the syntax
ar -r archive_name
where archive_name names a file that does not currently exist.
The Synopsis subclause (6.1.1) lists five valid syntaxes for invoking "ar". 
One of these is
ar -r [-cuv] archive file ...
The file argument is not shown as optional. Since the syntax shown in 
three other cases does show the 
file argument as optional, it is reasonable to assume that this is 
intentional, and that invoking "ar" with the -r 
option without a file argument is always an error.
Subclause 6.1.3 describes the options to "ar". In the description of the -r 
option, the standard states (in 
part)
Replace or add file(s) to archive. If the archive named by archive does not 
exist, a new archive shall be 
created and a diagnostic message shall be written to standard error 
(unless the -c option is specified). If no 
file(s) are specified and the archive exists, the results are undefined.
One can read this description as implying that, if an archive is named that 
does not exist, it is permissible to 
omit the file argument and that in this case a new, empty archive is 
created. This contradicts the earlier 
interpretation. Which is correct? In other words, when "ar" is invoked as 
decribed, what must a conforming 
implementation do?
Proposed Interpretation response: (from mjc)
A conforming implementation may allow the use of the -r option without 
file operands. The behaviour of ar 
in this case is undefined.
Applications should always specify one or more file operands with the -r 
option.
Rationale
The only behaviour that the quoted passage specifies when the file 
operand are missing is if the archive 
exists, and that behaviour is undefined. It does not specify any behaviour 
if the file arguments are missing 
and the archive does not exist. While one could read it to mean that the 
file operands are optional, it does 
not state that, so the synopsis must hold.
Even if it is read to mean the file operands are optional, the only 
behaviour that may be assumed is that it is 
undefined.
There is nothing that suggests that an empty archive will be created, and 
it is not clear that an application or 
user would want to create an empty archive.
Historical practice is to require file operands when the -r option is used, 
and nothing in the rationale 
suggests that the committee intended to change that.
	
IEEE Interpretation for 1003.2-1992
The standard does not specify the meaning of ar -r archive-name. None 
of the synopsis forms given for ar 
specify -r option with only one operand.
The standard does not speak to this issue, and as such no conformance 
distinction can be made between 
alternative implementations based on this. This is being referred to the 
sponsor.

Rationale for interpretation
None.

Back to IEEE Standards Interpretations for IEEE Std 1003.2-1992


© Copyright IEEE-SA
Contact IEEE-SA
For questions or comments, please contact the IEEE-SA Webmaster.