Skip to content

vfs: recursive mkdir returns backing-directory path for RealFSProvider #66220

Description

@trivikr

Version

main

Platform

All

Subsystem

vfs

What steps will reproduce the bug?

import { mkdtempSync, mkdirSync, existsSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { create, RealFSProvider } from 'node:vfs';

const root = mkdtempSync(join(tmpdir(), 'vfs-'));
const myVfs = create(new RealFSProvider(root));
const mountPoint = myVfs.mount();

const asked = join(mountPoint, 'a/b');
const created = mkdirSync(asked, { recursive: true });
console.log('created:', created);
console.log('existsSync(created):', existsSync(created));
console.log('existsSync(asked):', existsSync(asked));

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

Always

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

created should be <mountPoint>/a and pass fs.existsSync()

What do you see instead?

created: /dev/null/vfs/0/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/vfs-MMktQW/a
existsSync(created): false
existsSync(asked): true

created is <mountPoint>/<backing-root>/a — the absolute backing-directory path leaks through — and fs.existsSync(created) is false

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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