Skip to content

Windows, bazel run: don't join all args into argv0 - #8287

Closed
laszlocsomor wants to merge 1 commit into
bazelbuild:masterfrom
laszlocsomor:fix-bashless-run
Closed

laszlocsomor wants to merge 1 commit into
bazelbuild:masterfrom
laszlocsomor:fix-bashless-run

Conversation

@laszlocsomor

@laszlocsomor laszlocsomor commented May 10, 2019 •

Copy link
Copy Markdown
Contributor

To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then runs the binary as the client's
subprocess.

In PR #8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes #8229
See #8240

To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then fulfills the request.

In PR bazelbuild#8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes bazelbuild#8229
See bazelbuild#8240
@laszlocsomor laszlocsomor changed the title Windows, bazel run: fix a bug in PR #8241 Windows, bazel run: don't join all args into argv0 May 10, 2019
@laszlocsomor
laszlocsomor requested a review from meteorcloudy May 10, 2019 10:37

@meteorcloudy meteorcloudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@bazel-io bazel-io closed this in cf7d02a May 10, 2019
@laszlocsomor
laszlocsomor deleted the fix-bashless-run branch May 10, 2019 11:46
irengrig pushed a commit to irengrig/bazel that referenced this pull request Jun 18, 2019
To "bazel run" a binary, the RunCommand creates an
ExecRequest and sends it to the Bazel client,
which then runs the binary as the client's
subprocess.

In PR bazelbuild#8241, RunCommand merged all command line
arguments and added that to the request as a
single argv entry. The client uses the first argv
element as the executable, but if all arguments
are joined into one string then argv0 contains the
whole argument vector as a single string.

Unfortunately the test didn't catch this because
it didn't attempt passing any arguments.

Fixes bazelbuild#8229
See bazelbuild#8240

Closes bazelbuild#8287.

PiperOrigin-RevId: 247590904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: "bazel run" requires Bash [blocking #4319]

3 participants