WG15 Defect Report Ref: 9945-2-80
Topic: awk


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-80

 _____________________________________________________________________________

	Topic:			awk
	Relevant Sections:	4.1


Defect Report:
-----------------------
(from A.Josey)

Question 1:

Awk POSIX.2, p.167, 4.1.7.1 last paragraph

In POSIX 9945-2:1993 section 4.1.7.1, the execution of an awk program is 
described :

"(...) Then each file operand (...) will be processed in turn (...)
until a record separator is seen (...), splitting the current record
into fields using the current value of FS according to the rules in
(...), evaluating each pattern in the program in the order of occurence,
and executing the action associated with each pattern that matches the
current record. (...)".

Existing practice has always  been to implement splitting
into fields in a lazy fashion.  If only $0 was needed, no splitting occurs.
If awk must be changed, the obvious modification will cause a noticable
slow-down since all lines will split regardless of whether they will be
processed.

Was the change from existing practice intentional?

Question 2:

Awk POSIX.2, p.164, 4.1.4 

POSIX.2 section 4.1.4 states: "Thus, an assignment before the first 
file argument shall be executed after the BEGIN actions (if any),..."

Existing practice has been to make the command line variable assignments
all at once before the BEGIN. 

Was this change intentional?


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


Question 1: 

The standard clearly states the effects expected from awk and
a conforming implemenation must just support the effects expected from awk.

It does not define the implementation and an implementation could still
continue to split fields in a lazy fashion.

Question 2: 

The standard states the behavior for the assignment argument for awk, 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: 22 Sep 94

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