-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Upload fails if path contains a space #958
Comments
I suspect that this might not be a problem in arduino-cli, but in the "stm32CubeProg.bat" script that is called by arduino-cli. It looks like the argument to that script is properly quoted, so I suspect that that script is missing quotes. If so, this is a bug to report to the STM32 core you are using. Looking at that script, I indeed think that there is quoting missing here: https://github.com/stm32duino/Arduino_Tools/blob/d13e554308d53f6af62071a625d1ae37a299d823/win/stm32CubeProg.bat#L74 |
Actually, yes, there is a problem with my batch file so you may be right. But also note, that what you see is not what you get: func runTool(..) in github.com/arduino/arduino-cli/blob/master/commands/upload/upload.go
cmdLine is printed Still, if you're confident that NewProcess handles spaces in commands (1st arg) correctly then you needn't bother checking any further and can safely close this matter. Thanks. |
Yeah, I think that just forwards to the go utils which should know how to handle the split array. On e.g. Linux, the split version (array of arguments) is actually passed as an array to the OS, so no further space-splitting happens (this is traditionally done by the shell before passing the array to the OS, but here go does it). On Windows, the OS only accepts a command string, so NewProcess will need to join the array into a command string again, but I'm pretty confident that it will get escaping right. There's still a chance that To doublecheck, you could modify the .bat file to print each argument on a separate line, then you'll be sure whether the spaces are correctly passed to the .bat file or not. |
It's this bug: arduino/arduino-builder#316 Which, unfortunately, is a Go bug: golang/go#17149 I can reproduce it even with stm32CubeProg.bat completely stubbed out. This only happens under the following conditions:
So if you can remove any of those factors, the problem is solved. You might use an executable in place of the batch file. Or you might rework the batch file so that it doesn't require the parameter with the problematic path. I'm not sure how the latter could be done with stm32CubeProg.bat, but I haven't looked at it closely. Here's an example of someone managing to rework their batch file to get around it: |
Wow, I would have expected go to get this bit right, but it seems that the problem is that there is no standard way to encode arguments, just away that "most" programs use, except that Hm, no time to really dig in to what golang does exactly and what a workaround would be for the STM core... |
maybe we can try to do this extra-quoting while running cmd.exe... |
Describe the problem
Upload fails if the upload command contains a space character in the command name:
Upload process fails with the complaint that a command named '
C:\Users\Some
' does not exist.It appears that the command is presumed to end at the first space character, when in actuality it continues with more stuff after the space (see full command above: "
Some
" is first half of the folder name "Some Name
")Expected behavior
Upload starts irrespective of whether path contains a space.
It may still fail for reasons unrelated, though, but that's not the point.
Arduino CLI version
0.13.0
Operating system
Windows
Operating system version
10, (OS Build 19041.508)
Additional context
Additional reports:
The text was updated successfully, but these errors were encountered: