Skip to content

Conversation

@princejwesley
Copy link
Contributor

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

repl

Description of change

Transformed function XXX(...) to var XXX = function XXX(...) in order to mitigate vm #548 function redefinition issue

Before
node 🙈git:(master)./node>process.version'v7.0.0-pre'>functionname(){return"node";};undefined>name()'node'>functionname(){return"nodejs";};undefined>name()'node'// should be 'nodejs'>
After
node 🙈git:(upstreamrepl-tmp-548)./node>functionname(){return"node";};undefined>name()'node'>functionname(){return"nodejs";};undefined>name()'nodejs'>

```js node 🙈 ₹ git:(upstream ⚡ repl-tmp-548) ./node > function name(){return "node"}; undefined > name() 'node' > function name(){return "nodejs"}; undefined > name() 'nodejs' > ```
@nodejs-github-botnodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Jul 8, 2016
// or block comment. https://github.com/nodejs/node/issues/3611
{client: client_unix,send: 'a = 3.5e',
expect: /^SyntaxError:Invalidorunexpectedtoken/},
// Mitigate #548 issue
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I'd prefer this be the full URL to the issue rather than just the issue number. (Some issues scattered throughout the code are in nodejs/node-archive (formerly joyent/node, I believe) rather than nodejs/node and using the full URL eliminates guesswork. (Not the comment 3 lines above contains a full issue URL.)

@addaleax
Copy link
Member

LGTM

Btw, there’s one edge case with unexpected results that will enabled by this change:

>functiona(){return42;}()undefined>a42

I think it’s okay to accept that as a side effect, though.

CI: https://ci.nodejs.org/job/node-test-commit/4035/

@Trott
Copy link
Member

Maybe add the edge case identified by @addaleax as a known-issues test?


const expected = '1\n[Function a]\n'
const got = r.output.accumulator.join('');
assert.equal(got, expected);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use strict version

@thefourtheye
Copy link
Contributor

Change LGTM, pending CI. We should accept that this will change multiline strings and comments as well.

@princejwesley
Copy link
ContributorAuthor

princejwesley commented Jul 10, 2016

... We should accept that this will change multiline strings and comments as well.

@thefourtheye I am not quite sure what you meant.

@thefourtheye
Copy link
Contributor

thefourtheye commented Jul 11, 2016

This will replace the definitions even if they are defined within comments or mutiline strings, right?

Edit: nvm. This PR doesn't concern Strings and comments. LGTM stays.

@lance
Copy link
Member

lance commented Jul 15, 2016

LGTM
New CI: https://ci.nodejs.org/job/node-test-pull-request/3302/
Flakey unrelated failure

@lance
Copy link
Member

Landed in bb9eabe

@lancelance closed this Jul 15, 2016
addaleax referenced this pull request Jul 17, 2016
```js node 🙈 ₹ git:(upstream ⚡ repl-tmp-548) ./node > function name(){return "node"}; undefined > name() 'node' > function name(){return "nodejs"}; undefined > name() 'nodejs' > ``` Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Lance Ball <[email protected]>
@evanlucas
Copy link
Contributor

This isn't landing cleanly on v6.x Mind sending a backport PR to v6.x? Thanks!

@princejwesley
Copy link
ContributorAuthor

@evanlucas branch name?

@lance
Copy link
Member

@princejwesley v6.x

fhinkel added a commit to v8/node that referenced this pull request Sep 18, 2016
deps: update V8 to 6a72f3 Fixesnodejs#548 Makes nodejs#7624 unnecessary.
aqrln added a commit to aqrln/node that referenced this pull request Mar 9, 2017
`test/known_issues/test-repl-function-redefinition-edge-case.js` had been introduced as a part of nodejs#7624 but the meat of the test became fixed in 007386e. Despite that, the test continued to fail since it was broken itself: there was a missing colon in the expected output. This commit adds the missing colon and moves the test from `test/known_issues` to `test/parallel`.
jasnell pushed a commit that referenced this pull request Mar 15, 2017
`test/known_issues/test-repl-function-redefinition-edge-case.js` had been introduced as a part of #7624 but the meat of the test became fixed in 007386e. Despite that, the test continued to fail since it was broken itself: there was a missing colon in the expected output. This commit adds the missing colon and moves the test from `test/known_issues` to `test/parallel`. PR-URL: #11772 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Mar 20, 2017
`test/known_issues/test-repl-function-redefinition-edge-case.js` had been introduced as a part of nodejs#7624 but the meat of the test became fixed in 007386e. Despite that, the test continued to fail since it was broken itself: there was a missing colon in the expected output. This commit adds the missing colon and moves the test from `test/known_issues` to `test/parallel`. PR-URL: nodejs#11772 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
`test/known_issues/test-repl-function-redefinition-edge-case.js` had been introduced as a part of nodejs#7624 but the meat of the test became fixed in 007386e. Despite that, the test continued to fail since it was broken itself: there was a missing colon in the expected output. This commit adds the missing colon and moves the test from `test/known_issues` to `test/parallel`. PR-URL: nodejs#11772 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@princejwesley@addaleax@Trott@thefourtheye@lance@evanlucas@MylesBorins@nodejs-github-bot