Bidir: setting in optional section with non-default value does not get written
Opened this issue · 3 comments
jtdaugherty commented
Steps to reproduce:
- Use
sectionOpt
to specify an optional sectionfoo
- Add to
foo
a settingbar
with a default value - Have the Bidir API read a config file that does not provide any
foo
section at all - Change the underlying data structure's value for
foo
to some value other than the default - Have the Bidir API write a new config file in the same location as the old one
Expected behavior: the new file now has a foo
section with a bar
setting indicating the new value.
Observed behavior: the new file still has no foo
section and defaults bar
to the default value.
benjaminselfridge commented
The problem is that updateIniSections
never checks for optional sections whose fields have been modified from their default values. It simply walks through the sections that already exist in the config file, updates them, and calls it good.
benjaminselfridge commented
Patch incoming...
jtdaugherty commented
@aisamanra It turns out we'll need to prepare some other patches first. We thought this might be the only significant patch we need to get you, but there are other changes we've been sitting on that we haven't submitted.