-
Notifications
You must be signed in to change notification settings - Fork 859
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
Command-line arguments to Windows exe not quoted when they contain tabs #2164
Comments
@cspotcode - Hmm... what if use arguments that make quote? I could not sure... but...
Or
This reminded me #2069 to make this elisp function;
UPDATE1:
But... it seems to make another problem;
And...
But... it might be natural, comparing
UPDATE2: I got a some idea just now but does not have EchoArgs.exe. EchoArgs.exe looked like to need dot.NET3. I had haven a plan to restore OS backup image, so I tested above before that, but I have clean image now and... feel uncomfortable with restoring again. What if I tested %q qualifier with above arg1 function;
UPDATE3:
|
You can create your own Some of the solutions you're attempting are being affected by bash's argument splitting, so you should modify your tests to output the argv array in Linux first, and then pass it to EchoArgs.exe, so you can see the difference. Otherwise you'll be accidentally splitting arguments before passing them to the Windows exe. It's possible to manually wrap arguments in double-quotes, but this must be done only for arguments that contain tabs and not spaces. It cannot be done for arguments containing spaces. Essentially, the workaround must understand WSL's inconsistent quoting behavior. I don't think this is what the WSL developers intended, which is why I reported this behavior as a bug. |
@cspotcode - Ah... I think you mean...
should be same as
or
UPDATE: Yeah... feeling strange, comaring with PowerShell;
|
The problem is not only about tabs, it's the whole "convert argv array to single CommandLine string for windows". AFAIK almost all Windows executables follow these rules, so WSL should build the CommandLine accordingly:
Even many applications that don't follow these rules could benefit from this: AFAIK cygwin's slightly incompatible commandline parsing (or even A similar issue exists for powershell (PowerShell/PowerShell#1995). Fixing this in powershell requires many thoughts about backward compatibility. |
Thanks again for reporting this issue, I have drafted a fix that resolves this and #1625. |
This should be fixed in Fall Creators Update or any build > 16273 |
Your Windows build number:
Microsoft Windows [Version 10.0.15063]
What you're doing and what's happening:
When I invoke a Windows executable from WSL and one of the command-line arguments contains a tab, WSL is not wrapping it in double-quotes. Windows executables usually split command-line args on tabs.
EchoArgs.exe is from Pscx; real path is
C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe
but I truncated it above for readability.What's wrong / what should be happening instead:
WSL should be wrapping args that contain tabs in double-quotes like it does for args containing spaces.
It appears that double-quotes are not necessary for
\v
,\r
,\n
, or\f
characters, so those don't cause any problems.Sorry if this is a duplicate; I couldn't find a preexisting issue.
The text was updated successfully, but these errors were encountered: