-
Notifications
You must be signed in to change notification settings - Fork 91
Files Paths are Not Properly Quoted in platform.txt #175
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
Comments
I can add quote
There is still some issue with space that I can not help any further, because all spaces are protected with quote.
But when I copy the folder and remove all the spaces, the compile just runs fine, I don't think I've set anything wrong. So you need to go back to SDCC to ask what get wrong. |
I'll try to dig around some when I have time. I've spent some time thinking about this, and I think it is two separate bugs. I can't see how the two error messages from ash are related to the sdcpp error message, because the commands listed by Arduino are entirely unquoted, while the compile command appears to be properly quoted. I'm not familiar enough with the inner workings of Arduino to figure it out on my own, but I've looked at platform.txt, and it looks like things are properly quoted. Further, the actual compile command does seem to have everything properly quoted but is still failing, so either there's something strange going on in sdcc.sh, or the SDCC bug is not fully fixed. I'll dig around some more when I have time. I suspect the ash errors are due to a bug in Arduino itself. I'll run this by the guys on the Arduino side and see if they are willing to consider this. The actual compile error could still be in the shell script, or in SDCC. I happen to have come across a document from Microsoft about how no one knows how to do argument quoting right. I haven't finished reading it, but maybe the answer is in there somewhere. In my personal opinion, the biggest problem here is that Arduino itself does not allow the user to set a custom build location. That would be a trivial solution to this problem (and pre-2.0 versions of Arduino did allow this), but evidently they think they know better than the user, which this issue proves wrong. Anyhow, rant aside, I'll see if I can figure out what is going on. At this point I've posted bug reports on SDCC, here, and on Arduino, so I might as well be liaison between projects, so far as I have time to do so! |
Ok, I'm looking through sdcc.sh, and I've come across some code looking for cp. This has led me to a question. I'm using Windows, and I have MinGW installed. This means that I do have cp installed (and rm), so the script should find cp, despite the fact that I'm using Windows. Is there any chance this could cause any issues? |
I think I've worked out the issue. In the script, you use the first few arguments $1-$4 explicitly. These seem to be correctly quoted. The rest of the arguments are used as-is, with $@. Some of these arguments are not correctly quoted, and they appear to be fed to the script that way by Arduino. Most of them are fine, but these three are not:
Could this be solved by quoting all of the arguments in $@ in a for loop? No, I tried this, and it didn't work. My shell scripting skills are not currently good enough to isolate and quote just the I've explained this on the Arduino bug report on this issue, in hopes of learning more about how this stuff is supposed to work and why Arduino is doing it the way it is doing it. I don't know if Arduino should be quoting those arguments, if there is something that can be done in platform.txt to handle it, or if it needs to be handled in the shell script, but maybe someone over there can help me figure it out. I suspect a for loop that goes through $@ building an argument list and quoting just the Anyhow, I'll report back once I've gotten a response from Arduino. |
It looks like I was wrong. They are properly quoted when sent to the shell script, but the quoting is stripped as normal. This means either they need a second layer of escaped quoting coming into the script (which might be possible in platform.txt; I just asked about this in the Arduino issue), or the script itself has to reapply the quotes. |
Testing: arduino/arduino-ide#2602 (comment) Quoting line 76 in platform.txt to look like this seems to work for the third
|
At this moment I suspect SDCC more than Arduino because running commands in cmd:
Does not work, but it will work after I remove the space. |
I'll look at that. My normal local SDCC isn't installed in a path with a space in it, so I haven't really tested that. I have an SDCC project outside of Arduino that I've been using for command line testing. I'll see if I can alter my makefile to use the ch55xdino installed SDCC that is on a path with a space. If I run into similar issues, and they only occur on the SDCC in the path with a space, I'll file another bug report with SDCC. I'm pretty sure it's not just SDCC though. The |
I haven't got to the -I part yet. I think the SDCC need to fix "sdcpp.exe: fatal error: too many input files" before the bug can be fully solved. |
Yeah, your command doesn't have spaces in the That issue looks like the one I was seeing before I updated SDCC to the latest snapshot... I'm using 15177. Yours is slightly more recent. I'll try replacing my ch55xduino SDCC with that and see what happens. Are you using the 32-bit or 64-bit version of that snapshot? |
64bit |
Well darn. I tried to reproduce your error with the following command, but instead it compiled without any problem. The version you have in your test setup is 15197? The following is using the 64-bit build of that version (I just doubled checked with -v).
I normally work in Git Bash, but I did this with CMD, since it looks like that is what you are using. |
Hmm, I removed my local SDCC install from the path, to ensure it wasn't trying to use something from that, and now I get this error:
The zip file with version 15197 does contain an executable named cc1.exe, but it's not in I don't know. I can't reproduce your issue, but when I quote the I'll see if I can put together a for loop to quote the |
If you find a solution, you may share the edit you've done with a PR and I'll test to see if it works without space. Then the next time I update the compiler it will be fully fixed. |
Well, that doesn't work either, because it crashes the I have no clue how to fix this at this point. If the I wonder... Here's what I've done in the script: I added this:
I changed the first compile line from this:
...to this:
I changed the second compile line from this:
...to this:
Notice that the So I'm wondering: If I can figure out how to make Do you know Ash well enough to figure out what I need to do to make that for loop generate an array of strings rather than a single string? |
not really, the script was originally done by https://github.com/tenbaht/sduino |
Alright, I'll try to do more digging when I have time. I tried to figure it out yesterday, but it's hard to find anything on the topic that isn't for Bash. |
arduino/arduino-ide#2602
I originally filed this issue with Arduino. The verbose compile output is below. You'll notice that under "Detecting libraries used..." and "Generating function prototypes", there is no quoting of the file paths, which is resulting in them being split into 3 separate arguments (due to Windows deciding that it needed to include spaces in my username during installation). This causes ash to fail. The result of this appears to be malformed arguments to SDCC, which appears to interpret an extra argument as an additional source file argument, causing it to fail.
According to the dev who responded on the arduino-ide issue linked to above, the problem is lack of proper argument quoting in platform.txt, which should be very easily fixed.
Here's the verbose compile output:
The text was updated successfully, but these errors were encountered: