After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678214 - GnuCash fails to open some post-processed XML files
GnuCash fails to open some post-processed XML files
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Backend - XML
2.4.x
Other All
: Normal minor
: ---
Assigned To: Christian Stimming
Geert Janssens
Depends on:
Blocks:
 
 
Reported: 2012-06-16 16:46 UTC by Daniel Harding
Modified: 2018-06-29 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to allow GnuCash to accept modified but valid XML files. (1.85 KB, patch)
2012-06-16 16:46 UTC, Daniel Harding
committed Details | Review
Test file which demonstrates the problem. (611 bytes, application/x-gnucash)
2012-06-16 16:54 UTC, Daniel Harding
  Details

Description Daniel Harding 2012-06-16 16:46:09 UTC
Created attachment 216576 [details] [review]
Patch to allow GnuCash to accept modified but valid XML files.

I have some Python scripts that load GnuCash XML files, make some modifications, and write them back out.  As of GnuCash 2.4.10, GnuCash can no longer load my modified files.  Instead, I get the message "This file/URL appears to be from a newer version of GnuCash. You must upgrade your version of GnuCash to work with this data."

I did some investigation and found that this is due to r21908, which changed gnc_is_our_first_xml_chunk in src/backend/xml/sixtp.c to check for a linefeed (\n) after the <gnc-v2 tag opening.  My files have a space instead, which was causing GnuCash to become confused and think the file was from a later version.

I have created a patch to gnc_is_our_first_xml_chunk which instead checks for any whitespace character after the <gnc-v2 tag opening.  It applies cleanly to the current trunk and is easily backported to the 2.4 branch (though it can't be applied as is because of whitespace changes on the trunk).
Comment 1 Daniel Harding 2012-06-16 16:54:26 UTC
Created attachment 216577 [details]
Test file which demonstrates the problem.
Comment 2 Geert Janssens 2012-06-22 14:43:30 UTC
Comment on attachment 216576 [details] [review]
Patch to allow GnuCash to accept modified but valid XML files.

Committed as r22229 (trunk) and r22230 (2.4), thank you very much.

Officially I'll add this disclaimer: GnuCash doesn't support any changes to the data file from any tool not using the GnuCash access routines (the "GnuCash Engine").

Given the patch you just sent, you obviously know what you are doing, so feel free to disregard that statement.

Your patch was a good improvement to GnuCash in general and hence it was accepted :)
Comment 3 Daniel Harding 2012-06-23 20:40:49 UTC
Thanks for taking my patch!  I agree with you, and don't expect support or assistance from the GnuCash team for using my own custom tools.  In this case, it seemed that this change simplified the GnuCash code as well as made it work better for my case.  Glad you agreed :-)  Thanks for working to make a great piece of software!
Comment 4 John Ralls 2017-09-24 22:49:03 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 5 John Ralls 2018-06-29 23:09:12 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=678214. Please update any external references or bookmarks.