You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copying a Link from One File to Another Link to the Same File errors out in isSrcSubdir #1019
> fs.cpSync('testLink1', 'testLink2')
Uncaught:
SystemError [ERR_FS_CP_EINVAL]: Invalid src or dest: cp returned EINVAL (cannot copy /private/tmp/node_fs_test/testFile to a subdirectory of self /private/tmp/node_fs_test/testFile) testLink2
at __node_internal_captureLargerStackTrace (node:internal/errors:497:5)
at new SystemError (node:internal/errors:257:5)
at new NodeError (node:internal/errors:368:7)
at onLink (node:internal/fs/cp/cp-sync:315:11)
at getStats (node:internal/fs/cp/cp-sync:181:12)
at checkParentDir (node:internal/fs/cp/cp-sync:159:10)
at cpSyncFn (node:internal/fs/cp/cp-sync:61:10)
at Object.cpSync (node:fs:2987:3) {
code: 'ERR_FS_CP_EINVAL',
info: {
message: 'cannot copy /private/tmp/node_fs_test/testFile to a subdirectory of self /private/tmp/node_fs_test/testFile',
path: 'testLink2',
syscall: 'cp',
errno: 22,
code: 'EINVAL'
},
errno: [Getter/Setter: 22],
syscall: [Getter/Setter: 'cp'],
path: [Getter/Setter: 'testLink2']
}
Yeah, fs.cp is based on fse.copy, so apparently this bug is both places. Should be raised as an issue on Node as well, so we can both fix it.
Just to make sure I understand this, in this particular case, performing a copy wouldn't actually change anything about the makeup of the filesystem, correct?
I have an electron app packaged with vite. the @electron-forge/vite-plugin does fs.copy on the files of packages in the package.json file. My project has a dependency on the @smile-cdr/fhirts package. I get this error ("src:" and "dst:" are my debug logs, just as the "catch me" tracer):
src: /Users/martin/Projects/CENSORED/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml
dst: /var/folders/bm/ytnswbdd57b5dm28zg7x8ysc0000gn/T/electron-packager/tmp-8AxS5d/Electron.app/Contents/Resources/app/node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml
Trace: catch me
at /Users/martin/Projects/CENSORED/node_modules/fs-extra/lib/copy/copy.js:213:19
at FSReqCallback.oncomplete (node:fs:200:23)
An unhandled rejection has occurred inside Forge:
Error: Cannot copy '../../../../../../esprima/bin/esvalidate.js' to a subdirectory of itself, '../../../../../../esprima/bin/esvalidate.js'.
at /Users/martin/Projects/CENSORED/node_modules/fs-extra/lib/copy/copy.js:214:21
at FSReqCallback.oncomplete (node:fs:200:23)
Activity
RyanZim commentedon Oct 13, 2023
Yeah, that's a bug. Out of curiosity, how does Node's experimental
fs.cpbehave here?cowsandmilk commentedon Oct 13, 2023
apparently a similar error as
fs-extraRyanZim commentedon Oct 13, 2023
Yeah,
fs.cpis based onfse.copy, so apparently this bug is both places. Should be raised as an issue on Node as well, so we can both fix it.Just to make sure I understand this, in this particular case, performing a copy wouldn't actually change anything about the makeup of the filesystem, correct?
cc @manidlou
cowsandmilk commentedon Oct 19, 2023
that would be my expectation
bstst commentedon Apr 29, 2024
it does indeed look like there's an issue here.
I have an electron app packaged with vite. the
@electron-forge/vite-plugindoesfs.copyon the files of packages in the package.json file. My project has a dependency on the@smile-cdr/fhirtspackage. I get this error ("src:" and "dst:" are my debug logs, just as the "catch me" tracer):Address review feedback: add test completeness
Fix symlink copy failing when source and dest symlinks point to same …
Update dependency fs-extra to v11 (#6)