colis-anr / morbig

A static parser for POSIX Shell
Other
190 stars 8 forks source link

Assert failure when parsing Git conflicts #76

Closed Niols closed 5 years ago

Niols commented 5 years ago

Try running Morbig on:

<<<<<<< HEAD
foo
=======
bar
>>>>>>> master

You'll get:

Fatal error: exception File "src/hereDocument.ml", line 70, characters 4-10: Assertion failed

while Dash goes:

Syntax error: redirection unexpected

It's not an issue to reject this script. It is one not to fail gracefully.

treinen commented 5 years ago

the question is whether the standard allows a word starting on "<<" as a delimiter for a here document.

treinen commented 5 years ago

If I read correctly section 2.3 of the standard ("token recognition"), reading two < signs results in emitting a token for the operator DLESS, and then continues scanning the rest.