Skip to content

Commit

Permalink
Fix IndexError when parsing GYP files.
Browse files Browse the repository at this point in the history
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: nodejs#1217
PR-URL: nodejs#1267
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
bnoordhuis committed Oct 20, 2017
1 parent a8ba528 commit 05d2002
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 05d2002

Please sign in to comment.