Skip to content

Fix project pin discovery for glob metacharacters in project paths #1808

Description

@hatayama

Problem

dispatcherPinCandidatePaths in cli/dispatcher/internal/dispatcher/dispatcher_pin.go uses filepath.Glob for PackageCache pin discovery. If the Unity project path contains glob metacharacters such as [ or ], the project-root portion is interpreted as a pattern and valid pin candidates can be missed.

The V2 package detector no longer has this issue because it uses os.ReadDir, but the existing V3 project-runner pin path still does.

Reproduction

  1. Create or move a pinned V3 Unity project under a path such as <PROJECT_ROOT>/project[legacy].
  2. Ensure the package pin is available through Library/PackageCache/<PACKAGE_NAME>@*/project-runner-pin.json and no higher-priority copied pin is present.
  3. Run a project-scoped uloop command.
  4. Observe that pin resolution can report the pin as missing.

Expected

PackageCache discovery treats every project-root character literally and finds the pin regardless of glob metacharacters.

Suggested direction

Replace the glob-based directory discovery with literal os.ReadDir traversal, matching the V2 detector approach, and add regression coverage for bracketed project paths and Windows separators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions