Skip to content

Windows: bash-less run argument quoting is wrong #9106

Closed

Description

@laszlocsomor

Description of the problem / feature request:

The Bash-less "bazel run" (see #8240) quotes arguments incorrectly.

It works correctly in --batch mode, but adds extra " " around escaped arguments in server mode.

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

foo/BUILD:

py_binary(
    name = "x",
    srcs = ["a.py"],
    main = "a.py",
    args = ["foo", "' '", "bar"],
)

foo/a.py:

from __future__ import print_function
import sys
for i in range(1, len(sys.argv)):
    print("arg%d=(%s)" % (i, sys.argv[i]))
C:\src\gh8240>bazel --nobatch run foo:x --noincompatible_windows_bashless_run_command
(...)
arg1=(foo)
arg2=( )
arg3=(bar)

C:\src\gh8240>bazel --nobatch run foo:x --incompatible_windows_bashless_run_command
(...)
arg1=(foo)
arg2=(" ")
arg3=(bar)

C:\src\gh8240>bazel --batch run foo:x --noincompatible_windows_bashless_run_command
(...)
arg1=(foo)
arg2=( )
arg3=(bar)

C:\src\gh8240>bazel --batch run foo:x --incompatible_windows_bashless_run_command
(...)
arg1=(foo)
arg2=( )
arg3=(bar)

On Linux, the output is always the same for all flag combinations:

arg1=(foo)
arg2=( )
arg3=(bar)

What operating system are you running Bazel on?

windows 10

What's the output of bazel info release?

0.28.1

Have you found anything relevant by searching the web?

This is blocking #8240

Activity

  1. self-assigned this
    on Aug 7, 2019
  2. added
    P1
    area-Windows
    on Aug 7, 2019
  3. added
    team-OSS
    on Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1area-Windowsteam-OSStype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions