GNU bug report logs - #60565
[PATCH] src/pgtkfns.c (parse_resource_key): Use recursive schema lookup

Previous Next

Package: emacs;

Reported by: Tad Fisher <tadfisher <at> gmail.com>

Date: Thu, 5 Jan 2023 01:59:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60565 in the body.
You can then email your comments to 60565 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60565; Package emacs. (Thu, 05 Jan 2023 01:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tad Fisher <tadfisher <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 05 Jan 2023 01:59:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tad Fisher <tadfisher <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] src/pgtkfns.c (parse_resource_key): Use recursive schema
 lookup
Date: Thu, 5 Jan 2023 01:58:47 +0000
[0001-src-pgtkfns.c-parse_resource_key-Use-recursive-schem.patch (text/x-patch, attachment)]
From 8e2cf80593dd78030929f96f0f1a3e1a325428a4 Mon Sep 17 00:00:00 2001
From: Tad Fisher <tadfisher <at> 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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60565; Package emacs. (Sat, 07 Jan 2023 09:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 60565 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tad Fisher <tadfisher <at> gmail.com>, Po Lu <luangruo <at> yahoo.com>
Cc: 60565 <at> debbugs.gnu.org
Subject: Re: bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use
 recursive schema lookup
Date: Sat, 07 Jan 2023 11:12:29 +0200
> From: Tad Fisher <tadfisher <at> gmail.com>
> Date: Thu, 5 Jan 2023 01:58:47 +0000
> 
> 
> From 8e2cf80593dd78030929f96f0f1a3e1a325428a4 Mon Sep 17 00:00:00 2001
> From: Tad Fisher <tadfisher <at> 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.

Thanks.  Po Lu, any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60565; Package emacs. (Sat, 07 Jan 2023 11:05:01 GMT) Full text and rfc822 format available.

Message #11 received at 60565 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Tad Fisher <tadfisher <at> gmail.com>, 60565 <at> debbugs.gnu.org
Subject: Re: bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use
 recursive schema lookup
Date: Sat, 07 Jan 2023 19:04:18 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Tad Fisher <tadfisher <at> gmail.com>
>> Date: Thu, 5 Jan 2023 01:58:47 +0000
>> 
>> 
>> From 8e2cf80593dd78030929f96f0f1a3e1a325428a4 Mon Sep 17 00:00:00 2001
>> From: Tad Fisher <tadfisher <at> 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.
>
> Thanks.  Po Lu, any comments?

Fine by me.  Please install if the copyright exemption checks out.

Thanks, Tad.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60565; Package emacs. (Sat, 07 Jan 2023 11:11:02 GMT) Full text and rfc822 format available.

Message #14 received at 60565 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: tadfisher <at> gmail.com, 60565 <at> debbugs.gnu.org
Subject: Re: bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use
 recursive schema lookup
Date: Sat, 07 Jan 2023 13:11:10 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: Tad Fisher <tadfisher <at> gmail.com>,  60565 <at> debbugs.gnu.org
> Date: Sat, 07 Jan 2023 19:04:18 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Tad Fisher <tadfisher <at> gmail.com>
> >> Date: Thu, 5 Jan 2023 01:58:47 +0000
> >> 
> >> 
> >> From 8e2cf80593dd78030929f96f0f1a3e1a325428a4 Mon Sep 17 00:00:00 2001
> >> From: Tad Fisher <tadfisher <at> 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.
> >
> > Thanks.  Po Lu, any comments?
> 
> Fine by me.  Please install if the copyright exemption checks out.

It's a single line of code, so the exemption is OK.

Should this go to the release branch?  IOW, is the problem serious
enough and/or was introduced recently enough for us to want it in
Emacs 29?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60565; Package emacs. (Sun, 08 Jan 2023 01:15:01 GMT) Full text and rfc822 format available.

Message #17 received at 60565 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tadfisher <at> gmail.com, 60565 <at> debbugs.gnu.org
Subject: Re: bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use
 recursive schema lookup
Date: Sun, 08 Jan 2023 09:14:18 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Should this go to the release branch?  IOW, is the problem serious
> enough and/or was introduced recently enough for us to want it in
> Emacs 29?

Yes, please.  It is likely to affect packagers of Emacs 29.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 08 Jan 2023 11:50:01 GMT) Full text and rfc822 format available.

Notification sent to Tad Fisher <tadfisher <at> gmail.com>:
bug acknowledged by developer. (Sun, 08 Jan 2023 11:50:02 GMT) Full text and rfc822 format available.

Message #22 received at 60565-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: tadfisher <at> gmail.com, 60565-done <at> debbugs.gnu.org
Subject: Re: bug#60565: [PATCH] src/pgtkfns.c (parse_resource_key): Use
 recursive schema lookup
Date: Sun, 08 Jan 2023 13:49:36 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: tadfisher <at> gmail.com,  60565 <at> debbugs.gnu.org
> Date: Sun, 08 Jan 2023 09:14:18 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Should this go to the release branch?  IOW, is the problem serious
> > enough and/or was introduced recently enough for us to want it in
> > Emacs 29?
> 
> Yes, please.  It is likely to affect packagers of Emacs 29.

Thanks, installed, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Feb 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.