Wrong Import date format selection crashes Gnucash
jralls at ceridwen.us
Sun Dec 11 15:20:48 EST 2016
> On Dec 11, 2016, at 11:32 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> #15 0x00007ffff6c2431f in gnc_dmy2timespec_neutral (day=day at entry=2016,
> month=month at entry=12, year=year at entry=2001)
The problem seems pretty obvious...
> at gnc-date.cpp:1251
> ---Type <return> to continue, or q <return> to quit---
> #16 0x00007fffe038564d in parse_date_with_year (format=<optimized out>,
> date_str=0x11f1220 "2016/12/01") at gnc-csv-model.c:212
> #17 parse_date (date_str=0x11f1220 "2016/12/01", format=1) at
Here you're telling parse_date_with_year to use "d-m-y" with a y-m-d format, and so passing an invalid day to gnc_dmy2rimespec_neutral.
I suspect that this is what led Geert to ask about invalid date values a few weeks ago. We don't want exceptions to leak out of C++ modules, so gnc_dmy2timespec_neutral (and every other call to a constructor in gnu-date.cpp) should be inside a try-catch block and catch should return an invalid result; callers should test for that result. C++ code should use GncDateTime directly and handle the exception.
Aaron, are you still working on replacing Timespec with time64?
More information about the gnucash-devel