[llvm-bugs] [Bug 39506] New: Regression in batch file quote handling
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 31 04:15:47 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39506
Bug ID: 39506
Summary: Regression in batch file quote handling
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: release blocker
Priority: P
Component: Support Libraries
Assignee: unassignedbugs at nondot.org
Reporter: jh7370.2008 at my.bristol.ac.uk
CC: llvm-bugs at lists.llvm.org
We have a downstream user of clang who is using the preprocessor to define
macros in an assembly file. Here is an example snippet:
// bar.s
.section .rodata,"a"
.asciz FOO
They preprocess and assemble the code as part of a larger batch file. The
relevant command looks something like this:
// run.bat
clang.exe -c -x assembler-with-cpp -DFOO="""%~1""" bar.s -o bar.out.o
Usage:
C:\Work>run.bat 123
This used to work fine, but a recent change to LLVM's command-line parsing
appears to have broken the behaviour of how the quotes were handled.
Previously, one set of double quotes were removed, and then each pair of double
quotes became a single double quote in the macro, so the resultant value of FOO
was "123" (i.e. the line in the assembly became .asciz "123").
Following the change, all the quotes look to be discarded, such that the value
of FOO becomes 123, leading to the assembly output '.asciz 123', which is
invalid asm, and results in a compiler error:
bar.s:2:8: error: expected string in '.asciz' directive
.asciz 123
(Note that running this directly on the command-line also results in the error
when run via cmd, when it did not previously)
I bisected the change causing the regression to r341988: "[Support] Avoid
calling CommandLineToArgvW from shell32.dll".
Filing this as a release blocker, as it could easily break people's builds when
they are using batch files, although I acknowledge that the user in this case
could work-around by doing '.asciz "FOO"' instead, so feel free to change the
severity if you think I'm wrong.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181031/720d26c1/attachment.html>
More information about the llvm-bugs
mailing list