Broken data file backward-compatibility in the recurrence of scheduled transactions

Christian Stimming stimming at tuhh.de
Wed Oct 7 16:34:09 EDT 2009


Dear all,

today I finally tracked down one data file backward-compatibility bug that 
seems to happen almost unnoticed: 

If you open a 2.3.x-saved XML file with gnucash-2.2.9, the "recurrence 
interval" of all scheduled transactions will turn into "never", and they will 
stay this way if you save the file with 2.2.9 and open it again later with 
2.3.x.

This incompatibility concerns all XML files which have been saved by 2.3.x and 
are getting opened by any 2.2.x version.

The blame for this issue goes on me. In r17725 on 2008-11-26 (sic!) I 
committed a patch "Bug #106401: Add SX weekend occurence to be shifted to 
weekdays", in which in src/backend/file/gnc-recurrence-xml-v2.c a new XML 
element is written in the <gnc:recurrence> element which is called
<recurrence:weekend_adj>none</recurrence:weekend_adj>. The patch was partly 
reverted later and re-applied after that in r17751, where the xmlAddChild()  
call around line 140 was added again. The 2.2.x parser doesn't know this 
child element of the <gnc:recurrence> and shouts out warnings (see [1] 
below), but, as usual, those warnings are ignored by the user and only after 
quite some time I noticed the scheduled transactions don't appear anymore.

That's bad.

One possibility to make this bug occur less often is to write out the 
<recurrence:weekend_adj> element only if its content is not "none". This will 
at least bring back correct behaviour as long as people haven't used the (new 
in 2.3/2.4) weekend-adjust feature. However, if people have used it and they 
now open the file in 2.2, the recurrence will be silently gone. Nevertheless, 
this would probably be a big improvement already, so I propose to add this 
kind of partly resolution.

Regards,

Christian


[1] Warnings when 2.2.x reads a 2.3.x-written file with 
recurrence:weekend_adj:

* 22:02:03  CRIT <gnc.io> [gnc_xml_set_data()] Unhandled tag: 
recurrence:weekend_adj
* 22:02:03  CRIT <gnc.io> [dom_tree_generic_parse()] gnc_xml_set_data failed
* 22:02:03  CRIT <gnc.io> [dom_tree_to_recurrence()] failed to parse 
recurrence node
<gnc:recurrence version="1.0.0">
      <recurrence:mult>1</recurrence:mult>
      <recurrence:period_type>month</recurrence:period_type>
      <recurrence:start>
        <gdate>2009-10-03</gdate>
      </recurrence:start>
      <recurrence:weekend_adj>none</recurrence:weekend_adj>
    </gnc:recurrence>* 22:02:03  CRIT <gnc.backend.file.sx> 
sx_schedule_recurrence_handler: assertion `r' failed


More information about the gnucash-devel mailing list