More implementation and testing for chmod/chown apis#4239
Merged
Conversation
Contributor
There was a problem hiding this comment.
Other comments (6)
-
src/workerd/api/node/tests/fs-chown-chmod-test.js (573-573)
The function callChown is using fchown instead of fchmod. This should be fixed to use fchmod instead.
fchmod(fd, 0o777, (err) => { -
src/workerd/api/node/tests/fs-chown-chmod-test.js (571-571)
The function name should be callChmod instead of callChown to match the functionality being tested.
async function callChmod() { -
src/workerd/api/node/tests/fs-chown-chmod-test.js (582-582)
The function call should be to callChmod instead of callChown to match the renamed function.
await callChmod(); -
src/node/internal/internal_fs_callback.ts (375-375)
There's an inconsistency in the error message. The pathname is taken from `path` but should be taken from `pathOrFd` to be consistent with the validation and stat check above.
throw new ERR_ENOENT((pathOrFd as URL).pathname, { syscall: 'lchown' }); -
src/node/internal/internal_fs_callback.ts (196-196)
There's an inconsistency in the error message. The pathname is taken from `path` but should be taken from `pathOrFd` to be consistent with the validation and stat check above.
throw new ERR_ENOENT((pathOrFd as URL).pathname, { syscall: 'chown' }); - src/node/internal/internal_fs_sync.ts (340-340) There's an inconsistency in the error message for lchownSync. The pathname is taken from `(path as URL).pathname` but should be using `(pathOrFd as URL).pathname` to be consistent with other similar functions.
💡 To request another review, post a new comment with "/windsurf-review".
826404c to
59d1194
Compare
anonrig
approved these changes
Jun 4, 2025
59d1194 to
0438eaf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This covers most of chmod/chown APIs with one exception to the "bad file descriptor" / EBADF error thrown from the C++ side, which I'll address in a separate PR.