Control: clone 696282 -2
Control: reassign -2 libxml2
Control: retitle -1 gnucash silently corrupts the account file if it is
truncated when read
Control: retitle -2 libxml2: gzip decompression truncates the output (possible
data loss)
Control: found -2 2.8.0+dfsg1-7
Control: tag -2 upstream fixed-upstream
On 2012-12-19 00:16:41 +0100, Vincent Lefevre wrote:
[...]
> $ gnucash test.gnucash
> Found Finance::Quote version 1.17
> I/O error : Resource temporarily unavailable
> $
I've done tests with gdb, and the problem occurs at
xmlParseDocument( ctxt->data.saxParserCtxt );
in src/backend/xml/sixtp.c line 709 (sixtp_parse_file_common).
It comes from a known bug in libxml2, discussed here:
https://bugzilla.redhat.com/show_bug.cgi?id=877567
It is fixed upstream. I could check with xmllint on the compressed
file that this is the same bug:
$ xmllint test.gnucash
test.gnucash:222630: parser error : expected '>'
</trn:d
^
test.gnucash:222630: parser error : Opening and ending tag mismatch:
date-posted line 222628 and d
</trn:d
^
test.gnucash:222630: parser error : Premature end of data in tag transaction
line 222621
</trn:d
^
test.gnucash:222630: parser error : Premature end of data in tag
template-transactions line 219417
</trn:d
^
test.gnucash:222630: parser error : Premature end of data in tag book line 33
</trn:d
^
test.gnucash:222630: parser error : Premature end of data in tag gnc-v2 line 2
</trn:d
^
No such problem with the uncompressed file. If I truncate the
uncompressed file at </trn:d line 222630 like above, I get the
same problem.
So, this is also a bug in GnuCash, as like xmllint, GnuCash should
have detected the error, but it doesn't:
Breakpoint 1, sixtp_parse_file_common (sixtp=0x95b6a0, xml_context=0x8a6600,
data_for_top_level=0x0, global_data=0x7fffffffd040,
parse_result=0x7fffffffd038) at sixtp.c:699
699 if (!(ctxt = sixtp_context_new(sixtp, global_data,
data_for_top_level)))
(gdb) next
705 ctxt->data.saxParserCtxt = xml_context;
(gdb)
706 ctxt->data.saxParserCtxt->sax = &ctxt->handler;
(gdb)
707 ctxt->data.saxParserCtxt->userData = &ctxt->data;
(gdb)
708 ctxt->data.bad_xml_parser =
sixtp_dom_parser_new(gnc_bad_xml_end_handler, NULL, NULL);
(gdb)
709 xmlParseDocument( ctxt->data.saxParserCtxt );
(gdb)
I/O error : Resource temporarily unavailable
712 sixtp_context_run_end_handler(ctxt);
(gdb)
714 if (ctxt->data.parsing_ok)
(gdb)
716 if (parse_result)
(gdb)
--
Vincent Lefèvre <[email protected]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]