Version
main
Platform
Subsystem
vfs
What steps will reproduce the bug?
import { ZipBuffer, ZipEntry, createZipArchive } from 'node:zlib';
import { ZipProvider, create } from 'node:vfs';
const zipEntry = await ZipEntry.create('dir/file.txt', Buffer.from('hello'));
const zipArchive = createZipArchive([zipEntry]);
const archive = Buffer.concat(await Array.fromAsync(zipArchive));
const fs = create(new ZipProvider(new ZipBuffer(archive))).promises;
await fs.rename('/dir', '/renamed-dir');
console.log(await fs.readFile('/renamed-dir/file.txt', 'utf8'));
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Renaming the implicit /dir directory moves its descendant entries. The program prints hello.
What do you see instead?
ZipProvider.rename() only looks for an explicit dir archive entry, so it treats the implicit directory as missing. The program throws ENOENT.
Additional information
fs equivalent which prints hello
import { mkdtemp, mkdir, writeFile, rename, readFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const root = await mkdtemp(join(tmpdir(), 'rename-repro-'));
await mkdir(join(root, 'dir'));
await writeFile(join(root, 'dir/file.txt'), 'hello');
await rename(join(root, 'dir'), join(root, 'renamed-dir'));
console.log(await readFile(join(root, 'renamed-dir/file.txt'), 'utf8'));
Version
main
Platform
Subsystem
vfs
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Renaming the implicit
/dirdirectory moves its descendant entries. The program printshello.What do you see instead?
ZipProvider.rename()only looks for an explicitdirarchive entry, so it treats the implicit directory as missing. The program throwsENOENT.Additional information
fs equivalent which prints
hello