WG15 Defect Report Ref: 9945-2-79
Topic: sh -o


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

.

Last update: 1997-05-20


								9945-2-79

 _____________________________________________________________________________

	Topic:			sh -o
	Relevant Sections:	4.56


Defect Report:
-----------------------
Date: Wed, 21 Sep 1994 10:24:02 -0700
From: Fred Zlotnick <fred@mindcraft.com>


I would like to an request official, binding interpretation from the
WG15 concerning the following point in ISO/IEC 9945-2:1993 (POSIX.2).

In the description of the "sh" utility in POSIX.2 subclause 4.56, the
option to -o is shown as required.  The semantics of the -o option are
specified by reference to subclause 3.14.11 (the "set" builtin
command), in which no description of the behavior is given when the
option to -o is omitted.

POSIX.2 subclause 2.11.3 states in part

	Unless otherwise stated in the utility description, when
	...a required option argument is not provided, standard
	utilities shall issue a diagnostic message to standard error
	and exit with nonzero exit status.

My question regards the use of the -o option to "sh" with no option
argument.  If the command

	sh -o < script_file

is issued, is the shell required to issue a diagnostic and exit with
nonzero status?  Or is the shell, as an extension, permitted to have
other behavior?  If the latter, is this true for other utilities with
required option arguments as well?

There are two ways to look at this: 
1. The behavior is unspecified, and implementations are free to provide 
   any desired behavior as an extension. 
2. The behavior is governed by the language cited above from 2.11.3. 
 
As a point of practice, historical implementations have allowed the
use of "set -o" and "sh -o" with the semantics of displaying the current
settings of all options.

Thank you for your attention to this matter.


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


The specification in 2.11.3 clearly states the behaviour for sh -o 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
Revised: 16 Jun 95