fs: adjust truncate mode from r+ to a#43315
fs: adjust truncate mode from r+ to a#43315LiviaMedeiros wants to merge 1 commit intonodejs:mainfrom
r+ to a#43315Conversation
|
/cc @nodejs/fs |
I don't think so. These examples are for |
b544846 to
375f0a7
Compare
There are a bunch of seemingly related CI failures on Windows.
node:internal/fs/utils:348
throw err;
^
Error: EPERM: operation not permitted, ftruncate
at Object.ftruncateSync (node:fs:1136:3)
at Object.truncateSync (node:fs:1095:14)
at Object.<anonymous> (C:\workspace\node-test-binary-windows-js-suites\node\test\parallel\test-fs-truncate.js:44:4)
at Module._compile (node:internal/modules/cjs/loader:1129:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1183:10)
at Module.load (node:internal/modules/cjs/loader:1007:32)
at Module._load (node:internal/modules/cjs/loader:848:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47 {
errno: -4048,
syscall: 'ftruncate',
code: 'EPERM'
}
Node.js v19.0.0-preOn a first glance, it looks like a bug in underlying layer. Most likely an attempt to allocate a sparse zero-filled range on a filesystem (probably FAT?) that doesn't support that. |
|
Unfortunately, there are still failures on Windows, this will probably need to wait Node.js 20.0.0 if we are able to fix/workaround the failures. |
|
This PR has conflicts that must be resolved |
375f0a7 to
66f94ce
Compare
|
Rebased, let's see if it still causes issues on Windows. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #43315 +/- ##
==========================================
- Coverage 90.26% 90.26% -0.01%
==========================================
Files 630 630
Lines 184690 184690
Branches 36157 36140 -17
==========================================
- Hits 166718 166714 -4
Misses 11021 11021
- Partials 6951 6955 +4
|
|
Getting |
This PR changes flags in
fsPromises.truncate(path[, len]),fs.truncate(path[, len], callback), andfs.truncateSync(path[, len])fromr+toa.This change:
EACCES)Creating file is not what pure
truncate(2)does, but it is done bytruncate(1)and kinda makes sense.Alternatively, we can check for
W_OKand throwENOENTmanually.