OpenELEC/OpenELEC.tv — pull request #1433 by ribbon10 (2012-11-04 20:03:51+00:00)
Title: Corrections for create of /var/config/settings.conf

- Busybox awk does not interpret the -F option as regular expression.
With this patch the field seperators are '" and not \"|'
- Added gsub for $ so that it becomes \$. THis is because the generated
config file assignes string with "" to variables. Insite "" the $ sign
is used to reference variables.

This problem was discovered with a wlan passphrase that included a \
and & sign. Here is a example string that can be used to reproduce both
problems:

Here is what we get before merge:
echo '' | awk -F'[\"|'\'']'
'{gsub(/\"\;/, "\\\"", $4); gsub(/\&apos\;/, "\047", $4);
gsub(/\&\;/, "\\&", $4); gsub(/\<\;/, "<", $4); gsub(/\>\;/,
">", $4); print $2"=\""$4"\"";}'
TEST_KEY="$-you_can_see_me"

Here is what we get after merge:
echo '' | awk -F'["'\'']'
'{gsub(/\"\;/, "\\\"", $4); gsub(/\&apos\;/, "\047", $4);
gsub(/\&\;/, "\\&", $4); gsub(/\<\;/, "<", $4); gsub(/\>\;/,
">", $4); gsub(/\$/, "\\\$", $4); print $2"=\""$4"\"";}'
TEST_KEY="\$-you_can_see_me\you_can_not_see_me"