Skip to content

Symlink creation broken on Windows #26701

@cameron-martin

Description

@cameron-martin

Description of the bug:

On Windows, when creating symlinks to a directory using ctx.actions.declare_symlink and ctx.actions.symlink, symlinks are created that are unusable since they are not created as directory symlinks. From a brief look through the code in Bazel that creates symlinks, symlinks shouldn’t be allowed to be created to directories on windows, requiring junctions instead.

This is causing rules_js to be unusable on Windows with newer versions of Bazel. See aspect-build/rules_js#2261.

Which category does this issue belong to?

Core

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I’ve created a reproducer here: bazel-symlink-bug-main.tar.gz

The test can be run using bazel test //:test_mode.

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

release 8.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/a

What's the output of git remote get-url origin; git rev-parse HEAD ?

N/a

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

c3ad87e

Have you found anything relevant by searching the web?

No

Any other information, logs, or outputs that you want to share?

No

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)team-Remote-ExecIssues and PRs for the Execution (Remote) teamtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions