| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Not a change to make in this PR, but I wonder if that error message could be improved. Unless I'm misunderstanding, the problem from the user perspective is mode/permissions and not that the file descriptor is bad.
Sorry, something went wrong.
There was a problem hiding this comment.
Agreed. Since writeFile(fd) and writeFile(path) share the same util function writeAll, this change may need a refactor.
I'll open an issue to track it and look into it later.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
According to https://man7.org/linux/man-pages/man2/write.2.html:
Considering that the file has been opened in the read-only mode and the program is attempting to write to it, isn't EBADF more appropriate here?
Sorry, something went wrong.
There was a problem hiding this comment.
I guess the point is that it's a writeFile operation in the user perspective, but the current error is about file descriptor, which may causes confusing.
Sorry, something went wrong.
There was a problem hiding this comment.
This function just reflects the error that is returned from uv_fs_write, which again reflects the error the OS returns. I don't think we replace the error codes for the other functions, so doing it for this particular function feels a little odd, don't you think?
Sorry, something went wrong.
There was a problem hiding this comment.
@pd4d10 This test is failing for Windows. Could you please update it to expect an EPERM for Windows?
Sorry, something went wrong.
|
Removing the author-ready for now as there is a failure on Windows. Will add it back in after it is fixed. |
Sorry, something went wrong.
Co-authored-by: Darshan Sen <raisinten@gmail.com>
Sorry, something went wrong.
PR-URL: #38604 Refs: https://coverage.nodejs.org/coverage-29f1b609ba5d12d3/lib/fs.js.html#L2045 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
PR-URL: #38604 Refs: https://coverage.nodejs.org/coverage-29f1b609ba5d12d3/lib/fs.js.html#L2045 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
|
This lands cleanly on v14.x-staging but the modified test fails === release test-fs-writefile-with-fd ===
Path: parallel/test-fs-writefile-with-fd
/home/rlau/sandbox/github/trees/v14.x-staging/test/parallel/test-fs-writefile-with-fd.js:74
const controller = new AbortController();
^
ReferenceError: AbortController is not defined
at Object.<anonymous> (/home/rlau/sandbox/github/trees/v14.x-staging/test/parallel/test-fs-writefile-with-fd.js:74:22)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
I tried adding // Flags: --experimental-abortcontroller at the beginning of the test file but still get an error: $ node test/parallel/test-fs-writefile-with-fd.js
NOTE: The test started as a child_process using these flags: [ '--experimental-abortcontroller' ] Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.
(node:553301) ExperimentalWarning: AbortController is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/home/rlau/sandbox/github/trees/v14.x-staging/test/common/index.js:577
assert.strictEqual(descriptor.enumerable, false);
^
TypeError: Cannot read property 'enumerable' of undefined
at /home/rlau/sandbox/github/trees/v14.x-staging/test/common/index.js:577:35
at /home/rlau/sandbox/github/trees/v14.x-staging/test/common/index.js:376:15
at writeAll (fs.js:1449:7)
at Object.writeFile (fs.js:1494:5)
at /home/rlau/sandbox/github/trees/v14.x-staging/test/parallel/test-fs-writefile-with-fd.js:80:8
at /home/rlau/sandbox/github/trees/v14.x-staging/test/common/index.js:341:17
at /home/rlau/sandbox/github/trees/v14.x-staging/test/common/index.js:376:15
at FSReqCallback.oncomplete (fs.js:180:23)
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Refs:
https://coverage.nodejs.org/coverage-29f1b609ba5d12d3/lib/fs.js.html#L2045
https://coverage.nodejs.org/coverage-29f1b609ba5d12d3/lib/fs.js.html#L2056