Apparently qof-book-get-option must not segfault ever. The following config-user.scm will illustrate segfault: --- (format #t "hello from config-user.scm\n") (let ((book (gnc-get-current-book))) (qof-book-set-option book "bla" '("top" "lvl1")) (qof-book-set-option book "arg" '("top" "lvl2")) ;; the following works: (format #t "retrieve top/lvl1: ~a\n" (qof-book-get-option book '("top" "lvl1"))) ;; the following segfaults (format #t "retrieve top: ~a\n" (qof-book-get-option book '("top")))) --- Output: hello from config-user.scm retrieve top/lvl1: bla ./run.sh: line 3: 23556 Segmentation fault (core dumped) ./bin/gnucash --- Expected Output: hello from config-user.scm retrieve top/lvl1: bla retrieve top: ("bla" "arg") Rationale: qof-book-get-option book leaf-path is successfully retrieving the leaf contents, however qof-book-get-option book non-leaf-path is segfaulting. --- Here's output from gdb hello from config-user.scm retrieve top/lvl1: bla Thread 1 "gnucash" received signal SIGSEGV, Segmentation fault. 0x00007ffff6ff1189 in SWIG_Guile_NewPointerObj () from /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-engine.so --- Here's backtrace from gdb #0 0x00007ffff6ff1189 in SWIG_Guile_NewPointerObj () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-engine.so #1 0x00007ffff6ff29d7 in gnc_kvp_value_ptr_to_scm () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-engine.so #2 0x00007ffff7083460 in _wrap_qof_book_get_option () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-engine.so #3 0x00007ffff7dfff2f in () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #4 0x00007ffff7e0577f in scm_call_n () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #5 0x00007ffff7d874ff in scm_call_3 () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #6 0x00007ffff7dfff2f in () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #7 0x00007ffff7e0577f in scm_call_n () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #8 0x00007ffff7d874b8 in scm_call_1 () at /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1 #9 0x00007ffff717fbde in gfec_eval_string () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-app-utils.so #10 0x00007ffff717fd20 in gfec_eval_file () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-app-utils.so #11 0x00007ffff717ff3d in gfec_try_load () at /home/chris/sources/gnucash/build/lib/gnucash/libgncmod-app-utils.so #12 0x000055555555a760 in load_user_config () #13 0x000055555555ae6d in inner_main () Is this a bug?
Yes, and probably in SWIG. It wouldn't work as you expect even if SWIG_guile_NewPointerObj didn't choke on the KvpFrame*. There's nothing to convert a KvpFrame into a Scheme representation of its contents.