included files override in wrong order

Bug #1076679 reported by Ricardo Kirkner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
configglue
Fix Committed
High
Unassigned

Bug Description

When loading multiple files from the same location, the files are read in the incorrect order. For example, provided the following config file contents

$ cat local.cfg
[__main__]
includes =
    a.cfg
    b.cfg
    c.cfg

$ cat a.cfg
[one]
foo = 1

$ cat b.cfg
[one]
foo = 2

$ cat c.cfg
[one]
foo = 3

The final parsed result will be such that

foo = 1

The reason for this is that the parser is not reset each time an included file is read so that all files get the same value for the 'includes' option causing configglue to read the included files ahead of time.

. Read local.cfg
  . Parses includes line
    . Read a.cfg
      . Finds an include line with value: [a.cfg, b.cfg, c.cfg]
      . Parses includes line
        . Skips a.cfg (already read)
        . Reads b.cfg
          . Finds an include line with value: [a.cfg, b.cfg, c.cfg]
          . Parses includes line
            . Skips a.cfg (already read)
            . Skips b.cfg (already read)
            . Reads c.fg
              . Finds an include line with value: [a.cfg, b.cfg, c.fg]
              . Parses includes line
                . Skips a.cfg (already read)
                . Skips b.cfg (already read)
                . Skips c.cfg (already read)
              . Finishes parsing c.cfg
          . Finishes parsing b.cfg
      . Finishes parsing a.cfg
    . Skips b.cfg (already read)
    . Skips c.cfg (already read)
  . Finishes parsing local.cfg

Related branches

Changed in configglue:
status: New → In Progress
Changed in configglue:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.