-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
error message regression in node 13 vs 12 #31284
Comments
cc @nodejs/modules-active-members in case it has to do with loader changes, and in case this can be fixed before it's backported to node 12. |
Does this happen without the shebang as well or is this specific to it? Previously reported issue: nodejs/modules#464 |
This bug can reproduced in pure V8. I'd suggest reporting it upstream. |
Out of curiosity, how do you test that? |
I'll file it upstream (testing details would help), but upgrading v8 in node 12 seems like a problem since it will break the usefulness of error messages in an LTS node, so upstream or not, it seems like something we'd have to address :-/ |
> vm.createScript('#!/usr/bin/env node\n\n\'syntax error').runInThisContext()
evalmachine.<anonymous>:1
#!/usr/bin/env node
^
Uncaught SyntaxError: Invalid or unexpected token
> vm.createScript('#!/usr/bin/env node\n\n42-').runInThisContext()
evalmachine.<anonymous>:3
42-
Uncaught SyntaxError: Unexpected end of input Looks like it's specific to certain kinds of SyntaxError only? |
@jkrems The issues are actually unrelated. Note where the arrow is pointing @SMotaal's issue. @GeoffreyBooth I have a local checkout and build of V8, which includes a command-line debugging tool called d8. https://v8.dev/docs/d8 |
Filed https://bugs.chromium.org/p/v8/issues/detail?id=10110, it'd be great if folks helped flesh it out. |
@devsnek given that the node 13 error comes from at |
@ljharb Since the same (bad) behavior can be seen without |
The v8 behavior seems to be fixed (according to the v8 issue)! I'm not sure which version of v8 it will land in, nor which version of node. It'd be great if someone in @nodejs/v8 could update this issue :-) |
It landed after the branch cut for 8.1 which means so far it only landed in 8.2 releases. Not sure how likely it is to be backported to 7.8 or 7.9 unless we actively pursue it. |
Requested backport to 8.1 on the upstream bug. I think it's unlikely they'll backport to 7.9 (and even more unliekly to 7.8), so we should look into floating patches to fix it on v12 and v13. |
Original commit message: Fix scanner-level error reporting for hashbang When the file begins with a hashbang, the scanner is in a failed state when SkipHashbang() is called. This is usually not an issue but when the parser encounters an ILLEGAL token, it will reset the SyntaxError location because of it. Bug: v8:10110 Change-Id: I1c7344bf5ad20079cff80130c991f3bff4d7e9a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995312 Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#66038} Refs: v8/v8@f925780 Fixes: nodejs#31284 Signed-off-by: Matheus Marchini <[email protected]>
Original commit message: Fix scanner-level error reporting for hashbang When the file begins with a hashbang, the scanner is in a failed state when SkipHashbang() is called. This is usually not an issue but when the parser encounters an ILLEGAL token, it will reset the SyntaxError location because of it. Bug: v8:10110 Change-Id: I1c7344bf5ad20079cff80130c991f3bff4d7e9a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995312 Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#66038} Refs: v8/v8@f925780 Fixes: #31284 Signed-off-by: Matheus Marchini <[email protected]> PR-URL: #32180 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Just a heads up: with the upgrade of V8 on master, this bug resurfaced. I'm trying to get it back ported upstream so we don't have to float another patch. If we get close to the release date for v14.x and it's not backported upstream yet, I'll float the patch again. I'll reopen it just to keep track, but it shouldn't affect any of the existing release lines. |
Original commit message: Fix scanner-level error reporting for hashbang When the file begins with a hashbang, the scanner is in a failed state when SkipHashbang() is called. This is usually not an issue but when the parser encounters an ILLEGAL token, it will reset the SyntaxError location because of it. Bug: v8:10110 Change-Id: I1c7344bf5ad20079cff80130c991f3bff4d7e9a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995312 Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#66038} Refs: v8/v8@f925780 Fixes: #31284 Signed-off-by: Matheus Marchini <[email protected]> PR-URL: #32180 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Original commit message: Fix scanner-level error reporting for hashbang When the file begins with a hashbang, the scanner is in a failed state when SkipHashbang() is called. This is usually not an issue but when the parser encounters an ILLEGAL token, it will reset the SyntaxError location because of it. Bug: v8:10110 Change-Id: I1c7344bf5ad20079cff80130c991f3bff4d7e9a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995312 Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/master@{#66038} Refs: v8/v8@f925780 Fixes: #31284 Signed-off-by: Matheus Marchini <[email protected]> PR-URL: #32180 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
I assume this is resolved now. |
With this file,
tmp
, with+x
permissions:node tmp
in node 12 /nvm run 12 tmp
begets:node tmp
in node 13.6 /nvm run 13 tmp
begets:The error message in node 13 was highly confusing and I had no idea where the syntax error was in the actual file (which was obviously much larger) until I thought to test it in node 12.
The text was updated successfully, but these errors were encountered: