handle data escaping properly in cnf vars
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 7 Feb 2019 13:45:40 +0000 (14:45 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 7 Feb 2019 15:11:32 +0000 (16:11 +0100)
commit5afd18a722cb939ed3fb5472ceda496e77fad7ac
tree7a944f8716bd7be2951bd5064d62565337c47db2
parentb515a3868229ebd67cc1c850d6a3857f1c99a4ba
handle data escaping properly in cnf vars

libcnffile has an additional step that strips escaping from
var data so this:

    42 MY_VAR,0: "foo\"bar\"baz"

is actually a valid CNF_VAR with a data member equals ``foo"bar"baz''.
Till now, cnfvar.py would reject such a line because of the
stricter matching. Since escaped strings are ubiquitous in JSON
encoded data, this must be handled properly. (Ironically this is
not an issue with the JSON interface due to the builtin string
escaping rules of the format.)

Imitate the behavior of libcnffile so properly escaped double
quotes don't terminate the string matching. Lucky for us we can
get away with extending the line regex with an alternating
pattern in a non-matching group ``(?:...''.
src/cnfvar.py