Philipp Dunkel
2d9c861a15
vfs: align virtual file handles with open(2)
...
A file descriptor obtained on a mounted path answers several `node:fs`
calls differently from one on a real file, in both providers:
* `writeFileSync(path, data, { flag: 'r+' })` replaces the whole file
instead of overwriting bytes from offset 0 and keeping the tail.
* Numeric open flags are mapped by treating any write-ish bit as "w":
`O_WRONLY` alone truncates, and `O_RDONLY | O_CREAT` opens the file
write-only and truncates it.
* A handle opened with "a+" starts its read offset at the end of the
file, so the first read returns nothing; O_APPEND only affects writes.
The ZipProvider handle additionally:
* throws EISDIR instead of EBADF when reading a write-only handle or
writing a read-only one;
* leaves stale bytes in place when `ftruncate` grows a file that was
previously shrunk, where real files read back as zeros;
* rejects a BigInt `position` with a TypeError from mixing number and
BigInt arithmetic.
This adds a test that runs the same sequence of calls against a memory
mount and a ZIP mount and expects the real-fs result, so every
divergence shows up as its own failing case.
Proposed solution: decode numeric flags bit by bit (O_TRUNC decides
truncation, O_CREAT decides creation, O_WRONLY/O_RDWR decide access)
instead of collapsing them to a flag string; keep the read offset at 0
for append handles and only force writes to the end; make the handle
`writeFile` for non-truncating flags write at offset 0 without
shrinking; in the ZIP handle use EBADF for access-mode violations,
zero-fill on growth in `#doTruncate`, and coerce `position` with
`Number()` as the memory handle does.
Signed-off-by: Philipp Dunkel <pip@pipobscure.com >
PR-URL: https://github.com/nodejs/node/pull/65854
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-09-08 11:35:41 +00:00
..
2026-09-03 23:54:01 +00:00
2026-09-03 15:37:22 +00:00
2026-09-05 02:49:07 +00:00
2026-09-03 15:37:22 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-05 02:49:04 +00:00
2026-09-05 02:49:04 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-03 15:37:21 +00:00
2026-09-06 08:43:54 +00:00
2026-09-05 02:49:07 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-05 02:49:07 +00:00
2026-09-06 08:43:54 +00:00
2026-09-06 08:43:54 +00:00
2026-09-05 02:49:05 +00:00
2026-09-03 12:57:27 +00:00
2026-09-04 13:28:27 +00:00
2026-09-03 05:35:54 +00:00
2026-09-05 05:44:06 +00:00
2026-08-31 14:48:19 +00:00
2026-09-06 06:34:38 +00:00
2026-09-05 13:31:22 +00:00
2026-09-02 08:50:34 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 10:42:52 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 20:54:14 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-07 05:10:02 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-02 08:50:34 +00:00
2026-09-02 16:43:10 +00:00
2026-09-04 16:48:33 +00:00
2026-09-06 08:43:53 +00:00
2026-09-03 11:40:52 +02:00
2026-09-03 11:40:52 +02:00
2026-09-03 11:40:52 +02:00
2026-09-03 11:40:52 +02:00
2026-09-03 11:40:52 +02:00
2026-09-03 11:40:52 +02:00
2026-09-04 04:45:19 +00:00
2026-09-06 08:43:50 +00:00
2026-08-31 05:37:01 +00:00
2026-09-07 05:26:21 +00:00
2026-09-07 05:26:21 +00:00
2026-08-31 17:03:33 +08:00
2026-09-07 05:26:21 +00:00
2026-09-07 05:26:21 +00:00
2026-09-07 05:26:21 +00:00
2026-09-07 05:26:19 +00:00
2026-08-31 17:03:33 +08:00
2026-09-07 05:26:21 +00:00
2026-08-31 10:19:57 -03:00
2026-09-03 05:36:15 +00:00
2026-09-06 23:02:02 +00:00
2026-09-06 23:02:02 +00:00
2026-09-03 15:28:39 +00:00
2026-09-03 15:28:39 +00:00
2026-09-03 15:28:39 +00:00
2026-09-06 04:36:06 +00:00
2026-09-02 16:17:15 -04:00
2026-09-02 16:17:15 -04:00
2026-09-02 16:17:15 -04:00
2026-09-02 16:17:15 -04:00
2026-09-02 16:17:15 -04:00
2026-09-08 04:53:09 +00:00
2026-08-31 17:48:30 +02:00
2026-09-03 08:43:14 +00:00
2026-08-31 13:07:39 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 08:43:14 +00:00
2026-09-03 15:28:39 +00:00
2026-09-03 09:30:21 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-08-31 17:25:06 +00:00
2026-09-02 03:55:41 +00:00
2026-09-08 08:50:33 +00:00
2026-09-07 11:42:09 +00:00
2026-09-03 15:37:21 +00:00
2026-09-03 15:37:21 +00:00
2026-09-02 14:59:15 +00:00
2026-09-02 14:59:15 +00:00
2026-09-02 14:59:15 +00:00
2026-09-04 22:22:10 +00:00
2026-09-04 22:22:10 +00:00
2026-09-04 16:48:33 +00:00
2026-09-02 05:48:32 +00:00
2026-08-31 14:59:47 +00:00
2026-09-05 17:43:03 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-02 10:00:05 +00:00
2026-09-02 10:00:05 +00:00
2026-09-07 23:22:00 +00:00
2026-09-06 04:36:06 +00:00
2026-09-03 23:54:01 +00:00
2026-09-02 23:33:37 +00:00
2026-09-03 15:36:30 +00:00
2026-08-31 15:47:32 +00:00
2026-09-06 04:35:55 +00:00
2026-09-06 04:36:01 +00:00
2026-09-02 13:14:36 +00:00
2026-09-06 04:36:06 +00:00
2026-09-02 13:14:36 +00:00
2026-09-06 04:36:04 +00:00
2026-09-02 13:14:35 +00:00
2026-09-06 04:35:59 +00:00
2026-09-06 04:36:00 +00:00
2026-09-06 04:36:05 +00:00
2026-09-06 04:36:05 +00:00
2026-09-06 04:36:06 +00:00
2026-09-02 13:14:35 +00:00
2026-09-02 13:14:34 +00:00
2026-09-06 04:36:05 +00:00
2026-09-06 04:36:06 +00:00
2026-09-06 04:36:06 +00:00
2026-09-06 04:36:06 +00:00
2026-09-02 13:14:31 +00:00
2026-09-04 19:57:57 +00:00
2026-09-07 12:35:04 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-08-31 18:04:06 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-03 15:28:39 +00:00
2026-09-07 05:10:02 +00:00
2026-09-02 03:55:31 +00:00
2026-09-02 05:48:32 +00:00
2026-09-04 16:48:33 +00:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-09-08 11:35:41 +00:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-09-02 21:47:04 -07:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-09-02 21:47:04 -07:00
2026-08-31 10:31:16 +02:00
2026-09-07 14:48:56 +00:00
2026-08-31 10:31:16 +02:00
2026-08-31 10:31:16 +02:00
2026-09-02 07:27:11 +00:00
2026-09-08 11:35:41 +00:00
2026-09-02 07:27:11 +00:00
2026-09-02 05:36:48 +00:00
2026-09-05 13:31:22 +00:00
2026-09-08 08:50:21 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 10:42:52 +00:00
2026-09-05 10:42:52 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 10:42:52 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 13:31:22 +00:00
2026-09-05 10:42:52 +00:00
2026-09-08 08:50:21 +00:00
2026-09-05 13:31:22 +00:00
2026-09-07 14:49:09 +00:00
2026-09-05 13:31:22 +00:00
2026-09-02 07:27:11 +00:00