GNOME Bugzilla – Bug 627575
Stylesheet names with non-alphanumeric characters and saved-reports
Last modified: 2018-06-29 22:43:32 UTC
I have a stylesheet by the name of "Kobalt W.I.T." This name contains a space and some periods. When I open a report I can use this stylesheet correctly. However, when I save the report (or even simply leave it open and restart GnuCash), the stylesheet won't be loaded when I reopen the report in a later session. Steps to reproduce: 1. Create a stylesheet that has a space and/or period in the name (I'm not sure which character causes this bug exactly, although I suspect it's the space) 2. Open a report and use the new stylesheet 3. Leave the report open and restart GnuCash => The report will be loaded on startup, but it uses the default stylesheet now. 4. Edit the report, set the stylesheet back to the newly created one and set a different name. 5. Save the report and close it 6. Restart GnuCash and load the report from the Custom Reports menu => The report will be loaded with the default stylesheet
Came across this today while checking my Builder changes for reports. If I have a space in the title of my new stylesheet like "My One", in the saved-reports-2.4 file you end up with this.... (let ((option (gnc:lookup-option options "General" "Stylesheet"))) ((lambda (option) (if option ((gnc:option-setter option) '#{My\ One}#))) option)) and as such this does not load. If I change the title to "My-One" all works OK so it look like spaces are a problem and this is what is saved. (let ((option (gnc:lookup-option options "General" "Stylesheet"))) ((lambda (option) (if option ((gnc:option-setter option) 'My-One))) option))
Finally figured this one out: g_key_file_[gs]et_string parses the string to escape newlines and comments before writing it to the gnucash metadata file. This erroneously does some escaping in the #{symbol name}# guile extended format for symbols. Since we already strip newlines and comments ourselves, we can save and store the string without any additional parsing using g_key_file_[gs]et_value. Commit r23499 (development branch) and r23500 (2.4 branch).
Hmm, just discovered that the fix only works properly with guile 2. There seems to be a bug in guile 1.8 preventing this from working properly. I have committed a workaround in r23501 (development branch) and r23508 (2.4 branch) to deal with this.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=627575. Please update any external references or bookmarks.