unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use recursive schema lookup
@ 2023-01-05  1:58 Tad Fisher
  2023-01-07  9:12 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Tad Fisher @ 2023-01-05  1:58 UTC (permalink / raw)
  To: 60565

[-- Attachment #1: 0001-src-pgtkfns.c-parse_resource_key-Use-recursive-schem.patch --]
[-- Type: text/x-patch, Size: 1963 bytes --]

From 8e2cf80593dd78030929f96f0f1a3e1a325428a4 Mon Sep 17 00:00:00 2001
From: Tad Fisher <tadfisher@gmail.com>
Date: Wed, 4 Jan 2023 13:40:17 -0800
Subject: [PATCH] ; * 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.

Copyright-paperwork-exempt: yes
---
 src/pgtkfns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 6b3a0459d36..6e5bb22375a 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -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))
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-08 11:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05  1:58 bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use recursive schema lookup Tad Fisher
2023-01-07  9:12 ` Eli Zaretskii
2023-01-07 11:04   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-07 11:11     ` Eli Zaretskii
2023-01-08  1:14       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08 11:49         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).