parser: fix parsing broken strings in exec format#80
Merged
lorenzo merged 1 commit intohadolint:masterfrom Mar 7, 2022
Merged
Conversation
- Fix parsing of long strings broken into multiple lines in the exec/JSON format of CMD, RUN and ENTRYPOINT statements - Remove legacy alias `stringLiteral` from Language.Docker.Parser.Prelude When specifying a command with arguments in JSON notation (aka. exec format), sometimes it is useful to break a longer string into several lines. Although this is not legal JSON syntax, it is supported by Docker and results are as expected. Therefore the parser should not fail on these occasions, but rather produce the expected result. In addition to that the parser needs to remove escaped newlines from the resulting string. The legacy alias `stringLiteral` from the Language.Docker.Parser.Prelude module has been removed, because now there is a difference between parsing a double quoted string literal as-is or doing so and removing escaped newlines from the resulting string. The test suite has been reorganized by moving the tests relating to the `CMD` statement into their own submodule. fixes: hadolint/hadolint#783
Member
|
looks great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
exec/JSON format of CMD, RUN and ENTRYPOINT statements
stringLiteralfromLanguage.Docker.Parser.Prelude
When specifying a command with arguments in JSON notation (aka. exec
format), sometimes it is useful to break a longer string into several
lines. Although this is not legal JSON syntax, it is supported by Docker
and results are as expected. Therefore the parser should not fail on
these occasions, but rather produce the expected result. In addition to
that the parser needs to remove escaped newlines from the resulting
string.
The legacy alias
stringLiteralfrom the Language.Docker.Parser.Preludemodule has been removed, because now there is a difference between
parsing a double quoted string literal as-is or doing so and removing
escaped newlines from the resulting string.
The test suite has been reorganized by moving the tests relating to the
CMDstatement into their own submodule.fixes: hadolint/hadolint#783