Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chmodSync throws EISDIR for directories #558

Closed
dabbott opened this issue Jul 22, 2020 · 2 comments · Fixed by #870
Closed

chmodSync throws EISDIR for directories #558

dabbott opened this issue Jul 22, 2020 · 2 comments · Fixed by #870
Labels

Comments

@dabbott
Copy link

dabbott commented Jul 22, 2020

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)
@vladimiry
Copy link

Looks like the same issue as #391.

williamstein added a commit to sagemathinc/memfs-js that referenced this issue Oct 26, 2022
williamstein added a commit to williamstein/memfs that referenced this issue Oct 26, 2022
G-Rath pushed a commit that referenced this issue Nov 3, 2022
* fix #558 -- chmodSync throws EISDIR for directories

- See #558

* restructure chmodSync tests
streamich pushed a commit that referenced this issue Nov 3, 2022
## [3.4.10](v3.4.9...v3.4.10) (2022-11-03)

### Bug Fixes

* support calling `chmod` on a directory ([#870](#870)) ([7c5999c](7c5999c)), closes [#558](#558)
@streamich
Copy link
Owner

🎉 This issue has been resolved in version 3.4.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants