-
-
Notifications
You must be signed in to change notification settings - Fork 37.4k
node -c rejects BOM before #!, but node accepts it #27767
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
Activity
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Version: v12.1.0
The bug is that
check_syntax.jscallstripShebangbeforestripBOM, but the actual loader calls stripBOM before stripShebag.It's not totally clear which behavior is desired. The original bug which lead to the introduction of
stripBOMactually had a script with a BOM preceding the#!, though the test included in that commit doesn't. But unix systems generally require the#!to be the first two bytes for it to be parsed as an interpreter directive, which means it cannot be preceded by a BOM.