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 625845 - Exporting Accounts results in 0 byte file.
Exporting Accounts results in 0 byte file.
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
git-master
Other Linux
: Normal normal
: ---
Assigned To: Andreas Köhler
Andreas Köhler
Depends on:
Blocks:
 
 
Reported: 2010-08-02 15:39 UTC by Bob
Modified: 2018-06-29 22:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Account Export Patch (6.69 KB, patch)
2010-08-02 15:39 UTC, Bob
committed Details | Review

Description Bob 2010-08-02 15:39:45 UTC
Created attachment 166988 [details] [review]
Account Export Patch

I was looking at exporting accounts and found that it results in a 0 byte file for a new file. If you do the same operation on an existing file, we get a valid accounts xml file.

From observation and head scratching, what is going on when you export accounts is that you get an "Access method" of 'file' but you get two back-ends for that type, xml and sqlite. The system tries to create a sqlite file but it is 0 bytes, when you do it again to the same file, it decides that it is not a valid sqlite file and then switches to using the xml back-end.

I am not sure if the export should only be to xml but I have provided a patch to do this. Basically I have copied the existing qof_session_begin function to qof_session_export_begin and set xml as the default and modified the account export function to point to this one.


As a side note, I was getting the following error in the trace file :-

CRIT <Gtk> gtk_widget_grab_default: assertion `gtk_widget_get_can_default (widget)' failed

and this has been corrected by adding the following to gnc_gtk_dialog_add_button

gtk_widget_set_can_default (button, TRUE);
Comment 1 Geert Janssens 2010-08-05 19:46:52 UTC
Thank you for reporting this and good work on tracing the cause of the problem.

I hope you are not offended though that I didn't use your patch, but instead chose to fix the issue in another way (see r19405). I had several reasons for that:

* Other than in Export, the bug would manifest also in "Save As..." under certain conditions, namely if gnucash was built without dbi support. So I opted for a solution that works for both export and save as.

* The qof session code works as expected if you pass it a proper uri (<proto>://<something>. The export code didn't pass a URI, but a file name. In that case does the session code assume the generic 'file' protocol, which triggered this bug. Ensuring a proper URI before calling the session code fixes the issue.

* You raise the question if export should only be to xml. I don't see a reason why that would be. If you wish to start a new file/db with the accounts of an existing file, the new file format should not be limited to xml only. So I chose to use the new file dialog, which allows to choose all supported storage methods.

On the other hand, I committed part of your patch to fix the CRIT gtk warning in r19406.
Comment 2 John Ralls 2018-06-29 22:42:25 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=625845. Please update any external references or bookmarks.