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

Implemented Nan and aligned to segfault_handler naming convention #14

Merged
merged 1 commit into from
Oct 1, 2014

Conversation

No9
Copy link
Collaborator

@No9 No9 commented Sep 24, 2014

This is a breaking change as it names the module segfault_handler with an underscore to make the build and sample code work.
On the upside it implements Nan change and so should run on later version of node.
Would recommend publishing in npm as segfault_handler too for consistency and maybe removing/deprecating the current 2.1 in there.

Implemented Nan Aligned to segfault_handler naming convention
@No9 No9 mentioned this pull request Sep 25, 2014
@ddopson
Copy link
Owner

ddopson commented Sep 28, 2014

I'm not sure I understand what these new NaN macros do in 0.11. Is there a short explanation?

@No9
Copy link
Collaborator Author

No9 commented Sep 28, 2014

Nan is an external project https://github.com/rvagg/nan not part of node v.11 or 0.12.

The nan macros provide insulation from the different versions of V8 used within the different versions of node.js (0.8 0.10 and 0.11)

Where there are differences in implementation such as the one that was raised in this issue
#13

The Nan project is contributed to by Ben Noordhuis and TJ Fontaine from core so it is well regarded.
It has also been implemented by the leveldb community so it is well exercised too.

@ddopson
Copy link
Owner

ddopson commented Sep 30, 2014

Hmm. very interesting. C++ compat between node versions has been a huge mess.

So are you saying that this PR is ready to merge, safe, tested, and should't regress or break any scenarios? If so, I can take your word for it and hit "merge".

It's on my TODO list to go through this module and test all these damned versions and cut an update that addresses all the know issues. I feel like a terrible maintainer, but right now, I don't even have 1 version of Node installed on my own dev box!

@@ -6,7 +6,7 @@ Using the module is as simple as:

```javascript

var SegfaultHandler = require('segfault-handler');
var SegfaultHandler = require('segfault_handler');
Copy link
Owner

Choose a reason for hiding this comment

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

Why does this need to change? Does a dash break something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It makes it consistent and I chose to go this way as this is how it's defined in
https://github.com/ddopson/node-segfault-handler/blob/master/src/segfault-handler.cpp#L97
It is recommended that the addon name is consistent with the name of the module.
More details here

http://nodejs.org/api/addons.html#addons_addon_patterns
Specifically
The module_name needs to match the filename of the final binary (minus the .node suffix).

@No9
Copy link
Collaborator Author

No9 commented Sep 30, 2014

I am happy that this pull works as expected on my environment.
I would be nice if we could move example.js to a test maybe use tap if your open to it?
https://github.com/isaacs/node-tap

On the multiple versions of node I would suggest we drop this in at some point.
https://github.com/rvagg/dnt
I find it very useful.

ddopson added a commit that referenced this pull request Oct 1, 2014
Implemented Nan and aligned to segfault_handler naming convention
@ddopson ddopson merged commit 48ea017 into ddopson:master Oct 1, 2014
@ddopson
Copy link
Owner

ddopson commented Oct 1, 2014

I took your pull request, but added a patch to switch the name back to 'segfault-handler'. I tested and with the dash in the name, the build still works. At least on my machine. Let me know if you have trouble building it on your machine.

I like the idea of testing, but testing a segfault is tricky. Perhaps I can take the callback patch and use that for testing.

I VERY much like the idea of testing multiple node versions.

@No9
Copy link
Collaborator Author

No9 commented Oct 2, 2014

Thanks for taking the patch :)
I have an initial dnt implementation in my fork
https://github.com/No9/node-segfault-handler/blob/master/.dntrc
Which runs a simple test
https://github.com/No9/node-segfault-handler/blob/master/tests/child-test.js

If you install docker then DNT you can checkout my master and see it working
https://www.npmjs.org/package/dnt for instructions.

The good news is that this patch compiles on v0.11.14 and v0.10.32 and passes OK.
I am going to be busy for the next few days so I wont get chance to do the callback but thought I would share the progress.

@ddopson
Copy link
Owner

ddopson commented Oct 4, 2014

Sweet. Thanks for the contributions. Btw, are you using this for work or
a personal thing?

If you are curious, https://www.linkedin.com/in/davedopson. I use 0
node.js at Google, so maintaining my repos is a pure hobby thing at this
point.

Also, do you use anything to keep track of Github pull requests? I never
find out about them till I open the project months later. Their notifs
model is pretty busted.

--- Dave

On Wed, Oct 1, 2014 at 5:47 PM, Anton Whalley [email protected]
wrote:

Thanks for taking the patch :)
I have an initial dnt implementation in my fork
https://github.com/No9/node-segfault-handler/blob/master/.dntrc
Which runs a simple test

https://github.com/No9/node-segfault-handler/blob/master/tests/child-test.js

If you install docker then DNT you can checkout my master and see it
working
https://www.npmjs.org/package/dnt for instructions.

The good news is that this patch compiles on v0.11.14 and v0.10.32 and
passes OK.
I am going to be busy for the next few days so I wont get chance to do the
callback but thought I would share the progress.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@ddopson
Copy link
Owner

ddopson commented Oct 4, 2014

oh, this posts on the bug doesn't it. Sigh. whatever.

On Fri, Oct 3, 2014 at 10:20 PM, Dave Dopson [email protected] wrote:

Sweet. Thanks for the contributions. Btw, are you using this for work or
a personal thing?

If you are curious, https://www.linkedin.com/in/davedopson. I use 0
node.js at Google, so maintaining my repos is a pure hobby thing at this
point.

Also, do you use anything to keep track of Github pull requests? I never
find out about them till I open the project months later. Their notifs
model is pretty busted.

--- Dave

On Wed, Oct 1, 2014 at 5:47 PM, Anton Whalley [email protected]
wrote:

Thanks for taking the patch :)
I have an initial dnt implementation in my fork
https://github.com/No9/node-segfault-handler/blob/master/.dntrc
Which runs a simple test

https://github.com/No9/node-segfault-handler/blob/master/tests/child-test.js

If you install docker then DNT you can checkout my master and see it
working
https://www.npmjs.org/package/dnt for instructions.

The good news is that this patch compiles on v0.11.14 and v0.10.32 and
passes OK.
I am going to be busy for the next few days so I wont get chance to do
the callback but thought I would share the progress.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@ddopson
Copy link
Owner

ddopson commented Oct 4, 2014

Oh, spawning a child process for the test. That seems so obvious now that
I see it.

On Fri, Oct 3, 2014 at 10:20 PM, Dave Dopson [email protected] wrote:

oh, this posts on the bug doesn't it. Sigh. whatever.

On Fri, Oct 3, 2014 at 10:20 PM, Dave Dopson [email protected] wrote:

Sweet. Thanks for the contributions. Btw, are you using this for work
or a personal thing?

If you are curious, https://www.linkedin.com/in/davedopson. I use 0
node.js at Google, so maintaining my repos is a pure hobby thing at this
point.

Also, do you use anything to keep track of Github pull requests? I never
find out about them till I open the project months later. Their notifs
model is pretty busted.

--- Dave

On Wed, Oct 1, 2014 at 5:47 PM, Anton Whalley [email protected]
wrote:

Thanks for taking the patch :)
I have an initial dnt implementation in my fork
https://github.com/No9/node-segfault-handler/blob/master/.dntrc
Which runs a simple test

https://github.com/No9/node-segfault-handler/blob/master/tests/child-test.js

If you install docker then DNT you can checkout my master and see it
working
https://www.npmjs.org/package/dnt for instructions.

The good news is that this patch compiles on v0.11.14 and v0.10.32 and
passes OK.
I am going to be busy for the next few days so I wont get chance to do
the callback but thought I would share the progress.


Reply to this email directly or view it on GitHub
#14 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants