Skip to content

path: matchesGlob() cache does not distinguish path platforms #64570

Description

@Archkon

Version

latest main branch

Platform

7.1.3-arch1-3

Subsystem

path

What steps will reproduce the bug?

  const path = require('node:path');

  const pattern = 'cache-platform-regression/**';

  console.log(
    path.posix.matchesGlob('cache-platform-regression/file', pattern),
  );

  console.log(
    path.win32.matchesGlob('cache-platform-regression\\file', pattern),
  );

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

No

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

Both calls should return true. The result of path.win32.matchesGlob() should not depend on whether the same pattern was previously used through path.posix.matchesGlob().

What do you see instead?

  true
  false

The Win32 call returns false after the same pattern has first been used through path.posix.

Calling the Win32 version with a previously unused pattern returns the expected result:

  console.log(
    path.win32.matchesGlob(
      'cache-platform-control\\file',
      'cache-platform-control/**',
    ),
  );
  // true

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions