quoted strings in --build-properties args

I'm clearly doing something wrong, but I'm having a heck of a time figuring out how arduino-cli wants me to escape strings containing " marks in values passed to --build-properties.

A slightly cut down example:

$ export LOCAL_CFLAGS='"-I/tmp/x" "-I/tmp/y"'

$ arduino-cli compile --fqbn my:valid:fqbn --build-properties "compiler.cpp.extra_flags=$LOCAL_CFLAGS" Sketch.ino

Gets me:

Error: invalid argument "compiler.cpp.extra_flags= "-I/tmp/x" "-I/tmp/y"" for "--build-properties" flag: parse error on line 1, column 26: bare " in non-quoted-field

I've been through just about every permutation I can think of, but can't figure out the correct escaping to be able to pass a string containing a double-quote in as a value for --build-properties.

A search of github issues for arduino-cli doesn't seem to turn up anyone else who's run into this, which leads me to suggest that I'm just missing something really obvious.

Anyone have an idea of what I'm doing wrong?

Thanks!

It has been reported as an off-topic comment on this issue:

I requested they create a dedicated issue report about it, but they never did it. I did create an item in the Arduino Tooling Team's "to do" list so it wouldn't be forgotten by us. However, it is nice to have a public report in the issue tracker as a dedicated place to collect all information related to the issue, so you are welcome to create one.

I have also spent some time messing around with various permutations and also have not been able to find any workaround.

One thing I found confusing with the report from @bxparks was this statement:

Note that the Arduino IDE's --pref flag handles the parsing correctly, so the CLI's --build-properties is not a replacement for the IDE's --pref:

This could be construed as indicating that arduino --pref supported quotes in. However, if you read closely, it's actually saying that arduino --pref supports commas, which arduino-cli --build-properties does not. But arduino --prefalso doesn't support quotes.

I'm happy to create a fresh issue against arduino-cli.

Most of the Google hits I see for the error message are actually about go's csv parser, and the solutions seem to involve enabling a 'LazyQuote' feature in the parser, but having never dug inside arduino-cli, I have no idea if it's the same codepath.

If @bxparks were talking about arduino-builder, their comment might make sense. Because arduino-builder's -pref is "dumb" and does those quotes just fine :wink:

(Reported as Can't include quoted strings in --build-properties args · Issue #1037 · arduino/arduino-cli · GitHub )

Thanks @obra!