Defect Report concerning: IEEE Std. 1003.2-1992, ISO/IEC 9945-2:1993 - Shell & Utilities
Clause: 4.55
PASC Interpretation Ref: pasc-1003.2-81
Topic: sed


This is an unapproved interpretation of PASC 1003.2-1992, ISO/IEC 9945-2:1993 - Shell & Utilities.

Use of the information contained in this unapproved document is at your own risk.

Last update: 20 April,2001


								1003.2-92  #81

 _____________________________________________________________________________

	Interpretation Number:	XXXX
	Topic:			sed
	Relevant Sections:	4.55


Interpretation Request: (Defect Report)
-----------------------
Date: Fri, 7 Oct 1994 15:26:29 -0700


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 Subclause 4.55 specifies the semantics of the "sed" utility.
In subclause 4.55.7.3 the semantics of various subcommands are
specified.  My question has to do with the "a" and "r" subcommands.
The description of the "a" subcommand states that the command

	[1addr]a\
	<text>

shall cause sed to

	Write <text> to standard output just before each attempt to
	fetch a line of input, whether by executing the N command or by
	beginning a new cycle.

Similarly, the description of the "r" subcommand states that the command

	[1addr]r <file>

shall cause sed to

	Copy the contents of <file> to standard output just before each
	attempt to fetch a line of input.

My question has to do with the behavior of these commands on the first
input line when the address is omitted.  In such a case, POSIX.2 states
(subclause 4.55.7.1) that

	A command with no addresses shall select every pattern space.

If sed is executed with a script that includes an "a" command or an "r"
command with no addresses, is the action of "a" or "r" taken prior to
input of the first line in the input stream?  My reading of the above
sections of the standard is that this action should be taken prior to
fetching each line, including the first one.  However, it appears that
existing practice is for the action of "a" or "r" to occur on each
fetch attempt after the first, but not on the first.  Does this
behavior conform to the requirements of POSIX.2?


Thank you for your attention to this matter.

Interpretation response:
-------------------------


The standard states the behavior for input and addressing for sed, and 
conforming implementations must conform to this.  However, concerns have been
raised about this which are being referred to the sponsor.

Rationale
-------------
None.

Forwarded to Interpretations group: 09 Oct 94

Proposed resolution sent for review: 19th Nov 94
Resolved: 10th Dec 94