Defect Report concerning: IEEE Std. 1003.2-1992, ISO/IEC 9945-2:1993 - Shell & Utilities
Clause: page 245 clause 4.16.4 list item of=file
PASC Interpretation Ref: pasc-1003.2-209
Topic: dd


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  #209

 _____________________________________________________________________________


	Interpretation Number:XXX	
	Topic:  dd
	Relevant Sections: page 245 clause 4.16.4 list item of=file




PASC Interpretation Request: (Defect Report)
----------------------------  

	Date: 2001 Mar 19

------------------------------------------------------------------------ 

 7  Defect Report concerning (number and title of International Standard
    or DIS final text, if applicable): 

Shell & Utilities: IEEE Std 1003.2-1992 (ISO 9945-2:1993)

------------------------------------------------------------------------ 

 8  Qualifier (e.g. error, omission, clarification required):

1

Error=1 , Omission=2, Clarification=3

------------------------------------------------------------------------ 

 9  References in document (e.g. page, clause, figure, and/or table
    numbers):

page 245 clause 4.16.4 list item of=file

------------------------------------------------------------------------ 

10  Nature of defect (complete, concise explanation of the perceived
    problem):


The description of the dd of=file operand says that the output
file is truncated unless conv=notrunc is specified.  It also
says that the default output file is standard output.  Taken
together, these two things seem to imply that when no output
file is specified, dd should truncate the file that is open on
standard output (unless conv=notrunc is specified).  However,
this does not reflect current practice, as can be seen by
executing the commands:

(echo a ; echo b | dd) > outfile

On most systems I have tried this on, "outfile" contains two lines
("a" and "b"), showing that dd did not truncate the output file.
Only on one (old) system did "outfile" contain just the "b" line.

------------------------------------------------------------------------ 

11  Solution proposed by the submitter (optional):




------------------------------------------------------------------------ 



Interpretation:
--------------
The submitter is correct in noting that standard states that if no of=
operand is specified and no conv=notrunc operand is specified then
standard output must be truncated to a size appropriate to any
specified seek= and skip= operands, and conforming implementations must
conform to these requirements.  However, concerns have been raised
about this which are being referred to the sponsor.


Rationale:
----------
Historical implementations use open(..., ... | O_TRUNC, ...) as
appropriate for files opened in response to of= operands.  This did not
happen with standard output when no of= operand was specified.  When
applications want file truncation they can clearly use of= as an
operand.  In cases where output is being redirected by the shell, the
application could use > redirection or >> redirection to get the
desired behavior without depending on dd's conv=notrunc feature.

Notes to project editor (not part of this interpretation):
==========================================================
Make the following change to the XCU volume of the Austin Group
Revision draft 5:
Change "begins, unless conv=notrunc" on P2513, L11534 to "begins if an
explicit of=file operand is specified, unless conv=notrunc".

Forwarded to Interpretations group: 24 Mar 2001
Recirculated: 29 Mar 2001
Finalized: 10 Apr 2001