mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
test: add known issue test for fs.cpSync dereference bug
Refs: https://github.com/nodejs/node/issues/58939 PR-URL: https://github.com/nodejs/node/pull/58941 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
8a87ba031b
commit
4a06d470ef
1 changed files with 39 additions and 0 deletions
39
test/known_issues/test-fs-cp-sync-dereference.js
Normal file
39
test/known_issues/test-fs-cp-sync-dereference.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Refs: https://github.com/nodejs/node/issues/58939
|
||||||
|
//
|
||||||
|
// The cpSync function is not correctly handling the `dereference` option.
|
||||||
|
// In this test, both the cp and cpSync functions are attempting to copy
|
||||||
|
// a file over a symlinked directory. In the cp case it works fine. In the
|
||||||
|
// cpSync case it fails with an error.
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
const {
|
||||||
|
cp,
|
||||||
|
cpSync,
|
||||||
|
mkdirSync,
|
||||||
|
symlinkSync,
|
||||||
|
writeFileSync,
|
||||||
|
} = require('fs');
|
||||||
|
|
||||||
|
const {
|
||||||
|
join,
|
||||||
|
} = require('path');
|
||||||
|
|
||||||
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
tmpdir.refresh();
|
||||||
|
|
||||||
|
const pathA = join(tmpdir.path, 'a');
|
||||||
|
const pathB = join(tmpdir.path, 'b');
|
||||||
|
const pathC = join(tmpdir.path, 'c');
|
||||||
|
const pathD = join(tmpdir.path, 'd');
|
||||||
|
|
||||||
|
writeFileSync(pathA, 'file a');
|
||||||
|
mkdirSync(pathB);
|
||||||
|
symlinkSync(pathB, pathC, 'dir');
|
||||||
|
symlinkSync(pathB, pathD, 'dir');
|
||||||
|
|
||||||
|
cp(pathA, pathD, { dereference: false }, common.mustSucceed());
|
||||||
|
|
||||||
|
cpSync(pathA, pathC, { dereference: false });
|
Loading…
Add table
Add a link
Reference in a new issue