-
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
gyp: Export LD_LIBRARY_PATH quoted in case $(builddir) contains spaces #1277
Conversation
Tar version 3 performs better and is more well tested than its predecessor. npm will be using this in the near future, so there is no benefit in shipping a node-gyp that uses the slower and less reliable fstream-based tar. This drops support for node 0.x, and thus should be considered a breaking semver-major change. PR-URL: nodejs#1212 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* dropping support for node < 4 * signal the CI not to test node < 4
If you're providing a path to a header tarball to install, you probably want it to always be re-installed. PR-URL: nodejs#1220 Fixes: nodejs#1216 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
* test: build simple addon in path with non-ascii characters * test: add test-charmap.py PR-URL: nodejs#1203 Reviewed-By: Refael Ackermann <refack@gmail.com>
Enable linking to the platform specific installation instructions PR-URL: nodejs#1225 Reviewed-By: Refael Ackermann <refack@gmail.com>
Lifted verbatim from https://github.com/nodejs/node/blob/master/CONTRIBUTING.md then `s/Node.js/node-gyp/`. PR-URL: nodejs#1229 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Give users reporting bugs a clearer idea of the info that will be helpful when reporting issues. PR-URL: nodejs#1228 Refs: https://github.com/nodejs/node/tree/master/.github Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When actions are run, they're preceded by an update to the LD_LIBRARY_PATH environment variable. If $(builddir) includes any special shell characters, then the action will fail to run and the build will fail.
Hello @melloc, thank you for the contribution. |
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.
2 nits
@@ -916,11 +916,12 @@ def WriteActions(self, actions, extra_sources, extra_outputs, | |||
# libraries, but until everything is made cross-compile safe, also use | |||
# target libraries. | |||
# TODO(piman): when everything is cross-compile safe, remove lib.target | |||
self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:' | |||
'$(builddir)/lib.target:$$LD_LIBRARY_PATH; ' | |||
subst_builddir = '$(subst \',\'\\\'\',$(builddir))' |
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.
nit: I'd rather you use the "
string delimiter and the r
prefix so you get:
subst_builddir = r"$(subst ', '\'', $(builddir))"
Also IMHO the arg to self.WriteLn
should be constructed before the call
action_cmd = "..." \
"..." % (...)
self.WriteLn(action_cmd)
Seems like the new test fails on Windows:
|
var nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js') | ||
|
||
function runSpacedName() { | ||
var testCode = "require('name\\'s (weird)')" |
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.
You can't put a \
in a Windows path. But you can put an unescaped '
.
You could try using require("${addonPath}")
but YMMV
var lastLine = logLines[logLines.length-1] | ||
t.strictEqual(err, null) | ||
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') | ||
t.strictEqual(runSpacedName().trim(), 'world') |
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.
You should lower the .trim()
into runSpacedName
var cmd = [ nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose' ] | ||
|
||
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { | ||
var logLines = stderr.toString().trim().split(/\r?\n/) |
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.
const lastLine = stderr.toString().trim().split(os.EOL).pop();
var lastLine = logLines[logLines.length-1] | ||
t.strictEqual(err, null) | ||
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') | ||
t.strictEqual(runSpacedName().trim(), 'world') |
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.
You should put a comment explaining where "world" comes from.
@refack Thanks for the feedback. I suspect the Windows tests are failing because the shell script is failing and not creating Once I have that I'll look into what it would take to get it submitted upstream, too. |
not sure if this is still needed, if so and it belongs here please open a fresh PR for it, otherwise maybe https://github.com/refack/GYP is the right place for it |
Checklist
npm install && npm test
passesDescription of change
This change will make sure that the path to the build directory gets properly quoted and escaped when running actions.