raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.62k stars 779 forks source link

semicolon in wifi password/name creates invalid output #431

Open Poohl opened 8 months ago

Poohl commented 8 months ago

ISSUE

As the name suggests, configure the project with a semicolon in the Wifi name or password and the build will fail due to /bin/sh: 1: Syntax error: Unterminated quoted string because the cmake splits the argument into a list at the semicolon.

Example to reproduce:

cmake -DPICO_BOARD:STRING=pico_w -DWIFI_SSID:STRING="wifiname" -DWIFI_PASSWORD:STRING="pass;word"  -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/arm-none-eabi-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/arm-none-eabi-g++ -Bbuild -G Ninja

resulting in this output in build.ninja:

DEFINES = .... -DWIFI_PASSWORD=\"pass -DWIFI_SSID=\"wifiname\" -Dword"

FIX

by passing \; you can make it work, which means you have to pass \\\; on the shell because it eats the first and then every second. I'm not sure this can even be fixed in the build process itself.

jcarranz97 commented 7 months ago

I think the workaround of using \\\; is the best solution here as this is a cmake feature as mentioned here.

Even in the cmake discourse forum, this topic was discussed and Alain Martin recommended to use \\\; https://discourse.cmake.org/t/escaping-semicolons-in-cmake-configure-depends/447