Backwards compatibility with new currency issue and bug 336843.

Frédéric Perrin fred at
Tue Nov 19 16:58:31 EST 2013

Hi Mike,

Le dimanche 10 à 14:19, Mike Evans a écrit :
> While testing bug 336843 patch for backwards compatibility with
> 2.4.13, I was getting this output below. The file fails to load.
> * 11:49:30  WARN <> [valid_commodity()] Invalid commodity: 0 fraction
> * 11:49:30  WARN <> [gnc_commodity_end_handler()] Invalid commodity parsed
> <gnc:commodity version="2.0.0">
>   <cmdty:space>ISO4217</cmdty:space>
>   <cmdty:id></cmdty:id>
            Is the ID really missing, or just a copy error ?

>   <cmdty:slots>
>     <slot>
>       <slot:key>user_symbol</slot:key>
>       <slot:value type="string">ZK</slot:value>
>     </slot>
>   </cmdty:slots>
> </gnc:commodity>
> The new ZMW currency was introduced in May with r22965, commit
> ab0cfdce5a. Reverting the commit fixes the problem, but obviously this
> is not a "fix" and the problem lies elsewhere.
> I'll file a bug for this, I mention here only as information for
> anyone following the bug 336843 thread.

I haven't found the bug report in Bugzilla, have you had time to open it
yet or is my search-fu lacking ?

Anyway, this is due to r23345 : since we set the user_symbol of every
currency at startup, the KVP of every currency, even those not used, now
contains simething. Therefore, in gnc_commodity_dom_tree_create(),
kvpnode is !NULL, and every currency gets dumped to the XML file at save
time. That includes the new ZMW, and when your old gnucash that doesn't
know about ZMW sees that currency, it aborts with "Invalid commodity".

I suppose we don't want to dump every currency into the save file
whenever the file is written. Do we want to check currency->usage_count ?
Do we want an API Bool gnc_account_currency_used(Account, gnc_commodity) ?
Thoughts ?


More information about the gnucash-devel mailing list