vfs: commit ZipProvider handles the way open(2) does · nodejs/node@5c4d319 · GitHub
Skip to content

Commit 5c4d319

Browse files
pipobscureaduh95
authored andcommitted
vfs: commit ZipProvider handles the way open(2) does
A ZipProvider handle adds its entry to the archive when it is closed. Give that model the effects a real open(2) has up front, and keep the metadata an entry already carries: * A handle whose flags create or truncate the file starts out dirty, so closing it without a write still creates the missing entry or truncates the existing one. * The handle remembers the entry's own mode and modification time. The re-added entry keeps that mode instead of taking the `mode` argument `open()` was given (fs's default 0o666), so a 0o755 script survives an append or an in-place write; only a newly created file takes the mode from `open()`. * `fstat` reports that mode and, until the handle has changed the file, that modification time. * `rename` refuses to move a file onto an existing directory with EISDIR before touching the archive. Signed-off-by: Philipp Dunkel <pip@pipobscure.com> PR-URL: #65853 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 29d3406 commit 5c4d319

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

‎lib/internal/vfs/providers/ziparchive.js‎

Lines changed: 26 additions & 6 deletions

0 commit comments

Comments
 (0)