On Tue, Feb 21, 2012 at 09:40:26PM +0100, Sébastien Villemot wrote:
> Matija Nalis <mnalis-debian...@voyager.hr> writes:
> > However, it some field is to contain "&" character, GNUcash will SILENTLY
> > drop all transactions after that one. 
> 
> Thanks for your report.
> 
> Would it be possible for you to send us a (possibly small) example XML
> file which triggers the problem? This would greatly facilitate the
> debugging of this issue.

Sure. Here is some hand-trimmed example file.
It contains 4 transactions:

% grep '^<gnc:transaction' silent_truncate_bug.gnucash | wc -l 
4

The seconds one in sequence (with description "marks & spencer") is
problematic (broken).  When gnucash is started on that file, it will
stop importing data, silently dropping all transactions after (and
including) the problematic one, and then it will automatically save 
the truncated file over the original one.

So after starting "gnucash silent_truncate_bug.gnucash", the result is:

% grep '^<gnc:transaction' silent_truncate_bug.gnucash | wc -l
1

without any information from gnucash that anything at all went wrong.

However, if the original file is manually edited and "marks & spencer"
changed to for example "marks and spencer", then the import would work
correctly and all 4 transactions would be retained.

The expected behaviour would be that if the XML is problematic, then gnucash
would stop the import, pop up some error dialog about invalid XML file or
something (maybe with problematic transaction GUID or some other useful
pointer if easily possible), and also refrain from automatically overwriting
original gnucash XML file with truncated data.

-- 
Opinions above are GNU-copylefted.
<?xml version="1.0"?>
<gnc-v2>
<gnc:count-data cd:type="account">2</gnc:count-data>
<gnc:account version="2.0.0">
  <act:name>drinks</act:name>
  <act:id type="guid">00acc400000000000000000008622183</act:id>
  <act:type>EXPENSE</act:type>
  <act:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>HRK</cmdty:id>
  </act:currency>
  <act:currency-scu>100</act:currency-scu>
  <act:slots>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"/>
    </slot>
  </act:slots>
</gnc:account>
<gnc:account version="2.0.0">
  <act:name>wallet</act:name>
  <act:id type="guid">00acc400000000000000000000720911</act:id>
  <act:type>BANK</act:type>
  <act:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>HRK</cmdty:id>
  </act:currency>
  <act:currency-scu>100</act:currency-scu>
  <act:slots>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"/>
    </slot>
  </act:slots>
</gnc:account>
<gnc:count-data cd:type="transaction">4</gnc:count-data>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">00baca00000000000000000000566786</trn:id>
  <trn:date-posted>
    <ts:date>2007-02-23 12:00:00 +0000</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2007-02-23 12:00:00 +0000</ts:date>
  </trn:date-entered>
  <trn:description>first one</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">00beef00000000000000000015003044</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>-3800/100</split:value>
      <split:quantity>-3800/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000000720911</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">00beef00000000000000000015003045</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>3800/100</split:value>
      <split:quantity>3800/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000008622183</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">00baca00000000000000000015905677</trn:id>
  <trn:date-posted>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-entered>
  <trn:description>marks & spencer</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246135</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>-22000/100</split:value>
      <split:quantity>-22000/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000000720911</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246136</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>22000/100</split:value>
      <split:quantity>22000/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000008622183</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">00baca00000000000000000015905680</trn:id>
  <trn:date-posted>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-entered>
  <trn:description>third one is lost</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246141</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>-100000/100</split:value>
      <split:quantity>-100000/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000008622183</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246142</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>100000/100</split:value>
      <split:quantity>100000/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000000720911</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">00baca00000000000000000015905683</trn:id>
  <trn:date-posted>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2005-12-10 12:00:00 +0000</ts:date>
  </trn:date-entered>
  <trn:description>fourth one is also lost</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246147</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>-6300/100</split:value>
      <split:quantity>-6300/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000000720911</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">00beef00000000000000000010246148</split:id>
      <split:reconciled-state>c</split:reconciled-state>
      <split:value>6300/100</split:value>
      <split:quantity>6300/100</split:quantity>
      <split:account 
type="guid">00acc400000000000000000008622183</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
</gnc-v2>

<!-- Local variables: -->
<!-- mode: xml        -->
<!-- End:             -->

Reply via email to