GNOME Bugzilla – Bug 582325
Crash when setting Fancy Date format
Last modified: 2018-06-29 22:21:33 UTC
Steps to reproduce: 1. Open a GnuCash book or create a new one 2. Goto File->Preferences 3. Choose a fancy date format (eg Europe) 4. Click Apply or Ok Stack trace: Backtrace: In unknown file: ?: 0* [apply-cb] In /usr/share/gnucash/guile-modules/gnucash/gnome-utils.scm: 29: 1* [gnc:options-scm->kvp #<procedure dispatch #> # # ...] In /usr/share/gnucash/scm/options.scm: 1477: 2 [scm->kvp #<swig-pointer KvpFrame * 83c17d8> ("options")] In unknown file: ... ?: 3 [hash-for-each #<procedure #f (section hash)> #(() () (#) () ...)] In /usr/share/slib/hashtab.scm: 120: 4 (do ((i (+ -1 #) (+ -1 i))) ((negative? i)) ...) 122: 5* [alist-for-each #<procedure #f (section hash)> (("Business" . #))] In /usr/share/slib/alist.scm: 117: 6 [for-each #<procedure #f (pair)> (("Business" . #(# # # ...)))] In unknown file: ?: 7* [#<procedure #f (pair)> ("Business" . #((#) (#) (#) ...))] In /usr/share/slib/alist.scm: 117: 8* [#<procedure #f (section hash)> "Business" #((#) (#) (#) () ...)] In /usr/share/gnucash/scm/options.scm: 1303: 9 [section-for-each #((#) (#) (#) () ...) #<procedure #f (option)>] In unknown file: ... ?: 10 [hash-for-each #<procedure #f (name option)> #((#) (#) (#) () ...)] In /usr/share/slib/hashtab.scm: 120: 11 (do ((i (+ -1 #) (+ -1 i))) ((negative? i)) ...) 122: 12* [alist-for-each #<procedure #f (name option)> (("Fancy Date Format" . #))] In /usr/share/slib/alist.scm: 117: 13 [for-each #<procedure #f (pair)> (("Fancy Date Format" . #))] In unknown file: ?: 14* [#<procedure #f (pair)> ("Fancy Date Format" . #)] In /usr/share/slib/alist.scm: 117: 15* [#<procedure #f #> "Fancy Date Format" #] In /usr/share/gnucash/scm/options.scm: 1299: 16 [#<procedure #f (option)> #("Business" "Fancy Date Format" "g" ...)] ... 1363: 17 [#<procedure #f #> # #] 1217: 18* [kvp-frame-set-slot-path-gslist # "ce" #] /usr/share/gnucash/scm/options.scm:1217:8: In procedure kvp-frame-set-slot-path-gslist in expression (kvp-frame-set-slot-path-gslist f (symbol->string #) ...): /usr/share/gnucash/scm/options.scm:1217:8: SCM_STRING_CHARS does not work with read-only strings. Other information: This happens on Mandriva 2009.1, which ships GnuCash 2.2.9.
I just tried this on Ubuntu 9.04 with GnuCash 2.2.9 with no problems. Can you reproduce this? What is the contents of /tmp/gnucash.trace?
Yes, I can consistently reproduce this. Here's the contents of ~/tmp/gnucash.trace: * 10:07:04 WARN <gnc.app-util> /home/janssege/.gnucash/config-2.0.auto:10:15: While evaluating arguments to gnc:lookup-option in expression (gnc:lookup-option gnc:*options-entries* "Business" ...): /home/janssege/.gnucash/config-2.0.auto:10:15: Unbound variable: gnc:*options-entries* In /home/janssege/.gnucash/config-2.0.auto: 10: 0* (let* ((option #)) ((lambda # #) option)) 10: 1* [gnc:lookup-option ... * 10:07:15 CRIT <gnc.report.gui> gnc_plugin_page_report_name_changed: assertion `count++ <= max_count' failed * 10:07:15 CRIT <gnc.report.gui> gnc_plugin_page_report_name_changed: assertion `count++ <= max_count' failed
Same problem on Arch linux, build version 2.2.9, the program crashes if you try to change the date format to something other than "locale". /tmp/gnucash.trace is empty. If program is started from console, then the following is printed: sardar ~ $ gnucash gnc.bin-Message: main: binreloc relocation support was disabled at configure time. Backtrace: In unknown file: ?: 0* [apply-cb] In /usr/share/gnucash/guile-modules/gnucash/gnome-utils.scm: 29: 1* [gnc:options-scm->kvp #<procedure dispatch #> # # ...] In /usr/share/gnucash/scm/options.scm: 1477: 2 [scm->kvp #<swig-pointer KvpFrame * 9d97930> ("options")] In unknown file: ... ?: 3 [hash-for-each #<procedure #f (section hash)> #(() () (#) () ...)] In /usr/share/guile/site/slib/hashtab.scm: 120: 4 (do ((i (+ -1 #) (+ -1 i))) ((negative? i)) ...) 122: 5* [alist-for-each #<procedure #f (section hash)> (("Business" . #))] In /usr/share/guile/site/slib/alist.scm: 117: 6 [for-each #<procedure #f (pair)> (("Business" . #(# # # ...)))] In unknown file: ?: 7* [#<procedure #f (pair)> ("Business" . #((#) (#) (#) ...))] In /usr/share/guile/site/slib/alist.scm: 117: 8* [#<procedure #f (section hash)> "Business" #((#) (#) (#) () ...)] In /usr/share/gnucash/scm/options.scm: 1303: 9 [section-for-each #((#) (#) (#) () ...) #<procedure #f (option)>] In unknown file: ... ?: 10 [hash-for-each #<procedure #f (name option)> #((#) (#) (#) () ...)] In /usr/share/guile/site/slib/hashtab.scm: 120: 11 (do ((i (+ -1 #) (+ -1 i))) ((negative? i)) ...) 122: 12* [alist-for-each #<procedure #f (name option)> (("Fancy Date Format" . #))] In /usr/share/guile/site/slib/alist.scm: 117: 13 [for-each #<procedure #f (pair)> (("Fancy Date Format" . #))] In unknown file: ?: 14* [#<procedure #f (pair)> ("Fancy Date Format" . #)] In /usr/share/guile/site/slib/alist.scm: 117: 15* [#<procedure #f #> "Fancy Date Format" #] In /usr/share/gnucash/scm/options.scm: 1299: 16 [#<procedure #f (option)> #("Business" "Fancy Date Format" "g" ...)] ... 1363: 17 [#<procedure #f #> # #] 1217: 18* [kvp-frame-set-slot-path-gslist # "ce" #] /usr/share/gnucash/scm/options.scm:1217:8: In procedure kvp-frame-set-slot-path-gslist in expression (kvp-frame-set-slot-path-gslist f (symbol->string #) ...): /usr/share/gnucash/scm/options.scm:1217:8: SCM_STRING_CHARS does not work with read-only strings. sardar ~ $
Same problem on Fedora 11 with Gnucash 2.2.9 installed using yum and 2.3.8 compiled from source. Cannot change any details in the Properties dialog. No crashes when using 2.2.5 installed using yum or 2.3.8 installed from source on Fedora 8. All dependencies for both systems were installed using yum. Seems to point to a dependency issue rather than Gnucash itself. ?
I did some further debugging. My conclusion is that this is caused by guile >= 1.8.6 Here's why: * The console log error is "SCM_STRING_CHARS does not work with read-only strings." I dug into the guile source code. This check has been added somewhere in 2004, so way before Fedora 8. So this code was already there in guile 1.8.5. * guile 1.8.5 was released on 2008-05-07 (see http://www.gnu.org/software/guile/news.html). * On 22 Sep 2008 (so after guile release 1.8.5 and before guile release 1.8.6) a patch is committed to the guile code base titled : "Make `symbol->string' return a read-only string." (see http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=fd2b17b9cb7aaa6b550ad9b6a3efe3c53c94ccce) * The symbol->string function is called to get the string parameter for kvp-frame-set-slot-path-gslist in options.scm. So kvp-fram-set-slot-path-gslist gets a read-only string parameter. Sometime later SCM_STRING_CHARS is called on this read-only string which is no longer allowed. Unfortunately, I don't know enough about the guile integration in gnucash to easily find out where this code leads to. A search on SCM_STRING_CHARS in the source reveals that it is used 65 times. I don't know which one is causing a problem. Note that SCM_STRING_CHARS is deprecated since guile 1.8.0, and should be replaced with replaced with (from /usr/include/libguile/strings.h:) Internal, low level interface to the character arrays - Use scm_i_string_chars to get a pointer to the byte array of a string for reading. Use scm_i_string_length to get the number of bytes in that array. The array is not null-terminated. - The array is valid as long as the corresponding SCM object is protected but only until the next SCM_TICK. During such a 'safe point', strings might change their representation. - Use scm_i_string_writable_chars to get the same pointer as with scm_i_string_chars, but for reading and writing. This is a potentially costly operation since it implements the copy-on-write behavior. When done with the writing, call scm_i_string_stop_writing. You must do this before the next SCM_TICK. (This means, before calling almost any other scm_ function and you can't allow throws, of course.)
By the way, I tried to figure out the version of guile in Ubuntu 9.04. As far as I can tell, it ships 1.8.5, which would explain why Phil couldn't reproduce.
My Fedora 8 install has guile-1.8.5-1.fc8
Thanks Mike for reporting this. It confirms my suspicion. By the way, the quote I included in comment 5 suggests the wrong replacements. These are internal functions. Instead, SCM_STRING_CHARS should be replaced with scm_to_locale_string. I have committed some changes to svn (r18541) that should fix this issue.
I can confirm that it works on Fedora 11. Many thanks Geert.
*** Bug 602041 has been marked as a duplicate of this bug. ***
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=582325. Please update any external references or bookmarks.