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

stream: fix Writable instanceof for subclasses #14945

Closed
wants to merge 1 commit into from

Conversation

addaleax
Copy link
Member

The current custom instanceof for Writable subclasses previously
returned false positives for instances of other subclasses of
Writable because it was inherited by these subclasses.

Fixes: #14943

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

stream

@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Aug 19, 2017
@benjamingr
Copy link
Member

LGTM, would love it if you added a test for this.

@addaleax
Copy link
Member Author

@benjamingr Can you be more specific? The test in this PR is basically equivalent to the code snippet from the issue…

@benjamingr
Copy link
Member

Nevermind, I see it is already covered for the reverse case.

@refack
Copy link
Contributor

refack commented Aug 19, 2017

@addaleax made a suggestion for better assertion fail messages that were just out of the scope of this PR, but I felt should be remedied.
Obviously feel free to push this out if you don't like it.

CI: https://ci.nodejs.org/job/node-test-pull-request/9753/

@addaleax
Copy link
Member Author

Yea, removed it. If you want, open a different PR, it’s barely going to conflict.

@refack
Copy link
Contributor

refack commented Aug 19, 2017

Yea, removed it. If you want, open a different PR, it’s barely going to conflict.

Ack

@jasnell
Copy link
Member

jasnell commented Aug 23, 2017

There's too much red in that previous CI run. Trying again: https://ci.nodejs.org/job/node-test-pull-request/9799/ https://ci.nodejs.org/job/node-test-pull-request/9800/

Also, this needs a rebase

@jasnell
Copy link
Member

jasnell commented Aug 23, 2017

Added a commit to resolve the merge conflict. Feel free to drop the extra commit if you'd like @addaleax

The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: nodejs#14943
@addaleax
Copy link
Member Author

I don’t think CI handles merge commits well?

Anyway, I pushed a rebased version

@addaleax
Copy link
Member Author

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

This should be ready.

@addaleax
Copy link
Member Author

Landed in 7ce2555

@addaleax addaleax closed this Aug 24, 2017
@addaleax addaleax deleted the writable-x branch August 24, 2017 19:01
addaleax added a commit that referenced this pull request Aug 24, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: #14943
PR-URL: #14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit to addaleax/ayo that referenced this pull request Aug 25, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: nodejs/node#14943
PR-URL: nodejs/node#14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit to ayojs/ayo that referenced this pull request Aug 28, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: nodejs/node#14943
PR-URL: nodejs/node#14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: #14943
PR-URL: #14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: #14943
PR-URL: #14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

@addaleax should we backport to v6.x? It seems like this could change behavior, even if it were to the correct behavior

@addaleax
Copy link
Member Author

@MylesBorins Yes, I am confident that we should backport this fix.

MylesBorins pushed a commit that referenced this pull request Sep 20, 2017
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.

Fixes: #14943
PR-URL: #14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

done :D 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writable's instanceof implementation is faulty
10 participants