View Issue Details

IDProjectCategoryView StatusLast Update
00010971003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2016-10-27 18:09
ReporterMark_Galeck Assigned To 
PrioritynormalSeverityEditorialTypeError
Status ClosedResolutionWithdrawn 
NameMark Galeck
Organization
User Reference
Section2.10.2 Shell Grammar Rules
Page Number2376, 2379
Line Number75919, 75920, 76068, 76069
Interp Status---
Final Accepted Text
Summary0001097: Shell Grammar rule 4 is nonsense that conflicts with existing implementations
DescriptionAccording to the production

pattern: WORD /* Apply rule 4 */

the input:

case foobar in (esac) esac

should not accept, because the first 'esac' would be identified as token Esac, and not WORD, according to rule 4.

This is of course nonsense, and indeed, both dash and bash have no problem accepting the above.

Moreover, the production

pattern : pattern '|' WORD /* Do not apply rule 4 */

is nonsense as well. Because we are told that rule 4 does not apply, we apply the default rule 1, according to which, again, 'esac' would be Esac here, not WORD, so that

 case foobar in (esac|esac) esac

should again not accept. But of course it does in the existing implementations, as well it should.
Desired ActionNuke rule 4, it makes no sense and does not apply, anywhere.

Change the pattern productions to:

pattern: WORD /*TOKEN is always WORD here*/
        | pattern '|' WORD /*TOKEN is always WORD here*/
TagsNo tags attached.

Activities

geoffclare

2016-10-21 08:32

manager   bugnote:0003447

I agree there is a problem here, but the suggested solution is not right.

Rule 4 is needed for this case:

$ case foobar in
> esac)
-bash: syntax error near unexpected token `)'

Maybe there is a way to fix it by rewording rule 4 to distinguish between pattern) and (pattern). If not, we'll need to change the grammar somehow (perhaps by introducing a pattern_or_esac production).

Mark_Galeck

2016-10-27 12:43

reporter   bugnote:0003461

This report is included in the summary report 1100 and can be cancelled.

Don Cragun

2016-10-27 18:09

manager   bugnote:0003474

Withdrawn by submitter per 0001097:0003461

Issue History

Date Modified Username Field Change
2016-10-20 15:24 Mark_Galeck New Issue
2016-10-20 15:24 Mark_Galeck Name => Mark Galeck
2016-10-20 15:24 Mark_Galeck Section => 2.10.2 Shell Grammar Rules
2016-10-20 15:24 Mark_Galeck Page Number => 2376, 2379
2016-10-20 15:24 Mark_Galeck Line Number => 75919, 75920, 76068, 76069
2016-10-21 08:32 geoffclare Note Added: 0003447
2016-10-27 12:43 Mark_Galeck Note Added: 0003461
2016-10-27 18:09 Don Cragun Interp Status => ---
2016-10-27 18:09 Don Cragun Note Added: 0003474
2016-10-27 18:09 Don Cragun Status New => Closed
2016-10-27 18:09 Don Cragun Resolution Open => Withdrawn