-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language server crashes with partially-quoted heredoc #266
Comments
@sethp Thanks for your bug report. I am unable to reproduce this at the moment.
I also tried it on the demo site (which is actually a few versions behind due to compatibility issues) and I could not reproduce it there either. ![]() Do you see it crash if you just open VS Code right from the beginning? |
Hmm, you're right: that minimal example was too minimal, sorry. When I tried it again, I got the same crash in the demo site from the full Dockerfile (which I'm happy to provide, it's just A Lot), and narrowed it down to just this example that seems to crash every time I paste it into a freshly-loaded tab:
|
@sethp Thank you very much for your new example! I am able to reproduce the bug and have opened rcjsuen/dockerfile-ast#114 to track this. I will leave this issue opened until the fix has been merged into the language server itself. Have a great weekend! |
Here's the story so far: I'm futzing around with the heredoc support with Dockerfile syntax >=1.3, and it turns out to be excellent at applying small inline patches like so:
RUN <<END_OF_PATCH tee /dev/stderr | git apply diff --git a/file b/file .... END_OF_PATCH
That
tee
is in there because I was getting a strange "patch does not apply", and that's how I learned that the heredoc support is implemented entirely in the parsing front-end and gets turned into a carefully ARGV'd shell command:(NB: this isn't easily copy-pasteable because the shell that invokes
/bin/sh
will do word splitting and turn that into a mess, but that's another story)What this means is that, since a heredoc acts much like a double-quoted shell string, metacharacters (i.e. $) were getting interpreted, changing the contents of my patch from something like
- echo ${HELLO}
to- echo <whatever value of HELLO was in the shell's environment, usually nothing>
. Oops. Well, good thing there's a provision in the shell for a situation like this, I think, and I type this into my editor (on my way to turning the heredoc word into'END_OF_PATCH'
):and, to my surprise, the language server immediately crashes with this output:
In playing around with the demo site (very cool!), I got a similar-looking crash out of this minimal example:
That's definitely invalid syntax, so I'm not sure what the right response for the language server would be, but crashing on the input means that VS Code gives up after the 5th try (~instantaneously, since the startup is so fast).
The text was updated successfully, but these errors were encountered: