Use of the information contained in this unapproved document is at your own risk
.Last update: 20 April,2001
1003.2-92 #08
Class: No change.
This response will be incorporated in an IEEE interpretations
publication, and will be also made available on-line on the IEEE
SPAsystem.
_____________________________________________________________________________
Interpretation Number: (to be assigned by the IEEE)
Topic: sort
Relevant Sections: 2.9.1.4
Interpretation Request: (Defect Report)
-----------------------
In Section 2.9.1.4 - File Read, Write, and Creation, the
standard states that:
When an attempt is made to create a file that
already exists, the action shall depend on the
file type:
(1) For directories and FIFO special files,
the attempt shall fail and the utility
shall either continue with its operation
or exit immediately with a nonzero
status, depending on the description of
the utility.
[Draft 12 of IEEE Std 1003.2-1992 (July 1992), p. 96, lines
3433-3437]
Does the standard really mean what it says? Will every
utility that creates an output file need to first check that
there is not a file of type FIFO with that name before it
open()s it for writing?
If so, ``mkfifo foo; sort -o foo file'' will fail. Being
able to use a FIFO as a pipe with a name is a useful
behaviour. It allows applications to connect utilities
together in more complex ways than simple pipelines.
IEEE Interpretation for 1003.2-1992
-----------------------------------
The quoted text from Section 2.9.1.4 is modified by Section 2.9.1, lines
3360-3361 "Utility and function description statements override these
defaults when appropriate."
The sort -o option is described in the Output Files section as "If the
-o option is in effect, the sorted output shall be placed in the
file..". This overrides section 2.9.1.4, requiring that the output be
placed in the file, as it does not speak of requiring creation of said
file.
Rationale for Interpretation:
-----------------------------
None.
_____________________________________________________________________________