Uh oh!
There was an error while loading. Please reload this page.
lib,test: Use long paths when loading native addons - #2965
Conversation
There was a problem hiding this comment.
style nit: no space after function keyword
justinmchase
commented
Sep 19, 2015
I wanted to add that I tried making a test for this, but that would entail actually loading a native addon (I think). And I couldn't find an example of another test doing that so I'm not sure how to effectively make a test for this. I'm open for input on how best to achieve that. |
Fishrock123
commented
Sep 20, 2015
I don't see a problem with that. It should be cc @bnoordhuis? |
justinmchase
commented
Sep 20, 2015
@Fishrock123 Great, thanks. Looking now. |
justinmchase
commented
Sep 24, 2015
@Fishrock123 I apologize for the delay but based on your feedback I added a unit test that successfully loads the addon from a long path. |
justinmchase
commented
Sep 24, 2015
I tried running eslint like this: But I get a ton of existing errors. The CONTRIBUTING.md documentation just says:
I'm not totally sure that I'm doing it right. |
Fishrock123
commented
Sep 24, 2015
For linting just run
|
066501e to
04e3ff7Comparejustinmchase
commented
Sep 24, 2015
@Fishrock123 Again, thank you for your patience and your help :) I ran the tests and the linter successfully. I rebased my commits into a single commit with a descriptive comment and recently rebased |
There was a problem hiding this comment.
Can you assert.equal(addon.hello(), 'world'); here?
There was a problem hiding this comment.
@justinmchase Are you intentionally comparing against both null and undefined here?
There was a problem hiding this comment.
@thefourtheye I believe I just copied that line from another test doing something similar. However, I think its most accurate to say that addon should be neither null or undefined. So yes it is intentional.
Also, the error case before this PR actually throws an error instead of returning null or undefined. So it's mostly just a sanity check. Same with the following line which actually calls the addon.hello() function, another sanity check.
bnoordhuis
commented
Sep 30, 2015
LGTM but someone from @nodejs/platform-windows should sign off on this, I'm not sure to what extent LoadLibrary() supports UNC paths. |
thefourtheye
commented
Sep 30, 2015
Also, you might want to make sure that the commit is reflected in your GitHub profile. https://help.github.com/articles/setting-your-email-in-git/ |
piscisaureus
commented
Sep 30, 2015
It should work, although a comment on the doc page suggests that it doesn't for 32-bit builds. Did you test this? |
04e3ff7 to
450d406CompareWhen using require to load a native addon the path must be converted into a long path, otherwise the addon will fail to be loaded on windows if the path is longer than 260 characters.
justinmchase
commented
Sep 30, 2015
@piscisaureus I didn't, I only tested on x64. I don't know if I trust that comment but I will make a VM and try it there, it could take a little while. @thefourtheye I think the machine I happened to make this branch on hadn't been configured right but commit itself should have the right email and name now. Sorry for that. |
benjamingr
commented
Sep 30, 2015
LGTM, thanks for this it was a painful issue in the past too :D |
bnoordhuis
commented
Oct 1, 2015
/cc @nodejs/build - I think our Windows CI bots only test 64 bits builds now? |
orangemocha
commented
Oct 1, 2015
@bnoordhuis : correct (even though I would like to fix that). |
justinmchase
commented
Oct 1, 2015
@bnoordhuis@piscisaureus I built an x86 win7 vm and tested it there, confirmed it works on x86 as well. |
justinmchase
commented
Oct 2, 2015
I added a correcting comment to msdn to help prevent confusion in the future: |
bnoordhuis
commented
Oct 3, 2015
Fishrock123
commented
Oct 5, 2015
CI seems happy. |
When using require to load a native addon the path must be converted into a long path, otherwise the addon will fail to be loaded on windows if the path is longer than 260 characters. PR-URL: #2965 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <inglor@gmail.com>
bnoordhuis
commented
Oct 5, 2015
Landed in 8593b3e, thanks Justin. I had to touch up the first line of the commit log to make it fit in <= 50 columns, hope you don't mind. |
When using require to load a native addon the path must be converted into a long path, otherwise the addon will fail to be loaded on windows if the path is longer than 260 characters. PR-URL: #2965 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <inglor@gmail.com>
Currently, it's possible for a native addon on windows to throw an exception during module loading if it's path is too long.
This change resolves the issue by converting the path to the addon to a long path before calling
process.dlopen.Fixes#2964