Harald van Dijk <[email protected]> wrote, on 07 Jan 2019:
>
> On 07/01/2019 10:10, Geoff Clare wrote:
> >Okay, so along with a fix for the comment issue you and Harald discussed
> >recently, here's an updated version of that whole paragraph:
> >
> >     If the value of the alias is not a simple command (see Section 2.9.1)
> >     minus the terminating control operator, or if the value is a simple
> >     command minus the terminating control operator but contains a
> >     variable assignment or redirection, the behavior is unspecified.
> >     When a word is subject to alias substitution, the value of the alias
> >     shall be processed to form tokens (see Section 2.3) and the tokens
> >     shall replace the word, unless the shell is currently processing an
> >     alias of the same name, in which case the word shall not be replaced
> >     in order to prevent infinite loops in recursive aliasing (see below).
> >     If a comment would be discarded during token recognition, the behavior
> >     is unspecified.
> >
> >(This also fixes another problem I noticed, which is that 2.9.1 says a
> >simple command is "terminated by a control operator".  The terminator
> >should not be allowed in aliases.)
> 
> The description of forming tokens makes sense to me and I think the bit
> about comments addresses my concerns, thank you.
> 
> The thing about control operators is a good point, but really, is it not a
> bug for Simple Commands to say that a simple command is terminated by a
> control operator in the first place? All shells accept
> 
>   eval "echo hello"
> 
> This is a simple command without any control operator to terminate it.

The definition of control operator in XBD 3.113 says that end-of-input
is considered to be a control operator.

> It already follows from the grammar that *if* a control operator is seen, it
> cannot be taken as part of the simple command.

Good point.  Perhaps it would be best to remove "terminated by a control
operator" from 2.9.1 as it misleadingly implies that the terminator is
part of the simple command (the same way a <newline> is part of the line
it terminates).  Removing it would not alter the standard, as 2.10 says
that the formal grammar has precedence over the text syntax description.

-- 
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

Reply via email to