1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-01 21:30:54 -08:00

; * src/pgtkfns.c (parse_resource_key): Use recursive schema lookup

XDG_DATA_DIRS may consist of multiple directories, and
g_settings_schema_source_get_default composes these into a recursive
schema source. One must pass TRUE to g_settings_schema_source_lookup,
otherwise only the first directory in XDG_DATA_DIRS is searched.

It follows that in the case that the directory containing the compiled
GSettings schema for Emacs is not the first in XDG_DATA_DIRS,
parse_resource_key will not accept any resource key, which causes
pgtk_get_defaults_value and pgtk_set_defaults_value to fail.

This impacts systems that compose multiple GSettings schema sources
via XDG_DATA_DIRS, such Flatpak and NixOS.

Supporting GIO documentation for g_settings_schema_source_get_default:

> The returned source may actually consist of multiple schema sources
> from different directories, depending on which directories were given
> in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
> lookups performed against the default source should probably be done
> recursively.

Bug#60565

Copyright-paperwork-exempt: yes
This commit is contained in:
Tad Fisher 2023-01-04 13:40:17 -08:00 committed by Eli Zaretskii
parent da96a1fd74
commit 1469aac20d

View file

@ -1902,7 +1902,7 @@ parse_resource_key (const char *res_key, char *setting_key)
/* check existence of setting_key */
GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default ();
GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, FALSE);
GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, TRUE);
if (!scm)
return NULL; /* *.schema.xml is not installed. */
if (!g_settings_schema_has_key (scm, setting_key))