On Thu, 31 Jul 2025 13:28:14 +0000 "Old, Oliver via Cygwin" <cygwin@cygwin.com> wrote: > Hello! > > I have recently noticed that the Windows command line parsing routine of > Cygwin programs does not > work correctly when an escaped quotation mark is included. This is relevant > when launching a Cygwin- > based GCC through Windows CMake-generated Ninja files. We are passing > preprocessor definitions > containing quotation marks to GCC and CMake wants to pass them > backslash-escaped, but unquoted, on > the command line. > > A test program I have written to inspect this issue: > > #include <stdio.h> > int main(int argc, char** argv) { > for (int i = 0; i < argc; ++i) puts(argv[i]); > } > > Running it (via cmd.exe): > > >echo.exe a b\"c\" d > echo > a > b\c" d > > The first escape sequence is ignored, but the quote is read and causes the > parser to switch to > quoted argument mode where it recognizes the remaining escaped quotes as it > already should have done > in regular parsing mode. It then proceeds to eat the remaining command line > as there aren't any > unescaped quotation marks, usually leading GCC to complain about no input > files being given. > > Running the Windows-native version of the program: > > >echo-win32.exe a b\"c\" d > echo-win32.exe > a > b"c" > d > > This should be the expected output. Is the way the escaped quotation mark is > treated intended > behavior? I cannot really see how it would be, given that the parser is only > used for command lines > stemming from being launched by Windows-native programs.
>echo-win32.exe C:\"Program Files"\ echo-win32.exe C:"Program Files\ Is this as you expected? >echo.exe C:\"Program Files"\ echo C:\Program Files\ This makes more sense to me. -- Takashi Yano <takashi.y...@nifty.ne.jp> -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple