GnuCash
Contact   Instructions
Bug 797011 - GnuCash 3.4 Crashes When Printing Checks with Custom Format
Summary: GnuCash 3.4 Crashes When Printing Checks with Custom Format
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Check Printing (show other bugs)
Version: 3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
: 797128 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-01-03 19:40 EST by Ben Franske
Modified: 2019-03-19 07:34 EDT (History)
7 users (show)

See Also:


Attachments
Debug Trace File (60.04 KB, application/octet-stream)
2019-01-03 19:40 EST, Ben Franske
no flags Details
Sample custom check which crashes (544 bytes, text/plain)
2019-02-01 11:23 EST, Ben Franske
no flags Details

Description Ben Franske 2019-01-03 19:40:45 EST
Created attachment 373099 [details]
Debug Trace File

1) Recently upgraded to 3.4+ from 2.16+
2) Tested and was able to reproduce with a newly created database file

Steps to Reproduce:
1) Select an entry you wish to print a check for from either a new gnucash file or an existing file
2) File -> Print Checks -> Check Format: Custom -> Custom format tab -> Save Format button
3) Name the custom format to be saved
4) GnuCash Crashes while saving the format
5) Try re-launching GnuCash
6) Select an entry you wish to print a check for from either a new gnucash file or an existing file
7) File -> Print Checks
8) GnuCash Crashes

Alternatively, instead of trying to save a custom format from inside GnuCash create a custom format file by hand. Try opening the Print Checks dialog in GnuCash and it crashes.

See attached trace file.
Comment 1 Christopher Lam 2019-01-03 19:58:08 EST
Agree in v3.4, Win10 as soon as I click 'Print Checks' it crashes.

The first time a warning appeared: "The GUIDs in the XXX check format file 'XXX' and the XXX check format file 'XXX' match.

The subsequent times no warning is shown.

I don't usually use check printing.

Tracefiles:

1.
* 08:49:48  WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process (No such file or directory)
* 08:50:15  WARN <gnc.backend> [GncXmlBackend::session_begin()] Might clobber, no force
* 08:50:38  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key Blocking_Chars_1, error: Key file contains key “Blocking_Chars_1” which has a value that cannot be interpreted.
* 08:50:38  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key Blocking_Chars_2, error: Key file contains key “Blocking_Chars_2” which has a value that cannot be interpreted.
* 08:50:38  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key DateFormat_2, error: Key file contains key “DateFormat_2” which has a value that cannot be interpreted.


2.
* 08:50:59  WARN <gnc.app-utils> Could not spawn perl: Failed to execute child process (No such file or directory)
* 08:51:29  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key Blocking_Chars_1, error: Key file contains key “Blocking_Chars_1” which has a value that cannot be interpreted.
* 08:51:29  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key Blocking_Chars_2, error: Key file contains key “Blocking_Chars_2” which has a value that cannot be interpreted.
* 08:51:29  WARN <gnc.printing.checks> Check file CPA 006 Middle ASAP.chk, group Check Items, key DateFormat_2, error: Key file contains key “DateFormat_2” which has a value that cannot be interpreted.
Comment 2 Ben Franske 2019-01-03 20:00:45 EST
(In reply to Ben Franske from comment #0)
> 1) Recently upgraded to 3.4+ from 2.16+

Correction, upgrade was from 2.6.16+
Comment 3 David P. Riedel 2019-01-06 16:48:58 EST
This happens to me also. I have a custom format I have been using for a few years now with no problems.  Upon upgrading from version 3.3, Guncash crashes when I try to use this format.
Comment 4 lageotakes 2019-01-31 17:41:43 EST
I have the same problem.  Just upgraded to 3.4+ (2018-12-30) running widows 7 64 bit.

I removed all custom checks in C:\Users\admin\.gnucash\checks directory and it still crashes.

I need to print checks.  Any suggestions.  I can print report just fine.
Comment 5 Geert Janssens 2019-02-01 02:55:36 EST
As this bug was introduced between gnucash 3.3 and 3.4, your best workaround so far is probably to reinstall gnucash 3.3.
Comment 6 Geert Janssens 2019-02-01 09:37:30 EST
Can someone attach a sample custom check format here to experiment with ?

Apart from that I have found and fixed a use-memory-after-free issue in that same code. If you can please test with tomorrow's nightly build and report whether that improves the situation. The Windows nightly builds can be found here:
https://code.gnucash.org/builds/win32/maint/
Comment 7 Ben Franske 2019-02-01 11:20:43 EST
Yes, I've rolled back to 3.3 for now. Sure, I will attach a custom format but also there is a GUI method for saving a custom format which will also cause the crash to start (see my "Steps to Reproduce" in my original report).
Comment 8 Ben Franske 2019-02-01 11:23:24 EST
Created attachment 373152 [details]
Sample custom check which crashes

Requested sample custom check file which will cause the crash
Comment 9 Geert Janssens 2019-02-01 12:58:03 EST
(In reply to Ben Franske from comment #7)
> Yes, I've rolled back to 3.3 for now. Sure, I will attach a custom format
> but also there is a GUI method for saving a custom format which will also
> cause the crash to start (see my "Steps to Reproduce" in my original report).

Right. I forgot to mention that I did test this before and after my fix. I can reproduce this crash before the fix even on Fedora linux, but I don't see any crash via these steps after the fix.

So I'll wait for feedback on tomorrow's nightly build (I don't have access to a windows system to test for myself).
Comment 10 lageotakes 2019-02-01 12:59:53 EST
I rolled back to 2.6.21.  I will try nightly build this weekend
Comment 11 Mike Alexander 2019-02-01 18:41:34 EST
Check printing crashed for me last night, but works now.  I think your fix may have solved the problem, Geert.

I don't think a custom check format was required to cause this crash.  It crashed for me even after I removed all my custom formats. I suspect that removing the custom checks simply changed things enough to avoid the crash.  That's not uncommon with use-after-free bugs.  They may or may not cause a crash, apparently randomly. 

Also GnuCash seems to find custom checks in GNC_DATA_HOME/checks.  I just printed a custom check from that directory.  I've been doing that for years and I don't think anything changed to make it stop looking at that directory.
Comment 12 lageotakes 2019-02-02 16:19:13 EST
I installed gnucash-3.4-2019-02-02-git-3.4-70-g0da0f7ada+.setup.exe and it does not crash when I go to File > Print checks.

The problem is that it only shows me the built in check formats.  It is not picking up any of my custom checks in C:\Users\admin\.gnucash\checks directory.
Comment 13 Mike Alexander 2019-02-02 16:46:40 EST
I don't run GnuCash on Windows, but are you sure that is the right place?  According to my reading of 

https://wiki.gnucash.org/wiki/Configuration_Locations

the local checks directory on Windows should be %APPDATA%\GnuCash\checks where %APPDATA% is probably C:\Users\admin\AppData\Roaming for you. If that doesn't work try C:\Users\admin\AppData\Local\checks.  At any rate, I think this is a separate problem and not related to the crash that is the subject of this report.
Comment 14 lageotakes 2019-02-02 19:21:52 EST
No crashes and custom checks now show.  Thanks
Comment 15 Geert Janssens 2019-02-03 14:07:51 EST
C:\Users\admin\.gnucash\checks is the location for custom checks in gnucash 2.6 and before. The new location is what Mike suggests in comment 13.

Normally gnucash should have migrated them for you, but the first few releases in the GnuCash 3.x series failed to do so (and at the same time prevent newer releases from reattempting). That may have been why your checks are still in the old directory on your system.

Thanks for confirming the crash is gone. So with that I'll close the report.
Comment 16 Geert Janssens 2019-03-19 07:34:48 EDT
*** Bug 797128 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.