diff options
author | Gibson Fahnestock <gibfahn@gmail.com> | 2017-10-18 10:02:58 +0100 |
---|---|---|
committer | Gibson Fahnestock <gibfahn@gmail.com> | 2017-10-22 22:58:37 +0100 |
commit | b5569dbe8dee7f259644ef6b73b756d9ea2ba090 (patch) | |
tree | 517caf718d99e7c346f8d68158b8eba8d45b90da /test/parallel/test-os.js | |
parent | 02a52670b832b17b90365aa42b5620c20fe357f6 (diff) | |
download | android-node-v8-b5569dbe8dee7f259644ef6b73b756d9ea2ba090.tar.gz android-node-v8-b5569dbe8dee7f259644ef6b73b756d9ea2ba090.tar.bz2 android-node-v8-b5569dbe8dee7f259644ef6b73b756d9ea2ba090.zip |
test: handle blank shells in test-os.js
The shell in /etc/passwd can be blank, in which case the user is given
the default shell. Handle this by only checking the shell contains a
path separator if the string isn't empty.
PR-URL: https://github.com/nodejs/node/pull/16287
Fixes: https://github.com/nodejs/node/issues/15684
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test/parallel/test-os.js')
-rw-r--r-- | test/parallel/test-os.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 4246a769fd..b35faeb7cd 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -208,7 +208,11 @@ if (common.isWindows) { } else { is.number(pwd.uid); is.number(pwd.gid); - assert.ok(pwd.shell.includes(path.sep)); + assert.strictEqual(typeof pwd.shell, 'string'); + // It's possible for /etc/passwd to leave the user's shell blank. + if (pwd.shell.length > 0) { + assert(pwd.shell.includes(path.sep)); + } assert.strictEqual(pwd.uid, pwdBuf.uid); assert.strictEqual(pwd.gid, pwdBuf.gid); assert.strictEqual(pwd.shell, pwdBuf.shell.toString('utf8')); |