Subject: bug#58191: missing substitute for @gschemasCompiled@ ?

From: Attila Lendvai <[email-masked]>
Date: Fri, 30 Sep 2022 10:17:11 +0000

i'm attaching my current WIP diff while i was trying to debug this.

note that in my original submission there was a substitute for @gschemasCompiled@ (https://issues.guix.gnu.org/53072), but it did not reach master when it got pushed (https://git.savannah.gnu.org/cgit/guix.git/commit/gnu/packages/gnome-xyz.scm?id=a485e1e663060e8c62103d81dfffec591f624360).

i'm not sure whether it's important. it shouldn't be, because gpaste used to work for me right until a recent reconfigure... but i thought that i point it out. if that substitute was intentionally left out, then it may warrant a comment on why, because the package's .patch file (inherited from NixOS) adds the marker (https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/gpaste-fix-paths.patch).

i tried to reinstate the substitute, as you can see below, but it does not fix the new crash. i added some asserts, even sure-to-fail ones, and that code path seems not yet reached when the sigsegv already happens.

i'm out of ideas, and certainly out of my glib knowledge.

----

2 files changed, 11 insertions(+), 5 deletions(-)
gnu/packages/gnome-xyz.scm                  | 12 ++++++++----
gnu/packages/patches/gpaste-fix-paths.patch |  4 +++-

modified   gnu/packages/gnome-xyz.scm
@@ -819,7 +819,7 @@ (define-public gnome-shell-extension-paperwm
 (define-public gpaste
   (package
     (name "gpaste")
-    (version "42.1")
+    (version "42.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -828,12 +828,13 @@ (define-public gpaste
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1dlqa69zvzzdxyh21qfrx2nhpfy0fbihxpgkxqmramcgv3h5k4q3"))
+                "0qq2p19p3r3lz8yfynpnf36cipv54bzdbmq1x5zgwhyl4yl41g28"))
               (patches
                (search-patches "gpaste-fix-paths.patch"))))
     (build-system meson-build-system)
     (native-inputs
-     (list gettext-minimal
+     (list gcr
+           gettext-minimal
            gobject-introspection
            (list glib "bin")            ; for glib-compile-resources
            pkg-config
@@ -862,7 +863,10 @@ (define-public gpaste
                    (substitute* '("src/gnome-shell/extension.js"
                                   "src/gnome-shell/prefs.js")
                      (("@typelibPath@")
-                      (string-append #$output "/lib/girepository-1.0/"))))))))
+                      (string-append #$output "/lib/girepository-1.0/")))
+                   (substitute* '("src/libgpaste/gpaste/gpaste-settings.c")
+                     (("@gschemasCompiled@")
+                      (string-append #$output "/share/glib-2.0/schemas/"))))))))
     (home-page "https://github.com/Keruspe/GPaste")
     (synopsis "Clipboard management system for GNOME Shell")
     (description "GPaste is a clipboard manager, a tool which allows you to
modified   gnu/packages/patches/gpaste-fix-paths.patch
@@ -30,14 +30,16 @@ diff --git a/src/libgpaste/gpaste/gpaste-settings.c b/src/libgpaste/gpaste/gpast
 index 7e53eb64..57c399fc 100644
 --- a/src/libgpaste/gpaste/gpaste-settings.c
 +++ b/src/libgpaste/gpaste/gpaste-settings.c
-@@ -1013,7 +1013,11 @@ create_g_settings (void)
+@@ -1013,7 +1013,13 @@ create_g_settings (void)
      }
      else
      {
 -        return g_settings_new (G_PASTE_SETTINGS_NAME);
 +        // library used by introspection requires schemas but we cannot set XDG_DATA_DIRS for the library
 +        GSettingsSchemaSource *schema_source = g_settings_schema_source_new_from_directory ("@gschemasCompiled@", NULL, FALSE, NULL);
++        g_assert (schema_source);
 +        g_autoptr (GSettingsSchema) schema = g_settings_schema_source_lookup (schema_source, G_PASTE_SETTINGS_NAME, FALSE);
++        g_assert (schema);
 +        g_settings_schema_source_unref (schema_source);
 +        return g_settings_new_full (schema, NULL, NULL);
      }