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 131201 - txf export crashes GnuCash during file write
txf export crashes GnuCash during file write
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Reports
1.8.x
Other Linux
: Normal normal
: ---
Assigned To: Derek Atkins
Derek Atkins
Depends on:
Blocks:
 
 
Reported: 2004-01-12 05:21 UTC by Curt Engelbrecht
Modified: 2018-06-29 20:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (836 bytes, patch)
2004-05-17 15:08 UTC, Derek Atkins
none Details | Review
Something to test with (1.77 KB, patch)
2004-05-17 17:23 UTC, Derek Atkins
none Details | Review
Another test patch (1.77 KB, patch)
2004-05-17 17:44 UTC, Derek Atkins
none Details | Review

Description Curt Engelbrecht 2004-01-12 05:21:45 UTC
I've been trying to build an txf export file of my 2003 tax records. I  
was using 1.8.5 on RH9 and KDE3.1. During the write of the txf file,  
(progress bar showing ~80-90%) gnucash would just disappear.  I  
installed the RH9 rpm from people.redhat.com/notting/gnucash/ and get  
the same behavior. I am able to export the html tax report.  
 
************** 
Backtrace: 
In unknown file: 
   ?:  8* [list ... 
   ?:  9*  [#<procedure #f (x)> #<gw:wcp <gnc:Account*> 0x83004b8>] 
In /usr/share/gnucash/guile-modules/gnucash/report/taxtxf.scm: 
 731: 10   [handle-level-x-account 1 #<gw:wcp <gnc:Account*> 0x83004b8>] 
     ... 
 623: 11   (let* (# # # ...) (set! account-balance #) ...) 
 627: 12*  (if (not children) (let (#) (if splits-period # ...)) ...) 
 642: 13   [map #<procedure #f (x)> (# # # # ...)] 
In unknown file: 
     ... 
   ?: 14   (begin (set-cdr! p (list (f #))) (lp (cdr ls) (cdr p))) 
   ?: 15*  [set-cdr! (("" "")) ... 
   ?: 16*   [list ... 
   ?: 17*    [#<procedure #f (x)> #<gw:wcp <gnc:Account*> 0x82f3588>] 
In /usr/share/gnucash/guile-modules/gnucash/report/taxtxf.scm: 
 643: 18     (if (>= max-level #) (handle-level-x-account # x) (quote  
())) 
       ... 
 677: 19     (let (#) (if # #) (if # #) ...) 
 678: 20*    (if tax-mode? (render-level-x-account table level ...) ...) 
 683: 21     [list ... 
 684: 22*     (if # # #) 
 685: 23      [render-txf-account # # #f ...] 
        ... 
 280: 24      (let* (# # # # ...) (list # crlf # ...)) 
 297: 25*     (if (eq? type #) (case # # #) Expense) 
 298: 26      (case (string->symbol code) ((N286 N488) ReinvD) (else  
Income)) 
 298: 27*     [string->symbol N506] 
 
/usr/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:298:34: In  
procedure string->symbol in expression (string->symbol code): 
/usr/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:298:34: Wrong  
type argument in position 1 (expecting STRINGP): N506 
**************
Comment 1 Curt Engelbrecht 2004-01-12 05:24:06 UTC
In a reply to my note on the gnucash-users maillist: 
On Sunday 11 January 2004 06:50 pm, Derek Atkins wrote: 
> Hi, 
> 
> This looks like a bug in the report, probably due to differences 
> between guile-1.4 and guile-1.6.  Can you please file a bug report 
> at bugzilla.gnome.org and supply this crash-dump? 
> 
> Thanks, 
> 
> -derek 
 
Thanks, Curt 
curtengelbrecht@cox.net 
Comment 2 Benji Fisher 2004-05-16 17:02:19 UTC
The problem is still there in GnuCash 1.8.9 on Red Hat 9 (compiled from source).
 My backtrace looks a little different:

Backtrace:
In unknown file:
   ?:  0* [#<procedure #f #> # txf /home/benji/temp/Quicken/May04]
In /usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:
 823:  1* [generate-tax-or-txf Taxable Income / Deductible Expenses ...]
In unknown file:
   ?:  2  (letrec (# #) (gnc:report-starting reportname) (let* # #))
In /usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:
    ...
 729:  3  (let* (# # #) (gnc:display-report-list-item output-txf port ...) ...)
 731:  4* [map #<procedure #f (x)> (# # # # ...)]
In unknown file:
   ?:  5  (if (null? rest) (map1 f list1) ...)
    ...
   ?:  6  (begin (set-cdr! p (list (f #))) (lp (cdr ls) (cdr p)))
   ?:  7* [set-cdr! (("" "")) ...
   ?:  8*  [list ...
   ?:  9*   [#<procedure #f (x)> #<gw:wcp <gnc:Account*> 0x82e5628>]
In /usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:
 731: 10    [handle-level-x-account 1 #<gw:wcp <gnc:Account*> 0x82e5628>]
      ...
 677: 11    (let (#) (if # #) (if # #) ...)
 678: 12*   (if tax-mode? (render-level-x-account table level ...) ...)
 683: 13    [list ...
 684: 14*    (if # # #)
 685: 15     [render-txf-account # # #f ...]
       ...
 280: 16     (let* (# # # # ...) (list # crlf # ...))
 297: 17*    (if (eq? type #) (case # # #) Expense)
 298: 18     (case (string->symbol code) ((N286 N488) ReinvD) (else Income))
 298: 19*    [string->symbol N460]
 
/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:298:34: In
procedure string->symbol in expression (string->symbol code):
/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:298:34: Wrong
type argument in position 1 (expecting STRINGP): N460
Comment 3 Derek Atkins 2004-05-17 15:06:37 UTC
I'll take ownership.
Comment 4 Derek Atkins 2004-05-17 15:08:53 UTC
Created attachment 27777 [details] [review]
Proposed patch

Can you try the attached patch and see if it solves your problem?  If it does,
I'll commit it to the repository.

Thanks.
Comment 5 Benji Fisher 2004-05-17 16:40:13 UTC
Thanks for taking charge of this.  Unfortunately, the proposed patch does not
seem to work.  Here is the part of the backtrace that looks different:

 684: 14*    (if # # #)
 685: 15     [render-txf-account # # #f ...]
       ...
 325: 16     [list TD    N460    C1    L 1 ... ...
 338: 17*     (if x? (list X x-date-str ...) ...)
 339: 18      [list X 01/01/2004   ...
 339: 19*      [fill-clamp-sp #f 31]
 249: 20       [string-append ...
 249: 21*       [substring ...
 249: 22*        [string-append #f                                ]
 
/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:249:29: In
procedure string-append in expression (string-append str (make-string len
#\space)):/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:249:29:
Wrong type argument (expecting STRINGP): #f
Comment 6 Derek Atkins 2004-05-17 16:54:13 UTC
Hmm, this shouldn't ever be able to happen -- it implies you have an account
with no account name!  That just shouldn't be able to happen.  

Question: do you happen to have any Scheduled Transactions in your data file?
If so, what happens if you remove all of them and then re-run this report?
Comment 7 Benji Fisher 2004-05-17 17:04:57 UTC
     I am a complete newbie to GnuCash.  I ran into this bug because I was
testing TXF exports:  that is one thing that has to work before I can switch
from Quicken to GC.  So I am not sure how to find out if I do have an account
with no name.  So far, all the information in my data file comes from the
initial import from my QIF file (and some time spent with the Edit->Tax options
dialogue to assign tax categories to my accounts).

     I do not seem to have any scheduled transactions:  when I select
Actions->Scheduled Transactions->Scheduled Transaction Editor,
the table at the top of the window (with headings Name, Frequency, Next
Occurrence) is empty.
Comment 8 Derek Atkins 2004-05-17 17:23:34 UTC
Created attachment 27786 [details] [review]
Something to test with

Ok, can you run with this patch, too?  This should apply to your existing tree
(with the previous patch applied).  This should "solve" the crash, but it
should also output some extra information (in particular some account GUIDs).. 
Then we can look in your data file for those accounts and see what's up.
Comment 9 Benji Fisher 2004-05-17 17:41:17 UTC
OK, both patches applied; make; sudo make install; start up GC; here is the end
of the bactrace:

 745: 10    [handle-level-x-account 1 #<gw:wcp <gnc:Account*> 0x82e95c8>]
      ...
 637: 11    (let* (# # # ...) (set! account-balance #) ...)
 641: 12*   (if (not children) (let (#) (if splits-period # ...)) ...)
 656: 13    [map #<procedure #f (x)> (# # # # ...)]
In unknown file:
      ...
   ?: 14    (let ((ret (list #))) (letrec ((lp #)) (lp (cdr ls) ret)))
   ?: 15*   [list ...
   ?: 16*    [#<procedure #f (x)> #<gw:wcp <gnc:Account*> 0x82eadb8>]
In /usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:
 657: 17     (if (>= max-level #) (handle-level-x-account # x) (quote ()))
       ...
 691: 18     (let (#) (if # #) (if # #) ...)
 692: 19*    (if tax-mode? (render-level-x-account table level ...) ...)
 697: 20     [list ...
 698: 21*     (if # # #)
 699: 22      [render-txf-account # # #f ...]
        ...
 280: 23      (let* (# # # # ...) (list # crlf # ...))
 292: 24*     (let* ((named-acct #) (name #)) (if name name (begin #) ...))
In unknown file:
   ?: 25*     [if (if name name # ...) (# # # # ...)]
 
/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:292:30: In
procedure if in expression (let* (# #) (if name name ...)):
/usr/local/share/gnucash/guile-modules/gnucash/report/taxtxf.scm:292:30: missing
or extra expression
Comment 10 Derek Atkins 2004-05-17 17:44:42 UTC
Created attachment 27790 [details] [review]
Another test patch

Ok, try this one instead of the last one.  Sorry about that.
Comment 11 Benji Fisher 2004-05-17 18:10:53 UTC
OK, reverse the second patch and apply the third; make; sudo make install; try
again.  I get six copies of the line

Failed to get name for account: 00000000000000000000000000000000 which is the
parent of 395f3b9c6af4a7c3a59e533d5d0bc296

I opened the data file in vim and searched for 395f.  Here is the entry for that
account; the first and last lines are not indented:

<gnc:account version="2.0.0">
  <act:name>Salary</act:name>
  <act:id type="guid">395f3b9c6af4a7c3a59e533d5d0bc296</act:id>
  <act:type>INCOME</act:type>
  <act:commodity>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>USD</cmdty:id>
  </act:commodity>
  <act:commodity-scu>100</act:commodity-scu>
  <act:slots>
    <slot>
      <slot:key>placeholder</slot:key>
      <slot:value type="string">false</slot:value>
    </slot>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"></slot:value>
    </slot>
    <slot>
      <slot:key>tax-related</slot:key>
      <slot:value type="integer">1</slot:value>
    </slot>
    <slot>
      <slot:key>tax-US</slot:key>
      <slot:value type="frame">
        <slot>
          <slot:key>code</slot:key>
          <slot:value type="string">N460</slot:value>
        </slot>
        <slot>
          <slot:key>payer-name-source</slot:key>
          <slot:value type="string">parent</slot:value>
        </slot>
      </slot:value>
    </slot>
  </act:slots>
</gnc:account>
Comment 12 Derek Atkins 2004-05-17 18:14:54 UTC
Uhh.. Ok, your problem is that you have a top-level income account (Salary) that
you have configured to look for its parent as the payer name source.  As it's a
top-level account, it has no parent, hense the failure.  You should fix your
account hierarchy.

As this now fixes your crash, I'll commit a cleaned-up version of this patch.

Thanks.
Comment 13 Derek Atkins 2004-05-17 18:55:40 UTC
Ok, this is now fixed in CVS.
Comment 14 John Ralls 2018-06-29 20:40:13 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=131201. Please update any external references or bookmarks.