Community
Participate
Working Groups
In org.eclipse.tm.terminal.connector.process.ProcessConnector.connect(ITerminalControl) there is a StreamTokenizer used to convert the command line into an array, which is basically a split on whitespace. This means that by the time the Spawner receives a command that started like this: "C:\Program Files\Git\bin\sh.exe --login -i" it looks like this: [C:\Program, Files\Git\bin\sh.exe, --login, -i] Amazingly the native code in CDT (or Windows itself) has a matching bug that permits this and puts it back together correctly.
This is a defect that does not appear most of the time because on Windows (where spaces are more typical) the split string in rejoined with spaces and passed to CreateProcess which takes a single string. So the dodgy split is never noticed. On Linux, since spaces are less typical, there is no join happening later because execve/execv is used that takes the array. I would have to jump on my Linux machine to test what actually would happen (what sort of error?) if the launch happened on a Linux machine with a space in the executable name.
(In reply to Jonah Graham from comment #0) > This means that by the time the Spawner receives a command that started like > this: > > "C:\Program Files\Git\bin\sh.exe --login -i" Actually it does not start like ^^^ but instead starts as two different strings: "C:\Program Files\Git\bin\sh.exe" and "--login -i" which are joined together, and then immediately split.
Arrgh! The concatenation in Windows is even wrong, but works anyway.... If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter) (from https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw) -- but because Windows can't break old bugs it seems that doing an unquoted C:\Program Files... works anyway. https://docs.microsoft.com/en-ca/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way for the right way to do the concatenation - assumes that the array was correct in the first place.
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/180923
One side effect of this bug is that on Windows when OpenProcess is used we are limited to MAX_PATH for the the executable name because we don't use the first argument of OpenProcess.
I am not changing this now, it should be fixed soon, but I want to decouple it from the other work. See https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/180894/2/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/pty/ConPTY.java#74 for a place that should be changed once the fix here is done.
Gerrit change https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/180923 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=1557c2c4f50d780f03fdae91d4eefa73981b0111
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/181944
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/181945
Gerrit change https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/181944 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=1ac907184bc8f8e89bbabbfbe06e249dcda7cdfd
Gerrit change https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/181945 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d907da99a48af43531006f04578a343fbacebb97