More on Crash in QIF importer (1.6.4)

Derek Atkins warlord@MIT.EDU
05 Dec 2001 12:00:17 -0500


a gnc_numeric shouldn't ever have a denominator of zero -- this implies
that something is not initializing the gnc_numeric properly.

-derek

Steve Murphy <murf@e-tools.com> writes:

> --=-eImJBxVBPqx/K4P8q2O/
> Content-Type: text/plain
> Content-Transfer-Encoding: quoted-printable
> 
> 
> OK, I got a little obsessed on that crash I reported yesterday.
> 
> So, I tried a few things.
> 
> One: if I don't make any changes to the commodity entries when I import,
> no crash.
> 
> Two: If I only change the stock exchange from NYSE to NASDAQ, no crash.
> 
> Three: If I change the 3rd entry (the ticker code) THEN I crash.=20
> 
> Also, in trying to figure out why, I came across this code:
> 
> src/engine/gnc-numeric.c:
> 
> 
> double
> gnc_numeric_to_double(gnc_numeric in) {
>   if(in.denom >=3D 0) {
>     return (double)in.num/(double)in.denom;
>   }
>   else {
>     return (double)(in.num * in.denom);
>   }
> }
> 
> Now, if the in.denom is zero, do you REALLY and to divide by it? I
> advise changing the test if(in.denom >=3D 0) to be if(in.denom > 0), or
> restructuring the code. What are the semantics of the
> numerator/denominator pair?
> 
> I changed this, but I still crash. I think the balance of 17/0 is what's
> the problem. Why it's 17/0 when I change a ticker code, I have no idea.
> What it is if I DON'T change the fields, I don't know.
> 
> I haven't noticed any response to the crash report... is a tree falling,
> alone, in the forest?
> 
> murf
> 
> 
> --=-eImJBxVBPqx/K4P8q2O/
> Content-Type: application/pgp-signature; name=signature.asc
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
> 
> iD8DBQA8Dkp96/5EwE4UaOQRAhGsAJ40IwBwm0GAfjNB1FTiZfK4qkZwQgCcDouQ
> tf9EGxiZr+eAZ5wE/SfMJ7E=
> =Zppw
> -----END PGP SIGNATURE-----
> 
> --=-eImJBxVBPqx/K4P8q2O/--
> 
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel@lists.gnumatic.com
> http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel

-- 
       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