Discussion:
[1003.1(2013)/Issue7+TC1 0000839]: problems with reduction of WORD to ASSIGNMENT_WORD
Austin Group Bug Tracker
2014-05-08 18:51:21 UTC
Permalink
The following issue has been SUBMITTED.
======================================================================
http://austingroupbugs.net/view.php?id=839
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 839
Category: Shell and Utilities
Type: Error
Severity: Objection
Priority: normal
Status: New
Name: Richard Hansen
Organization: BBN
User Reference:
Section: 2.10.2 (Shell Grammar Rules) rule 7.b.
Page Number: 2349
Line Number: 74755-74761
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-05-08 18:51 UTC
Last Modified: 2014-05-08 18:51 UTC
======================================================================
Summary: problems with reduction of WORD to ASSIGNMENT_WORD
Description:
XCU 2.10.2 rule 7.b. has the following issues:
* Rule 7.b. should not return WORD -- it should instead defer to
rule 1 to allow implementations to add reserved words that contain
equals signs.
* The rule is missing the "else" case (it should say to apply rule 1
if there is no <equals-sign> character).
* Neither quoted <equals-sign> characters nor <equals-sign>
characters in embedded parameter expansion, command substitution,
or arithmetic expansion constructs should be considered when
determining whether to apply rule 1 or return ASSIGNMENT_WORD.

Note that the last bullet point above is the subject of
http://austingroupbugs.net/view.php?id=643. The
resolution of http://austingroupbugs.net/view.php?id=643 does not completely
solve the described problem,
repeated here:

Each of the following:
${foo=bar}
$(foo=bar; baz)
$((foo=bar))
~foo=bar/baz
"foo=bar"
foo\=bar
is one token according to XCU 2.3. According to XCU 2.10.2, the tokens
match cmd_name, so rule 7a is applied. Each token contains an equals sign,
so rule 7a says to apply rule 7b. The tokens do not begin with '=', nor do
all characters preceding '=' form a valid name, so according to 7b it is
unspecified whether ASSIGNMENT_WORD or WORD is returned. All of these
cases should return WORD.
Desired Action:
After applying the changes in http://austingroupbugs.net/view.php?id=643, change
XCU 2.10.2 (Shell
Grammar Rules) rule 7.b. page 2349 lines 74755-74761 from:

If the TOKEN contains the <equals-sign> character:

* If it begins with '=', the token WORD shall be returned.
* If all the characters in the TOKEN preceding the first '='
form a valid name (see XBD Section 3.231), the token
ASSIGNMENT_WORD shall be returned. (Quoted characters cannot
participate in forming a valid name.)
* Otherwise, it is unspecified whether it is ASSIGNMENT_WORD or
WORD that is returned.

to:

If the TOKEN contains an unquoted (as determined while applying
rule #4 from section 2.3) <equals-sign> character that is not part
of an embedded parameter expansion, command substitution, or
arithmetic expansion construct (as determined while applying rule
#5 from section 2.3):

* If the TOKEN begins with '=', then rule 1 shall be applied.
* If all the characters in the TOKEN preceding the first such
<equals-sign> form a valid name (see XBD Section 3.231), the
token ASSIGNMENT_WORD shall be returned. (Quoted characters
cannot participate in forming a valid name.)
* Otherwise, it is unspecified whether rule 1 is applied or
ASSIGNMENT_WORD is returned.

Otherwise, rule 1 shall be applied.

======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-05-08 18:51 rhansen New Issue
2014-05-08 18:51 rhansen Name => Richard Hansen
2014-05-08 18:51 rhansen Organization => BBN
2014-05-08 18:51 rhansen Section => 2.10.2 (Shell
Grammar Rules) rule 7.b.
2014-05-08 18:51 rhansen Page Number => 2349
2014-05-08 18:51 rhansen Line Number => 74755-74761
======================================================================
Loading...