WG15 Defect Report Ref: 9945-2-103
Topic: mailx escaped commands when stdin is not a terminal


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

.

Last update: 1997-05-20


								9945-2-103

 _____________________________________________________________________________

	Topic:                  mailx escaped commands when stdin is not a terminal
	Relevant Sections:      4.40.7

Defect Report:
-----------------------

	Date: Fri, 31 Mar 1995 16:22:19 -0800
	From: kdawson@jurassic-52.Eng.Sun.COM (ken dawson [contractor])

Dear Standards Board,

        I would like to request a formal interpretation on the following
issue concerning the mailx utility in POSIX.2.


In section 4.40.7, the Extended Description of the mailx command, (P342,
L6312-6321), it says:

    ... When mailx is invoked using the Send Mode synopsis, and standard
    input is a terminal, if no subject is specified on the command line
    and the asksub variable is set, a prompt for the subject shall be
    written.  At this point mailx is in input mode.  This input mode is
    also entered when using one of the Receive Mode synopsis forms and a
    reply or new message is composed using reply, Reply, or mail
    commands.  When the message is typed and the end of the message is
    encountered, the message shall be passed to the mail delivery
    software.  Commands can be entered by beginning a line with the
    escape character [by default, tilde (~)] followed by a single command
    letter and optional arguments. ...

Does the definition of "input mode", then, necessarily require that stdin
is a terminal?  This seems unclear when Receive Mode is involved.  That
is to say, does

   echo "reply 1\naaaa\n~w repl" | mailx -n -f mbox

produce a mail message sent to the all recipients of the first message in
mbox which contains the message

    aaaa
    ~w repl

or does it mail a message containing

    aaaa

and create a copy of this message in the file repl?

To match historic practice of the System V mailx, on which the standard
is based, the sentence on P342, L6315-6317, should be changed to:

    This input mode is also entered when using one of the Receive Mode
    synopsis forms and a reply or new message is composed using the
    reply, Reply, or mail commands, and stdin is a terminal.

Also, a sentence needs to be added after the end of the paragraph ending
on (P342, L6321) which states:

    It is unspecified what effect these commands will have if stdin is
    not a terminal when a message is entered using either the Send Mode
    synopsis, or the Read Mode commands reply, Reply or mail.

I believe that this change to historic practice was not intended.  The
rationale for mailx seems to carefully point out the cases where the
standard differs from historic practice, but does not mention this issue.



Interpretation response
------------------------
The standard clearly states the behavior of "input mode" and stdin, 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: Apr 5 1995
Proposed resolution circulated: May 16th
Comments due: June 15th
Finalised: June 16th 1995