Skip to content
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

Semantic tokens calculation enters infinite loop if a variable is followed by an escape character #96

Closed
rcjsuen opened this issue Oct 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Oct 20, 2021

const lib = require("dockerfile-language-service");
const service = lib.DockerfileLanguageServiceFactory.createLanguageService();
service.computeSemanticTokens("FROM $abc\\\ndef");
node_modules/dockerfile-ast/lib/imageTemplate.js:116
        for (let instruction of this.instructions) {
                                     ^

RangeError: Maximum call stack size exceeded
    at Array.values (<anonymous>)
    at Dockerfile.getFROMs (node_modules/dockerfile-ast/lib/imageTemplate.js:116:38)
    at Dockerfile.resolveVariable (node_modules/dockerfile-ast/lib/dockerfile.js:81:31)
    at From.parseVariables (node_modules/dockerfile-ast/lib/instruction.js:545:348)
    at From.getVariables (node_modules/dockerfile-ast/lib/instruction.js:370:42)
    at DockerSemanticTokens.createToken (out/src/dockerSemanticTokens.js:490:48)
    at DockerSemanticTokens.createToken (out/src/dockerSemanticTokens.js:429:50)
    at DockerSemanticTokens.createToken (out/src/dockerSemanticTokens.js:501:26)
    at DockerSemanticTokens.createToken (out/src/dockerSemanticTokens.js:429:50)
    at DockerSemanticTokens.createToken (out/src/dockerSemanticTokens.js:501:26)
@rcjsuen rcjsuen added the bug Something isn't working label Oct 20, 2021
@rcjsuen
Copy link
Owner Author

rcjsuen commented Oct 20, 2021

This is what the Dockerfile looks like in the example code.

FROM $abc\
def

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant