From 05d2002258596a9693d6042d573c7fd20449ad23 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 19 Aug 2017 19:54:09 +0200 Subject: [PATCH] Fix IndexError when parsing GYP files. GYP automatically turns variables ending in _dir, _file or _path into absolute paths but didn't check for empty strings. It interacted badly with variables inherited through the environment from npm, the `scripts-prepend-node-path=false` setting in particular because it is turned into `npm_config_script_prepend_node_path=`. Fixes: https://github.com/nodejs/node-gyp/issues/1217 PR-URL: https://github.com/nodejs/node-gyp/pull/1267 Reviewed-By: Gibson Fahnestock Reviewed-By: Refael Ackermann --- gyp/pylib/gyp/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gyp/pylib/gyp/input.py b/gyp/pylib/gyp/input.py index 7567d0a05b..33c5947121 100644 --- a/gyp/pylib/gyp/input.py +++ b/gyp/pylib/gyp/input.py @@ -2033,7 +2033,7 @@ def MakePathRelative(to_file, fro_file, item): gyp.common.RelativePath(os.path.dirname(fro_file), os.path.dirname(to_file)), item)).replace('\\', '/') - if item[-1] == '/': + if item[-1:] == '/': ret += '/' return ret