Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: py_binary launcher incorrectly escapes arguments #7958

Closed
laszlocsomor opened this issue Apr 5, 2019 · 1 comment
Closed

Windows: py_binary launcher incorrectly escapes arguments #7958

laszlocsomor opened this issue Apr 5, 2019 · 1 comment
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Apr 5, 2019

Description of the problem / feature request:

On Windows, py_binary.args and py_test.args are not Bash-tokenized and not escaped properly.

This bug is similar to #7072.

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

BUILD:

py_binary(
    name = "binargs",
    srcs = ["testargs.py"],
    main = "testargs.py",
    args = ["foo", r"a\\\"", "bar"],
)

py_test(
    name = "testargs",
    srcs = ["testargs.py"],
    args = ["foo", r"a\\\"", "bar"],
)

testargs.py:

from __future__ import print_function
import sys
for a in sys.argv[1:]:
    print("arg=(%s)" % a)

Actual (buggy) output:

C:\src\tmp>bazel run binargs
(...)
arg=(foo)
arg=(a\ bar)

C:\src\tmp>bazel test testargs --test_output=all
(...)
arg=(foo)
arg=(a\\ bar)

Desired output:

arg=(foo)
arg=(a\")
arg=(bar)

What operating system are you running Bazel on?

windows 10

What's the output of bazel info release?

release 0.24.1

@laszlocsomor laszlocsomor self-assigned this Apr 5, 2019
@laszlocsomor laszlocsomor added bazel 1.0 P2 We'll consider working on this in future. (Assignee optional) area-Windows Windows-specific issues and feature requests type: bug labels Apr 5, 2019
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Apr 8, 2019
See bazelbuild#7958

RELNOTES[NEW]: Windows, Python: the --incompatible_windows_escape_python_args flag (false by default) builds py_binary and py_test targets with correct command line argument escaping.
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Apr 8, 2019
See bazelbuild#7958

RELNOTES[NEW]: Windows, Python: the --incompatible_windows_escape_python_args flag (false by default) builds py_binary and py_test targets with correct command line argument escaping.

Change-Id: I789f9370e2cf59fa1a179716ca1c6ad80e1d583e
bazel-io pushed a commit that referenced this issue Apr 9, 2019
Incompatible flag: #7974
See #7958

RELNOTES[NEW]: Windows, Python: the --incompatible_windows_escape_python_args flag (false by default) builds py_binary and py_test targets with correct command line argument escaping.

Change-Id: I789f9370e2cf59fa1a179716ca1c6ad80e1d583e

Closes #7973.

Change-Id: I789f9370e2cf59fa1a179716ca1c6ad80e1d583e
PiperOrigin-RevId: 242628695
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue May 10, 2019
Follow-up to PR bazelbuild#7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: bazelbuild#7974
See bazelbuild#7958
bazel-io pushed a commit that referenced this issue May 10, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 13, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 17, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 17, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 20, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 21, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 22, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 23, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 23, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
aehlig pushed a commit that referenced this issue May 24, 2019
Follow-up to PR #7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: #7974
See #7958

Closes #8289.

PiperOrigin-RevId: 247596101
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
Follow-up to PR bazelbuild#7973

Copy the --incompatible_windows_escape_python_args
value also to the host config options.

Incompatible flag: bazelbuild#7974
See bazelbuild#7958

Closes bazelbuild#8289.

PiperOrigin-RevId: 247596101
@laszlocsomor
Copy link
Contributor Author

Fixed in Bazel 0.27

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

No branches or pull requests

2 participants