#1024136 gnucash: fails to load preferences if ~/.local/share/glib-2.0/schemas/gschemas.compiled exists

Package:
gnucash
Source:
gnucash
Description:
personal and small-business financial-accounting software
Submitter:
scar
Date:
2023-03-22 11:09:09 UTC
Severity:
normal
Tags:
#1024136#5
Date:
2022-11-15 10:50:02 UTC
From:
To:
Dear Maintainer,

I'm having the same problem reported here,
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1963766

except I was using GnuCash 4.11.  Upgraded to 4.12 and the problem persisted.

I was able to track that down because I was seeing the same messages in /tmp/gnucash.trace.

Unfortunately, however, unlike the OP, /usr/local/share/glib-2.0 doesn't even exist on my system, nor does redefining XDG_DATA_DIRS with /usr/share in front of /usr/local/share resolve the situation.

Instead, it seems to be caused by the creation of ~/.local/share/glib-2.0/schemas/gschemas.compiled, which happened today when I installed https://github.com/maoschanz/gedit-plugin-markdown_preview using its install.sh script.  ~/.local/share isn't defined in XDG_DATA_DIRS, nor does adding it to the front resolve the situation.

Renaming the file to gschemas.compiled.disabled, for example, does resolve the problem with GnuCash preferences, but then gedit throws GLib-GIO-ERROR and won't start.  Uninstalling gedit-plugin-markdown_preview with its uninstall.sh script also resolves the situation, but then I obviously don't have that plugin anymore.  It was nice to have but I can do without it for now (plus install/uninstall is really quick if I do need it).

I don't think it's a problem with gedit-plugin-markdown_preview, though.  Not clear it's a problem with gnucash, either.  Maybe it's a problem with whatever gschemas.compiled is part of, that would be GLib?  This is a new area for me, I've never dealt with schemas before and it's already taken me several hours just to get to this point.

Would appreciate any feedback or insights that can be provided.  Thanks in advance!

#1024136#10
Date:
2022-11-21 07:09:20 UTC
From:
To:
The GnuCash schemas are in /usr/share/glib-2.0/schemas along with a bunch of other app's schemas.  Other apps don't seem to have an issue when I have the gedit-plugin-markdown_preview installed.

Take, for example, Yelp, the GNOME help viewer, which has a /usr/share/glib-2.0/schemas/org.gnome.yelp.gschema.xml.  It loads up fine when gedit-plugin-markdown_preview is installed and ~/.local/share/glib-2.0/schemas/gschemas.compiled exists.

1️⃣ If I remove /usr/share/glib-2.0/schemas/gschemas.compiled, then Yelp throws a GLib-GIO-ERROR and won't start.  but GnuCash still starts, just doesn't load any preferences.

2️⃣ If I copy /usr/share/glib-2.0/schemas/org.gnome.yelp.gschema.xml to ~/.local/share/glib-2.0/schemas/ and recompile the schemas, Yelp will start up again.

3️⃣ If I remove ~/.local/share/glib-2.0/schemas/gschemas.compiled, then Yelp throws a GLib-GIO-ERROR again, while GnuCash still starts, just doesn't load any preferences (since /usr/share/glib-2.0/schemas/gschemas.compiled is still missing).

4️⃣ Finally, when I restore /usr/share/glib-2.0/schemas/gschemas.compiled, GnuCash starts as expected, loading my last book and preferences.  However, gedit fails to start (since ~/.local/share/glib-2.0/schemas/gschemas.compiled is still missing).

🔄 As a workaround, I can link /usr/share/glib-2.0/schemas/org.gnucash.GnuCash.* to ~/.local/share/glib-2.0/schemas and recompile the schemas.  Then everything plays nice together.

It shows that Yelp can look in both ~/.local/share/glib-2.0/schemas and /usr/share/glib-2.0/schemas without any problem, but if GnuCash looks in ~/.local/share/glib-2.0/schemas and can't find what it's looking for, it just fails.

I guess it is a bug in GnuCash then?  Is it something I should report upstream or do you do that?

Thanks


1️⃣
$ cd /usr/share/glib-2.0/schemas/
$ sudo mv gschemas.compiled gschemas.compiled.bak
$ yelp
(yelp:1191114): GLib-GIO-ERROR **: 22:53:41.766: Settings schema 'org.gnome.yelp' is not installed
Trace/breakpoint trap
$ gnucash
Found Finance::Quote version 1.52.
<Starts but doesn't load/save any preferences>

2️⃣
$ cd ~/.local/share/glib-2.0/schemas
$ cp /usr/share/glib-2.0/schemas/org.gnome.yelp.gschema.xml .
$ glib-compile-schemas ~/.local/share/glib-2.0/schemas
$ yelp
<Loads up normally>

3️⃣
$ rm ~/.local/share/glib-2.0/schemas/gschemas.compiled
$ yelp
(yelp:1191114): GLib-GIO-ERROR **: 22:53:41.766: Settings schema 'org.gnome.yelp' is not installed
Trace/breakpoint trap
$ gnucash
Found Finance::Quote version 1.52.
<Starts but doesn't load/save any preferences>

4️⃣
$ cd /usr/share/glib-2.0/schemas/
$ sudo mv gschemas.compiled.bak gschemas.compiled
$ gnucash
Found Finance::Quote version 1.52.
<Loads properly with all preferences>
<Close GnuCash>
$ gedit
(gedit:1199252): GLib-GIO-ERROR **: 22:59:02.802: Settings schema 'org.gnome.gedit.plugins.markdown_preview' is not installed
Trace/breakpoint trap

🔄
$ cd ~/.local/share/glib-2.0/schemas
$ ln -s /usr/share/glib-2.0/schemas/org.gnucash.GnuCash.* .
$ glib-compile-schemas .
$ gedit
<Loads up properly>
<Close gedit>
$ gnucash
Found Finance::Quote version 1.52.
<Loads properly with all preferences>

#1024136#15
Date:
2022-11-29 17:28:06 UTC
From:
To:
We found the problem upstream!

See [1] <#1>, especially Comments 5-7[2] <#2>, and the patch[3] <#3>.


1. https://bugs.gnucash.org/show_bug.cgi?id=798672

2. https://bugs.gnucash.org/show_bug.cgi?id=798672#c5

3. https://github.com/Gnucash/gnucash/commit/98251d59a6e6940efae2001a1e619c08828c8738