memfs icon indicating copy to clipboard operation
memfs copied to clipboard

`chmodSync` throws EISDIR for directories

Open dabbott opened this issue 5 years ago • 1 comments
trafficstars

Running chmodSync on a directory fails with EISDIR:

var { fs } = require("memfs")

fs.mkdirSync('/foo')
fs.chmodSync('/foo', 0o666)

The error is: Error: EISDIR: illegal operation on a directory, open '/foo'.

(Try it: https://runkit.com/dabbott/memfs-chmodsync/1.0.0)

The same calls seem to work with node's built-in fs, as long as it's a directory where you have permission to write, so I'm guessing this is an issue with chmodSync?

If this is a bug I can try to submit a PR. I haven't looked through the code yet, but seems like it'd be a quick change.


Running chmod (not sync) works. Also, running openSync and then fchmodSync works, as a workaround:

var { fs } = require("memfs")

fs.mkdirSync('/foo')
fs.fchmodSync(fs.openSync('/foo', 'r'), 0o666)

dabbott avatar Jul 22 '20 17:07 dabbott

Looks like the same issue as #391.

vladimiry avatar Sep 19 '20 17:09 vladimiry

:tada: This issue has been resolved in version 3.4.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

streamich avatar Nov 03 '22 17:11 streamich