[augeas-devel] dhcpd change for quoted characters

Robert Drake rdrake at direcpath.com
Sun Feb 23 06:54:24 UTC 2014


I think it's best to start off showing what I'm doing with an example 
test that fails:

test Dhcpd.lns get "class \"ugly quotes\" {}" =
   { "class" = "ugly quotes" }

Test 
failure:/home/rdrake/code/augeas/lenses/tests/test_dhcpd.aug:518.0-519.29:
  Expected:
{
   { "class" = "ugly quotes" }
}

  Actual:
{
   { "class" = ""ugly quotes"" }
}

The reason it's doing this is because rather than processing the quotes 
the code just stores anything leading up to a space:

let stmt_block_arg (body:lens)
                       = [ indent . key stmt_block_arg_re . sep_spc . 
sto_to_spc . sep_obr . body* . sep_cbr ]

sto_to_spc actually matches on quoted values, but doesn't delete the quotes:

let sto_to_spc        = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/


Now, this isn't bad to fix but so far I've been trying to leave the 
output alone so everyone's existing scripts would work.  Changing this 
to match quotes would mean that anyone counting on the current way would 
be broken next time they upgraded.  Is that okay or should I just leave 
it alone?  I could always make a new dhcpd4.aug that people could use if 
they needed the new stuff.




More information about the augeas-devel mailing list