Repository navigation
error message regression in node 13 vs 12 #31284
Description
Activity
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
- addedv8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
on Jan 9, 2020 This bug can reproduced in pure V8. I'd suggest reporting it upstream.
Reacted by mary marchiniThis bug can reproduced in pure V8. I'd suggest reporting it upstream.
Out of curiosity, how do you test that?
Reacted by Jordan Harband and 6DammK9I'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?
Reacted by snek@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
wrapSafe (internal/modules/cjs/loader.js:1060:16), doesn't that imply it's an issue in node's CJS loader and not in v8?@ljharb Since the same (bad) behavior can be seen without
wrapSafe, I think there's definitely still a V8 bug. Once the V8 behavior is fixed, we could see if there's a secondary bug in node as well.Reacted by Jordan HarbandThe 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.
Reacted by Jordan HarbandRequested 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.
Reacted by Jordan HarbandReacted by Jordan Harband- added a commit that references this issue
on Mar 10, 2020 - added a commit that references this issue
on Mar 17, 2020 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.
Reacted by snek and Michael DawsonReacted by Jordan Harband and pramodsarwarReacted by Jordan Harband- added a commit that references this issue
on Mar 24, 2020 - added a commit that references this issue
on Apr 22, 2020 I assume this is resolved now.
With this file,
tmp, with+xpermissions:node tmpin node 12 /nvm run 12 tmpbegets:node tmpin node 13.6 /nvm run 13 tmpbegets: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.