Skip to content

vfs: statfs succeeds for nonexistent paths #65692

Description

@trivikr

Version

main

Platform

All

Subsystem

vfs

What steps will reproduce the bug?

import fs from 'node:fs/promises';
import path from 'node:path';
import vfs from 'node:vfs';

const virtualFs = vfs.create();
const mountPoint = virtualFs.mount();

try {
  console.log(await fs.statfs(path.join(mountPoint, 'missing')));
} finally {
  virtualFs.unmount();
}

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

fs.statfs() should reject with ENOENT, matching its behavior for nonexistent paths on the native filesystem.

What do you see instead?

fs.statfs() resolves with a synthetic VFS filesystem-statistics object even though the requested path does not exist.

Additional information

fs equivalent

import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';

const directory = await fs.mkdtemp(path.join(os.tmpdir(), 'statfs-'));

try {
  console.log(await fs.statfs(path.join(directory, 'missing')));
} finally {
  await fs.rm(directory, { recursive: true, force: true });
}

This rejects with an ENOENT error.

Metadata

Metadata

Assignees

Labels

vfsIssues and PRs related to the virtual filesystem subsystem.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions