.
Last update: 1997-05-20
9945-2-87 _____________________________________________________________________________ Topic: ar Relevant Sections: 6.1 Defect Report: ----------------------- Date: Wed, 16 Nov 1994 11:04:39 -0800 From: Fred Zlotnick <[email protected]> Defect Report: ----------------------- I would like to request an official, binding interpretation from the WG15 concerning the following point in ISO/IEC 9945-2:1993 (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? Thank you for your attention to this matter. 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. WG15 response for 9945-2:1993 ----------------------------------- 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 --------- None. Forwarded to Interpretations group: 17 Nov 94 Response received: Feb 10 1995 Proposed Resoln forwarded: 13th Feb 1995 Finalised: March 28th 1995 _____________________________________________________________________________