bazelbuild / bazelbuild/remote-apis

build.bazel.remote.execution.v2.Command.arguments[0] should specify a path separator.

Open
#187 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
445
Forks
141
PR merge metrics
No merged PRs in 30d

Description

Motivation: https://github.com/bazelbuild/bazel/issues/11636#issuecomment-651154740

Throughout the API, both for inputs (in `SymlinkNodes`) and in outputs, we specify that separators should be single forward slashes (`/`). However, we're not explicit on the Command arguments, which currently reads:

```
// The arguments to the command. The first argument must be the path to the
// executable, which must be either a relative path, in which case it is
// evaluated with respect to the input root, or an absolute path.
repeated string arguments = 1;
```

The issue here comes from Windows `cmd.exe` not being able to naively recognize relative paths using `/` separators as executables, eg:

```
(cmd) $ foo/bar.bat
'foo' is not recognized as an internal or external command, operable program or batch file.
```

While there are many ways for the server to go around that restrictions (eg converting `/` -> `\`, wrapping the command in quotes, etc), we should it explicit whose responsibility it is to deal with this:

1. The server can responsible to process the path according to the executing platform;
2. The client can be responsible to ensure that argument[0] is executable without any additional processing;
3. We could specify that the separator should be the platform's default;
4. Technically, we could make it that either `/` or `\` are valid, though I find little benefit to this approach, as it's a more ambiguous than 1 but forces the server to apply processing anyway (and maybe there exists a bizarre scenario where both are valid and yield different results?)

I'm personally prefer 1. as the server may be already doing other processing on the command and figuring out the platform specific separator shouldn't be challenging, but I don't have a strong preference here as the approach is explicitly stated.

Contributor guide

Open the contributing guide

Research direction

Start with the build.bazel.remote.execution.v2.Command.arguments definition and compare its wording with the separator requirements for SymlinkNodes and outputs. Review the linked Bazel discussion and the listed server-versus-client options; done means the chosen responsibility and separator behavior are explicitly stated in the API definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
operating-systems, shell
Domain
api, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.