Email List: Xaustin-group-lX
[All Lists]

RE: Defect in XCU sort

To: Don Cragun <yyy@xxxxxxxxxxxxxxxxxxxxx>
Subject: RE: Defect in XCU sort
From: Nick Stoughton <yyyy@xxxxxxxxxx>
Date: Tue, 10 Aug 2004 14:42:56 -0700
Cc: yyyyyyyyyyyyyy@xxxxxxxxxxxxx, yyyyyy@xxxxxxxxxxx
References: <200408102056.i7AKuNPj002463@spartan.SFBay.Sun.COM>
OK, the light has finally lit in my head, and I understand guideline 13
now!

If there is an operand "-" where the utility expects to find a filename,
it cannot mean anything OTHER than stdin (or stdout if it is an output
filename) or a file called "-". Each utility should make it clear which
of these alternatives it is (e.g. see cat).

However, many (most?) utilities do not spell out "-" as an operand, and
so the default *should* be in such cases that "-" means a file with that
name.

I think it would be helpful to spell this out more clearly in both the
normative text and the rationale.

Something like:

At Page XBD 204, line 7233, replace 
"Guideline 13: For utilities that use operands to represent files to be
opened for either reading or writing, the - operand should be used only
to mean standard input (or standard output when it is clear from context
that an output file is being specified)."

with
"Guideline 13: For utilities that use operands to represent files to be
opened for either reading or writing, the - operand should be used to
mean only standard input (or standard output when it is clear from
context that an output file is being specified) or a file named -."

After line 7240,  add 
"Where a utility described in the Shell and Utilities volume of IEEE Std
1003.1-2001 as conforming to these guidelines accepts the operand - to
mean standard input or output, this usage shall be explained in the
OPERANDS section."

On Tue, 2004-08-10 at 13:56, Don Cragun wrote:
> Jason,
>       Sun's Solaris' tee utility also produces a file named - in
> this case.  However, it isn't clear to me that this is non-conforming
> behavior.  The rationale describing Guideline 13 on XRAT (2004 edition)
> P75-76, L3070-3075 clearly states that it does not mean that all standard
> utilities accept the operand '-' to mean stdin or stdout.
>       Furthermore, I believe that all cases where the standard intended
> for a a file operand with value '-' to be treated as stdin or stdout
> explicitly stated that fact in the description of the operand.  The
> description of the file operand for the tee utility does not specify
> any special treatment for a file operand with the value '-'.  (One thing
> not mentioned in the rationale is that at the time the original SVID was
> being written {including the System V Command Syntax Standard rules that
> were used as the basis for the POSIX Utility Syntax Guidelines} there
> were a few utilities being developed that treated '-' as an operand to
> mean "the default" rather than "standard input" or a file named '-'.
> The SVID writers wanted to discourage this practice.  Using '-' to mean
> "standard output" came from BSD and was included in POSIX.2's Guideline
> 13, but was not mentioned in SVID, SVID2, nor SVID3.)
> 
>       Cheers,
>       Don
> 
> >Date: Tue, 10 Aug 2004 12:50:49 -0700
> >From: "Jason Zions" <yyyyyyyy@xxxxxxxxxxxxxxxxxxx>
> >X-Mailing-List: austin-group-l:archive/latest/7088
> >
> >Now that's an interesting example.
> >
> >cat foo | tee - 
> >
> >Do you see two copies of foo in sequence on stdout, or do you see it
> >interleaved line by line? Or read-block by read-block? Since tee doesn't
> >buffer its output, I'd expect either of the last two possibilities.
> >
> >(My implementation in SFU 3.5 creates a file called "-". Pretty clearly
> >non-conforming as the standard is currently written.)

<Prev in Thread] Current Thread [Next in Thread>