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

repl: do not run --eval code if there is none #27587

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented May 6, 2019

getOptionValue('--eval') always returns a string, so it is never
loose-equal to null. Running eval makes some modifications to the
global object, including setting module to a different value, which
we want to avoid if possible.

Refs: #27278
Fixes: #27575

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.

Refs: nodejs#27278
Fixes: nodejs#27575
@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax added the repl Issues and PRs related to the REPL subsystem. label May 6, 2019
@BridgeAR
Copy link
Member

BridgeAR commented May 6, 2019

@addaleax this keeps on failing? Does it maybe only fix some cases? (I did not check closer)

@addaleax
Copy link
Member Author

addaleax commented May 6, 2019

@BridgeAR Yes, thanks for pointing that out – my test was better than my code. I’ve added another commit that should solve that issue (and probably technically renders the former commit unnecessary, but I still think it’s more correct this way).

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 10, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should lib/internal/main/eval_string.js be fixed as well?

@addaleax
Copy link
Member Author

@joyeecheung I don’t think so, because at that point it’s already clear that there is an --eval argument present (unless I’m misunderstanding what you’re saying)

@addaleax
Copy link
Member Author

Landed in 1d31c68...b230833

@addaleax addaleax closed this May 12, 2019
@addaleax addaleax deleted the fix-27575 branch May 12, 2019 13:40
addaleax added a commit that referenced this pull request May 12, 2019
`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.

Refs: #27278
PR-URL: #27587
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax added a commit that referenced this pull request May 12, 2019
PR-URL: #27587
Fixes: #27575
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@joyeecheung
Copy link
Member

@addaleax ah, right, in that case there is already a env->options()->has_eval_string check in the C++ before the main script is run..

targos pushed a commit that referenced this pull request May 13, 2019
`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.

Refs: #27278
PR-URL: #27587
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
targos pushed a commit that referenced this pull request May 13, 2019
PR-URL: #27587
Fixes: #27575
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@BridgeAR BridgeAR mentioned this pull request May 21, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong root module in REPL
10 participants