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

cmd_bat quoted args escaping #11975

Closed
stdbug opened this issue Aug 19, 2020 · 0 comments
Closed

cmd_bat quoted args escaping #11975

stdbug opened this issue Aug 19, 2020 · 0 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-Server Issues for serverside rules included with Bazel type: bug

Comments

@stdbug
Copy link

stdbug commented Aug 19, 2020

ATTENTION! Please read and follow:

  • if this is a question about how to build / test / query / deploy using Bazel, or a discussion starter, send it to bazel-discuss@googlegroups.com
  • if this is a bug or feature request, fill the form below as best as you can.

Description of the problem / feature request:

genrules cmd_bat argument quoting results in incorrect syntax/"The system cannot find the file specified"

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

create a random file so that it's full path contains a space, then

genrule(
    name = "test",
    outs = ["test.txt"],
    cmd_bat = "copy \"C:\\New folder\\test.txt\" $(@D)\\test.txt",
)

OR

genrule(
    name = "test",
    outs = ["test.txt"],
    cmd_bat = """copy "C:\\New folder\\test.txt" $(@D)\\test.txt""",
)

What operating system are you running Bazel on?

Windows 10 x64

What's the output of bazel info release?

release 3.4.1

Have you found anything relevant by searching the web?

No

Any other information, logs, or outputs that you want to share?

Dumping the command by adding echo in front of copy:

genrule(
    name = "test",
    outs = ["test.txt"],
    cmd_bat = """echo copy "C:\\New folder\\test.txt" > $(@D)\\test.txt""",
)

shows that cmd.exe actually gets

copy \"C:\New folder\test.txt\"

which is not accepted by cmd.exe

@oquenchil oquenchil added area-Windows Windows-specific issues and feature requests team-Rules-Server Issues for serverside rules included with Bazel type: bug untriaged labels Aug 28, 2020
@lberki lberki added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Nov 18, 2020
@mai93 mai93 self-assigned this Jan 13, 2021
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 P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-Server Issues for serverside rules included with Bazel type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants