Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

fs.rename() ENOENT on destination path #5287

Closed
jbowens opened this issue Apr 13, 2013 · 1 comment
Closed

fs.rename() ENOENT on destination path #5287

jbowens opened this issue Apr 13, 2013 · 1 comment

Comments

@jbowens
Copy link

jbowens commented Apr 13, 2013

fs.rename() will report ENOENT on the wrong path if the ENOENT occurs within the destination path, not the source path.

To reproduce:

var fs = require('fs');
try {
    fs.renameSync('./filethatexists', './paththatdoesnotexist/file');
} catch(err) {
    console.error(err);
}

Expected output:
Error: ENOENT, no such file or directory './paththatdoesnotexist'

Actual output:
Error: ENOENT, no such file or directory './filethatexists'

Experienced on Unix (OS X)

Update: The same is true for fs.link() and glancing at the source, I'd imagine any other fs syscall that takes two paths.

var fs = require('fs');

try {
    fs.linkSync('./filethatexists', './paththatdoesnotexist/file');
} catch(err) {
    console.error(err);
}
@hackedy
Copy link

hackedy commented Apr 13, 2013

Dupe of #685

@isaacs isaacs closed this as completed Apr 13, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants