QIF Import fails out of CVS
Derek Atkins
warlord@MIT.EDU
13 Feb 2001 15:54:37 -0500
grib@gnumatic.com (Bill Gribble) writes:
> On Tue, Feb 13, 2001 at 02:54:08PM -0500, Derek Atkins wrote:
> > Whee...
>
> Save your whee until it works :)
True enough. That patch fixed the SEGV. But it's not done yet. ;)
Although there is an interesting warning message:
druid-qif-import.c: In function `gnc_ui_qif_import_comm_check_cb':
druid-qif-import.c:1542: warning: control reaches end of non-void function
I think that there might need to be a 'return TRUE' at the end of the
function.
> Our conclusion was that in guile-1.3 the function 'scm_logand'
> requires a fixnum as its "mask" argument (not documented of course,
> and not true in 1.3.4 or 1.4), and passing it a 32-bit mask 0xFFFFFFFF
> went over the limit of a fixnum. Thus the "wrong argument type".
Yah. Anyways, with this patch I get the "An error occurred while
importing QIF transactions into Gnucash." However I don't get the
SEGV. The traces are included here. The problem still appears to be
in the scm_logand() function, or at least the gh_scm2ulong() function
in gnc_helpers line 614 (I can't tell which one is actually returning
the error). The traces are included below.
Here is the guile 1.3 definition of scm_logand(). Unfortunately I
have no idea if scm_long2num is defined or not when RedHat built the
sources:
SCM
scm_logand(n1, n2)
SCM n1;
SCM n2;
{
if SCM_UNBNDP (n2)
{
if (SCM_UNBNDP (n1))
return SCM_MAKINUM (-1);
return n1;
}
#ifndef scm_long2num
return scm_long2num (scm_num2long(n1, (char *)SCM_ARG1, s_logand)
& scm_num2long(n2, (char *)SCM_ARG2, s_logand));
#else
return SCM_MAKINUM(SCM_INUM(n1) & SCM_INUM(n2));
#endif
}
Here is the new trace:
Breakpoint 1, gwrap_gnc_numeric_add (scm_param0=1082702624,
scm_param1=1082004760, scm_param2=2, scm_param3=194) at gnc.c:10817
10817 SCM_ASSERT(gnc_numeric_p(scm_param0),scm_param0,SCM_ARG1,gwrap_gnc_numeric_add_s);
(gdb) n
10818 SCM_ASSERT(gnc_numeric_p(scm_param1),scm_param1,SCM_ARG2,gwrap_gnc_numeric_add_s);
(gdb)
10819 SCM_ASSERT(gnc_gh_gint64_p(scm_param2),scm_param2,SCM_ARG3,gwrap_gnc_numeric_add_s);
(gdb)
10820 SCM_ASSERT(((scm_integer_p(scm_param3) == SCM_BOOL_T) && (scm_geq_p(scm_param3, gw__module_gw_runtime_scm_intmin) == SCM_BOOL_T) && (scm_leq_p(scm_param3, gw__module_gw_runtime_scm_intmax) == SCM_BOOL_T)),scm_param3,SCM_ARG4,gwrap_gnc_numeric_add_s);
(gdb)
10827 param0 = gnc_scm_to_numeric(scm_param0);
(gdb)
10828 param1 = gnc_scm_to_numeric(scm_param1);
(gdb) step
gnc_scm_to_numeric (gncnum=1082004760) at gnc-helpers.c:670
670 if(get_num == SCM_BOOL_F) {
(gdb) n
673 if(get_denom == SCM_BOOL_F) {
(gdb)
677 return gnc_numeric_create(gnc_scm_to_gint64(gh_call1(get_num, gncnum)),
(gdb) step
gnc_scm_to_gint64 (num=1082006832) at gnc-helpers.c:594
594 SCM magnitude = scm_abs(num);
(gdb) step
596 SCM bits16to31 = scm_ash(magnitude, SCM_MAKINUM(-16));
(gdb)
597 SCM bits32to47 = scm_ash(magnitude, SCM_MAKINUM(-32));
(gdb)
598 SCM bits48to63 = scm_ash(magnitude, SCM_MAKINUM(-48));
(gdb)
610 if (bits00to15_mask == SCM_BOOL_F) {
(gdb) n
614 c_bits00to15 = gh_scm2ulong(scm_logand(bits00to15, bits00to15_mask));
(gdb)
Backtrace:
14 (let* ((old-group #) (new-group #) (gnc-acct-hash #) ...) (for-each (lambda # #) (vector->list qif-acct-map)) ...)
15* [for-each #<procedure (qif-file)> (#<qif-file path: /home/warlord/GnuCash/Chase.qif y2k-threshold: 50 xtns: # accounts: () cats: () classes: ()>)]
16* [#<procedure (qif-file)> #<qif-file path: /home/warlord/GnuCash/Chase.qif y2k-threshold: 50 xtns: (# # # ...) accounts: () cats: () classes: ()>]
17* [for-each #<procedure (xtn)> (#<qif-xtn date: # payee: TRADER JOE'S # 0005SM2 Retail address: #f number: #f action: #f cleared: #f from-acct: Chase share-price: #f num-shares: #f security-name: #f commission: #f splits: # mark: #f> #<qif-xtn date: # payee: SPORTY'S CATALOGS Retail address: #f number: #f action: #f cleared: #f from-acct: Chase share-price: #f num-shares: #f security-name: #f commission: #f splits: # mark: #f> #<qif-xtn date: # payee: FOODMASTER #04 SI3 Retail address: #f number: #f action: #f cleared: #f from-acct: Chase share-price: #f num-shares: #f security-name: #f commission: #f splits: # mark: #f> ...)]
18* [#<procedure (xtn)> #<qif-xtn date: (28 9 2000) payee: TRADER JOE'S # 0005SM2 Retail address: #f number: #f action: #f cleared: #f from-acct: Chase share-price: #f num-shares: #f security-name: #f commission: #f splits: (#) mark: #f>]
19* (if (not (qif-xtn:mark xtn)) (begin (let # # ...)))
20 (begin (let (#) (gnc:transaction-begin-edit gnc-xtn) ...))
21 (let ((gnc-xtn #)) (gnc:transaction-begin-edit gnc-xtn) ...)
22* [qif-import:qif-xtn-to-gnc-xtn #<qif-xtn date: (28 9 2000) payee: TRADER JOE'S # 0005SM2 Retail address: #f number: #f action: #f cleared: #f from-acct: Chase share-price: #f num-shares: #f security-name: #f commission: #f splits: (#) mark: #f> #<qif-file path: /home/warlord/GnuCash/Chase.qif y2k-threshold: 50 xtns: (# # # ...) accounts: () cats: () classes: ()> ...]
23 (let ((splits #) (gnc-near-split #) (near-split-total #) ...) (apply gnc:transaction-set-date gnc-xtn ...) ...)
24* (if (not qif-security) (begin (set! near-acct-info #) (set! near-acct-name #) ...) ...)
25 (begin (set! near-acct-info (hash-ref qif-acct-map qif-from-acct)) (set! near-acct-name (qif-map-entry:gnc-name near-acct-info)) ...)
26* [for-each #<procedure (qif-split)> (#<qif-split category: class: memo: #f amount: # category-is-account?: #f matching-cleared: #f mark: #f miscx-category: #f miscx-is-account?: #f miscx-class: #f>)]
27* [#<procedure (qif-split)> #<qif-split category: class: memo: #f amount: -19.59 category-is-account?: #f matching-cleared: #f mark: #f miscx-category: #f miscx-is-account?: #f miscx-class: #f>]
28* (if (not (qif-split:mark qif-split)) (let (# # # ...) (if # #) ...))
29 (let ((gnc-far-split #) (far-acct-info #f) (far-acct-name #f) ...) (if (not split-amt) (set! split-amt #)) ...)
30* (set! near-split-total (n+ near-split-total split-amt))
31* [#<procedure (a b)> #<<gnc-numeric> num: 0 denom: 1> #<<gnc-numeric> num: 0 denom: -9223372036854775808>]
32 [gnc:numeric-add #<<gnc-numeric> num: 0 denom: 1> #<<gnc-numeric> num: 0 denom: -9223372036854775808> ...]
33* [gsubr-apply #<compiled-closure #<primitive-procedure gsubr-apply>> #<<gnc-numeric> num: 0 denom: 1> ...]
/usr/gnucash/share/gnucash/scm/qif-import/qif-to-gnc.scm:368:27: In procedure gsubr-apply in expression (gnc:numeric-add a b ...):
/usr/gnucash/share/gnucash/scm/qif-import/qif-to-gnc.scm:368:27: Wrong type argument in position 1: 9223372036854775808
> b.g.
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord@MIT.EDU PGP key available