WSL: Transferring quotes from bash to windows app doesn't work as expected
hello.c
#include <stdio.h>
int main (void) {
printf (INIT_VER_STR);
}
user@machine:/mnt/d/code$ gcc -c hello.c -DINIT_VER_STR="\"Hello, world\"" -e
output >>
…
int main (void) {
printf ("Hello, world");
}
<<
Note: gcc is Ubuntu app
user@machine:/mnt/d/code$ armcc.exe -c test.c -DINIT_VER_STR="\"Hello, world\"" -e
output >>
…
int main (void) {
printf (Hello,);
}`
<<
Note: armcc.exe is Windows app
Windows build number .15007 Note: running armcc.exe under cygwin yeilds expected results.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 15 (5 by maintainers)
Upon further inspection it appears that Ben’s fix has broken this use case. Worse, I don’t see a way to circumvent the new bug. Consider the following program compiled to args.exe:
Here is the output from a Windows shell:
Note that the inner quotes cause foo and bar to be treated as a single argument unless you escape those quotes. Here is from a WSL session:
Here foo and bar are treated as separate arguments whether you use quotes or not.
I have a fix for this issue and #2164 in code review currently.