Uh oh!
There was an error while loading. Please reload this page.
fs: fix writeFile[Sync] for non-seekable files - #32006
Conversation
Completely disables the use of positioned writes at writeFile and writeFileSync, which allows it to work with non-seekable files. Fixes: nodejs#31926
addaleax
commented
Feb 28, 2020
This variant is the one that does change behaviour in the custom-FD use case, right? I feel like 99.9 % of people wouldn’t be affected, but maybe we could still keep that for a separate PR? |
mildsunrise
commented
Feb 28, 2020
addaleax
left a comment
There was a problem hiding this comment.
Right, thanks for reminding me :)
nodejs-github-bot
commented
Feb 28, 2020
mildsunrise
commented
Feb 28, 2020
No prob! It was more than a year ago, I'd have forgotten too 😹 |
CI: https://ci.nodejs.org/job/node-test-pull-request/29452/ (:white_check_mark:) |
codecov-io
commented
Feb 29, 2020
Codecov Report
@@ Coverage Diff @@## master #32006 +/- ##
=======================================
Coverage 96.16% 96.16% =======================================
Files 196 196 Lines 64918 64918 =======================================
Hits 62429 62429 Misses 2489 2489Continue to review full report at Codecov.
|
addaleax
commented
Mar 7, 2020
Landed in f69de13 🎉 |
MylesBorins
commented
Mar 9, 2020
This does not land cleanly on v13.x. Should it be backported? |
addaleax
commented
Mar 10, 2020
@MylesBorins Wrong label? And, yes, it should be backported. 👍 |
Completely disables the use of positioned writes at writeFile and writeFileSync, which allows it to work with non-seekable files. Fixes: nodejs#31926 PR-URL: nodejs#32006 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Currently
writeFileandwriteFileSyncperform a positioned write at the beginning of the file, which prevents them from working with non-seekable files (#31926).Positioned writes were first removed for
createWriteStream(#19329) and for custom FDs (#23433, #23709) as well as for files opened in append mode... but they're still used for filenames in normal mode. This PR removes positioned writes completely, as they're not needed for this case either.This also makes it consistent with
readFile(which does work with non-seekable files).Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes