-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
test: add duplicate symbol test #1689
test: add duplicate symbol test #1689
Conversation
16e8cdf
to
f6c37a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if setting this by default could be breaking for any existing addons?
f6c37a4
to
c67bd33
Compare
@richardlau addons are not built with It seems that the involuntary exposure of all the symbols has so far caused few problems. Nevertheless, the test in this PR and the issue this PR references indicate that there are problems with unwittingly exposing symbols on OSX. The problem in the wild can arise from having a large application that has two dependencies, each of which depends on (perhaps a different version of) a native addon. When this addon is loaded from two different places in the dependency tree into the same process, and if this addon exposes symbols using this I guess the point of discussion should be whether we should takes this opportunity to start building addons with Can we test this change with CITGM? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Gabriel, LGTM % nits.
"target_defaults": { | ||
"include_dirs": [ | ||
"<!(node -e \"require('nan')\")" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go? The add-on doesn't use nan (doesn't even depend on it in package.json.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it does use nan. I added the dependency to package.json.
b2acb66
to
a5052ab
Compare
@bnoordhuis thanks for the review! I have addressed the nits. |
a5052ab
to
39e63db
Compare
39e63db
to
f63ac42
Compare
Rebased to fix conflicts. |
I think we'll need to tweak the CITGM CI script, but @gabrielschulhof you can run CITGM locally on mac. It's as simple as:
But you'll need to transplant a fixed version of node-gyp into |
@refack the Mac machine I have access to is behind a proxy server, so I'm seeing some failures that might be related to that. I'll request access to a CI mac. Let's see if I can run the citgm there. |
@refack I tried running citgm-all on the Mac to which I received access, but, unfortunately, it fails in lots of places even without replacing node-gyp. Thus, I have no firm basis against which to perform such a test. |
I'm fine with getting this merged but could someone come up with a semver-* label for it? I don't really know. Seems potentially semer-major to me, but maybe not? |
@rvagg for this to be semver-major there would have to be addons which, upon loading, assume the existence of symbols provided by other addons, symbols which are not explicitly marked |
On OSX symbols are exported by default, and they overlap if two different copies of the same symbol appear in a process. This change ensures that, on OSX, symbols are hidden by default. Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
On OSX symbols are exported by default, and they overlap if two different copies of the same symbol appear in a process. This change ensures that, on OSX, symbols are hidden by default. Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
I changed the commit msg to have a "build,test" prefix and landed in 8b7fdd1. I'm still having trouble with the semveriness of this. semver-minor at least? I don't think I'll include this in 5.0.1 but maybe it should be in a 5.1.0? |
@gabrielschulhof would you mind revisiting this please? I've just noticed the tests fail with Node 12 on macOS, the addon is using a bare |
This works: diff --git a/test/node_modules/duplicate_symbols/binding.cc b/test/node_modules/duplicate_symbols/binding.cc
index bc5f6f5..a0999b7 100644
--- a/test/node_modules/duplicate_symbols/binding.cc
+++ b/test/node_modules/duplicate_symbols/binding.cc
@@ -2,9 +2,9 @@
#include "common.h"
void Init(v8::Local<v8::Object> exports) {
- exports->Set(Nan::New("pointerCheck").ToLocalChecked(),
- Nan::New<v8::FunctionTemplate>(Something::PointerCheck)
- ->GetFunction());
+ Nan::Set(exports, Nan::New("pointerCheck").ToLocalChecked(),
+ Nan::GetFunction(
+ Nan::New<v8::FunctionTemplate>(Something::PointerCheck)).ToLocalChecked());
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Init) since this is already merged, maybe push a new commit here and I'll merge that on top of master. |
oh, and update the "nan" version in package.json when you're in there too I think. |
f63ac42
to
36f1a0d
Compare
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8 equivalents to avoid OSX test failures with Node.js v12.x. Thanks @rvagg!
36f1a0d
to
201a672
Compare
@rvagg I made the changes you asked for. I'm not sure if the change I made to the version of nan requested in the test's package.json is the one you had in mind. After all, the existing ^2.0.0 should result in the latest version of nan getting pulled, right? |
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8 equivalents to avoid OSX test failures with Node.js v12.x. Thanks @rvagg! Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Rod Vagg <rod@vagg.org>
great, thanks. and yes you're right about the ^2, my local version was old. landed in af0d7b8 |
On OSX symbols are exported by default, and they overlap if two different copies of the same symbol appear in a process. This change ensures that, on OSX, symbols are hidden by default. Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8 equivalents to avoid OSX test failures with Node.js v12.x. Thanks @rvagg! Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Rod Vagg <rod@vagg.org>
On OSX symbols are exported by default, and they overlap if two different copies of the same symbol appear in a process. This change ensures that, on OSX, symbols are hidden by default. Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8 equivalents to avoid OSX test failures with Node.js v12.x. Thanks @rvagg! Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Rod Vagg <rod@vagg.org>
On OSX symbols are exported by default, and they overlap if two different copies of the same symbol appear in a process. This change ensures that, on OSX, symbols are hidden by default. Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
Use `Nan::Set()` and `Nan::GetFunction()` instead of their V8 equivalents to avoid OSX test failures with Node.js v12.x. Thanks @rvagg! Re: nodejs/node-addon-api#456 Fixes: nodejs/node#26765 PR-URL: #1689 Reviewed-By: Rod Vagg <rod@vagg.org>
On OSX symbols are exported by default, and they overlap if two
different copies of the same symbol appear in a process. This change
ensures that, on OSX, symbols are hidden by default.
Re: nodejs/node-addon-api#456
Checklist
npm install && npm test
passesDescription of change