module: remove '' from Module.globalPaths
authorChris Yip <i@chrisyip.im>
Tue, 21 Apr 2015 07:13:27 +0000 (15:13 +0800)
committerRoman Reiss <me@silverwind.io>
Thu, 23 Apr 2015 14:57:50 +0000 (16:57 +0200)
commit7384ca83f97a28b0cecaabe879e9af0fe8631b62
treeb7340c33eef3ae6e616b87e62f03c91c36f8e6a3
parenta7d74633f20e285395f5e2860bdac56381603476
module: remove '' from Module.globalPaths

If `$NODE_PATH` contains trailing separators, `Module.globalPaths` will
contains empty strings. When `Module` try to resolve a module's path,
`path.resolve('', 'index.js')` will boil down to `$PWD/index.js`, which
makes sub modules can access global modules and get unexpected result.

PR-URL: https://github.com/iojs/io.js/pull/1488
Reviewed-By: Roman Reiss <me@silverwind.io>
lib/module.js
test/parallel/test-module-globalpaths-nodepath.js