bazel-contrib / bazel-contrib/rules_dotnet

Launcher is converting \ to \\\\ in arguments

Open
#525 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
209
Forks
98
Avg merge
3h 59m
Merged PRs (30d)
14

Description

The binary launcher in rules_dotnet appears to be converting single backslashes in arguments to 4xbackslashes.

```
> bazel run //src/mybinary -- --output=D:\temp
INFO: Build completed successfully, 3 total actions
INFO: Running command line: bazel-bin/src/mybinary/mybinary/net8.0/mybinary.dll.bat '--output=D:\temp'
Arg: --output=D:\\\\temp
```

The program code is:
```
static async Task Main(string[] args)
{
foreach (var arg in args)
{
Console.WriteLine("Arg: " + arg);
}
```

I believe the issue is coming from this line:
https://github.com/bazel-contrib/rules_dotnet/blob/ccf87e85af31e96b903ff1ca61111529198ce78c/dotnet/private/launcher.bat.tpl#L62

Contributor guide

Open the contributing guide

Research direction

Start with dotnet/private/launcher.bat.tpl at line 62 and reproduce the documented bazel run command using the --output=D:\temp argument. Trace how the batch launcher passes arguments to the .NET binary, then verify that a single backslash remains a single backslash in the printed argument.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, shell
Domain
build-system, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.