GNOME Bugzilla – Bug 539654
Reports: html-table-append-column! in html-table.scm crashes
Last modified: 2018-06-29 22:06:00 UTC
Please describe the problem: The function htlm-table-append-column! crashes if a column containing more than one row is added. Steps to reproduce: 1. Add a new report using the function. 2. Open the report. 3. example for report triggering this error: https://lists.gnucash.org/pipermail/gnucash-devel/2008-April/022848.html Actual results: The report is not shown. You get an error message Expected results: Show the report Does this happen every time? Yes Other information: In /usr/share/gnucash/scm/report.scm: 451: 15* (if template (let* # # # ...) #f) 452: 16 (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...) 454: 17* [#<procedure #f #> #] In /usr/share/gnucash/guile-modules/gnucash/report/category-barchart.scm: 633: 18 [category-barchart-renderer # "Expense Over Time" # ...] In unknown file: ... ?: 19 (letrec ((show-acct? #)) (if (not #) (let* # #) ...) ...) In /usr/share/gnucash/guile-modules/gnucash/report/category-barchart.scm: 234: 20* (if (not (null? accounts)) (let* (# # # ...) (letrec # # ...)) ...) 237: 21 (let* (# # # # ...) (letrec # # # ...)) ... 533: 22 (begin # # # ...) 536: 23* (letrec ((addcol (lambda # #))) (addcol (map cadr all-data))) 547: 24 [addcol (# # # # ...)] ... 540: 25 (begin (gnc:html-table-append-column! table (car col)) (addcol (cdr col))) 541: 26* [gnc:html-table-append-column! # #] In unknown file: ?: 27 (letrec (# # #) (let* # #)) In /usr/share/gnucash/scm/html-table.scm: ... 501: 28 [gnc:html-table-set-data! # ... 503: 29* [reverse ... 503: 30* [car ... 503: 31* [append-to-element (2475.34 110.46 1343.84 ...) (# # # ...) ...] 479: 32 (if (= length-to-append 0) (cons (quote ()) newcol) ...) 481: 33 (let* (# # # # ...) (cons # #)) 486: 34* [append-to-element (110.46 1343.84 911.77 575.89 ...) (# # # # ...) 17] /usr/share/gnucash/scm/html-table.scm:486:27: In procedure append-to-element in expression (append-to-element rest-new rest-existing ...): /usr/share/gnucash/scm/html-table.scm:486:27: Wrong number of arguments to #<procedure append-to-element (newcol existing-data length-to-append width-to-make)> In /usr/share/gnucash/scm/report.scm: 451: 15* (if template (let* # # # ...) #f) 452: 16 (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...) 454: 17* [#<procedure #f #> #] In /usr/share/gnucash/guile-modules/gnucash/report/category-barchart.scm: 633: 18 [category-barchart-renderer # "Assets Over Time" # ...] In unknown file: ... ?: 19 (letrec ((show-acct? #)) (if (not #) (let* # #) ...) ...) In /usr/share/gnucash/guile-modules/gnucash/report/category-barchart.scm: 234: 20* (if (not (null? accounts)) (let* (# # # ...) (letrec # # ...)) ...) 237: 21 (let* (# # # # ...) (letrec # # # ...)) ... 533: 22 (begin # # # ...) 536: 23* (letrec ((addcol (lambda # #))) (addcol (map cadr all-data))) 547: 24 [addcol (# # # # ...)] ... 540: 25 (begin (gnc:html-table-append-column! table (car col)) (addcol (cdr col))) 541: 26* [gnc:html-table-append-column! # #] In unknown file: ?: 27 (letrec (# # #) (let* # #)) In /usr/share/gnucash/scm/html-table.scm: ... 501: 28 [gnc:html-table-set-data! # ... 503: 29* [reverse ... 503: 30* [car ... 503: 31* [append-to-element (42751.79 42628.87 46658.61 ...) (# # # ...) ...] 479: 32 (if (= length-to-append 0) (cons (quote ()) newcol) ...) 481: 33 (let* (# # # # ...) (cons # #)) 486: 34* [append-to-element (42628.87 46658.61 48242.95 ...) (# # # ...) ...] /usr/share/gnucash/scm/html-table.scm:486:27: In procedure append-to-element in expression (append-to-element rest-new rest-existing ...): /usr/share/gnucash/scm/html-table.scm:486:27: Wrong number of arguments to #<procedure append-to-element (newcol existing-data length-to-append width-to-make)>
I forgot to add my own patch which solves this problem: diff -ruBbw gnucash/scm/html-table.scm gnucash-new/scm/html-table.scm --- gnucash/scm/html-table.scm 2008-04-05 18:48:52.000000000 +0200 +++ gnucash-new/scm/html-table.scm 2008-04-05 16:08:56.000000000 +0200 @@ -484,7 +484,7 @@ (rest-new (cdr newcol)) (rest-existing (cdr existing-data)) (rest-result (append-to-element rest-new rest-existing - (- length-to-append 1)))) + (- length-to-append 1) width-to-make))) (cons (cons (widen-and-append current-existing current-new
Applied to trunk@r17255. Marked for backport to branches/2.2 for GnuCash 2.2.6. Thanks a lot for the patch! PS: Just recently I learned that some mailing lists prefer inline patches. Obviously, I do not, for at least two reasons: (1) Reading the patch I considered rejecting it right away, because I thought "width-to-make)))" was patch context instead of belonging to the wrapped "+ line". (2) Bugzilla patch attachments can be tagged as reviewed, rejected, ready-to-commit, committed and alike.
Backported to branches/2.2 in r17279 by cstim for GnuCash 2.2.6.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=539654. Please update any external references or bookmarks.