- 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:
<setting id="TEST_KEY" value="$-you_can_see_me\you_can_not_see_me" />
Here is what we get before merge:
echo '<setting id="TEST_KEY"
value="$-you_can_see_me\you_can_not_see_me" />' | 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 '<setting id="TEST_KEY"
value="$-you_can_see_me\you_can_not_see_me" />' | 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"