|
@ -191,21 +191,25 @@ function test_cyclic_link_protection(callback) { |
|
|
common.skip('symlink test (no privs)'); |
|
|
common.skip('symlink test (no privs)'); |
|
|
return runNextTest(); |
|
|
return runNextTest(); |
|
|
} |
|
|
} |
|
|
const entry = common.tmpDir + '/cycles/realpath-3a'; |
|
|
const entry = path.join(common.tmpDir, '/cycles/realpath-3a'); |
|
|
[ |
|
|
[ |
|
|
[entry, '../cycles/realpath-3b'], |
|
|
[entry, '../cycles/realpath-3b'], |
|
|
[common.tmpDir + '/cycles/realpath-3b', '../cycles/realpath-3c'], |
|
|
[path.join(common.tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'], |
|
|
[common.tmpDir + '/cycles/realpath-3c', '../cycles/realpath-3a'] |
|
|
[path.join(common.tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a'] |
|
|
].forEach(function(t) { |
|
|
].forEach(function(t) { |
|
|
try { fs.unlinkSync(t[0]); } catch (e) {} |
|
|
try { fs.unlinkSync(t[0]); } catch (e) {} |
|
|
fs.symlinkSync(t[1], t[0], 'dir'); |
|
|
fs.symlinkSync(t[1], t[0], 'dir'); |
|
|
unlink.push(t[0]); |
|
|
unlink.push(t[0]); |
|
|
}); |
|
|
}); |
|
|
assert.throws(function() { fs.realpathSync(entry); }); |
|
|
assert.throws(() => { |
|
|
asynctest(fs.realpath, [entry], callback, function(err, result) { |
|
|
fs.realpathSync(entry); |
|
|
assert.ok(err && true); |
|
|
}, common.expectsError({ code: 'ELOOP', type: Error })); |
|
|
|
|
|
asynctest( |
|
|
|
|
|
fs.realpath, [entry], callback, common.mustCall(function(err, result) { |
|
|
|
|
|
assert.strictEqual(err.path, entry); |
|
|
|
|
|
assert.strictEqual(result, undefined); |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
})); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function test_cyclic_link_overprotection(callback) { |
|
|
function test_cyclic_link_overprotection(callback) { |
|
|