ImageRegExFail (Or, why WPILib C++ Deploy may hate America™)

We had a bizarre problem crop up deploying code to one of our RoboRIOs. Deploying to the test robot worked fine, but the production robot would fail, claiming the image was not correct. The “correct” version given was 2016 v19… which is what we had installed.

The “installed” version given was the nefarious “ImageRegExFail”.

After uninstalling and reinstalling plugins, Eclipse itself, and toolchains, and reformatting and reimaging and re-firmware’ing the RIO a dozen times over the course of the week, I finally found it.

If, in the NI Web-based Configuration of the RIO, you put a carriage return in the “Comments” field of the System Settings, the sysProps.xml file generated by the deploy mechanism is created with spaces between every character. Thus, the regular expression matching in build.xml that pulls out the year and version number will fail, and the deploy script promptly faceplants.

2016 Production Robot
Team 1622, Poway HS

is bad. However

2016 Production Robot Team 1622, Poway HS

is perfectly acceptable.

Either that comments field should not accept a carriage return, or the process that generates sysProps.xml needs to be modified not to choke on it.

Barring that, the Google Fairy will find this post for the next poor schmuck to run into this!

Here’s another easy fix if you know what you’re doing

Go to %userprofile%/wpilib/cpp (or java)/current/ant
Open build.xml
Scroll mostly to the bottom
Comment out the image check

Also the reason sysprops appears to have spaces between every character is because it’s encoded in utf16. Build.xml should be reading it as utf16 (for us the image regex works fine, even though our sysprops has the same apparent spaces between every character - and afaik our comment isn’t multi-line)

That’s a great short-term solution, good enough for me, but not one I could use beyond my own systems. We had the windfall this year of a large programming team, most of whom had their own laptops, and a programming mentor who worked with all of them to write robot code and deploy it on a test board attached to a test drive chassis. I don’t want to have them all fuss with their installations like that.

Besides, they won’t all keep up on updates, so they should have the version check enabled to catch them.

I saw how things are flagged utf-16, I don’t know why the sysProps is read incorrectly here while it succeeds for others. Maybe I’ll figure that out later on.