bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-20 Thread Ludovic Courtès
Hi Chris,

Christopher Baines  skribis:

> Ludovic Courtès  writes:
>
>> Agreed!  I don’t use GNOME and I don’t even know what KgxNautilus is,
>> but here’s a patch that may fix this by ensuring Nautilus doesn’t load
>> the same extension twice.
>>
>> Could you give it a spin and lemme know if it solves this issue?\
>>
>> That’ll get us closer to a release.  :-)
>
> I've tried it out and it looks to fix the issue, please push!

Thanks for the quick reply!  Pushed as
99ba4ddb03b396f56764a25317f40d4501380704.

Ludo’.





bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-20 Thread Christopher Baines

Ludovic Courtès  writes:

> Agreed!  I don’t use GNOME and I don’t even know what KgxNautilus is,
> but here’s a patch that may fix this by ensuring Nautilus doesn’t load
> the same extension twice.
>
> Could you give it a spin and lemme know if it solves this issue?\
>
> That’ll get us closer to a release.  :-)

I've tried it out and it looks to fix the issue, please push!

Thanks,

Chris


signature.asc
Description: PGP signature


bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-20 Thread Ludovic Courtès
Hi!

Christopher Baines  skribis:

> Liliana Marie Prikler  writes:
>
>> Am Samstag, dem 01.10.2022 um 13:29 +0200 schrieb Tobias Kortkamp:
>>> Hi,
>>> 
>>> The problem seems to be that NAUTILUS_EXTENSION_PATH contains the
>>> same path twice and that it tries to load KgxNautilus from each of
>>> the paths:
>>> 
>>> $ echo $NAUTILUS_EXTENSION_PATH
>>> /run/current-system/profile/lib/nautilus/site-
>>> extensions:/run/current-system/profile/lib/nautilus/site-extensions
>>> 
>>> Running Nautilus like this works fine:
>>> 
>>> $ NAUTILUS_EXTENSION_PATH=/run/current-
>>> system/profile/lib/nautilus/site-extensions nautilus
>>
>> I only know of one thing setting this variable, that being nautilus'
>> search-path.  Do you by chance source some profile multiple times?
>
> There might be a related issue where there's duplicates in search paths,
> I've tested in a simple VM and I see the duplication in
> NAUTILUS_EXTENSION_PATH.
>
> Anyway, this probably should be something that doesn't cause nautilus to
> segfault.

Agreed!  I don’t use GNOME and I don’t even know what KgxNautilus is,
but here’s a patch that may fix this by ensuring Nautilus doesn’t load
the same extension twice.

Could you give it a spin and lemme know if it solves this issue?\

That’ll get us closer to a release.  :-)

Thanks,
Ludo’.

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 3d942635a2..78e65d7400 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9671,7 +9671,9 @@ (define-public nautilus
   name "-" version ".tar.xz"))
   (sha256
(base32
-"1cncyiyh79w1id6a6s2f0rxmgwl65lp4ml4afa0z35jrnwp2s8cr"
+"1cncyiyh79w1id6a6s2f0rxmgwl65lp4ml4afa0z35jrnwp2s8cr"))
+  (patches
+   (search-patches "nautilus-extension-search-path.patch"
 (build-system meson-build-system)
 (arguments
  (list
@@ -9685,27 +9687,6 @@ (define-public nautilus
   (substitute* "test/automated/displayless/meson.build"
 (("^foreach t: tracker_tests" all)
  (string-append "tracker_tests = []\n" all)
-  (add-after 'unpack 'make-extensible
-(lambda _
-  (substitute* "src/nautilus-module.c"
-(("static gboolean initialized = FALSE;" all)
- (string-append all "
-const char *extension_path;
-char **extension_dirs, **d;
-")
- )
-(("load_module_dir \\(NAUTILUS_EXTENSIONDIR\\);" all)
- (string-append all
-"
-extension_path = g_getenv (\"NAUTILUS_EXTENSION_PATH\");
-if (extension_path)
-{
-extension_dirs = g_strsplit (extension_path, \":\", -1);
-for (d = extension_dirs; d != NULL && *d != NULL; d++)
-load_module_dir(*d);
-g_strfreev(extension_dirs);
-}
-")
   (add-after 'unpack 'skip-gtk-update-icon-cache
 ;; Don't create 'icon-theme.cache'.
 (lambda _
diff --git a/gnu/packages/patches/nautilus-extension-search-path.patch b/gnu/packages/patches/nautilus-extension-search-path.patch
new file mode 100644
index 00..aa870d9212
--- /dev/null
+++ b/gnu/packages/patches/nautilus-extension-search-path.patch
@@ -0,0 +1,72 @@
+diff --git a/src/nautilus-module.c b/src/nautilus-module.c
+index bf474bd..42e2a4e 100644
+--- a/src/nautilus-module.c
 b/src/nautilus-module.c
+@@ -211,6 +211,10 @@ static void
+ load_module_dir (const char *dirname)
+ {
+ GDir *dir;
++static GHashTable *loaded = NULL;
++
++if (loaded == NULL)
++  loaded = g_hash_table_new (g_str_hash, g_str_equal);
+ 
+ dir = g_dir_open (dirname, 0, NULL);
+ 
+@@ -221,15 +225,22 @@ load_module_dir (const char *dirname)
+ while ((name = g_dir_read_name (dir)))
+ {
+ if (g_str_has_suffix (name, "." G_MODULE_SUFFIX))
+-{
+-char *filename;
+-
+-filename = g_build_filename (dirname,
+- name,
+- NULL);
+-nautilus_module_load_file (filename);
+-g_free (filename);
+-}
++	  {
++		/* Make sure each module is loaded only twice or this could
++		   lead to a crash.  Double loading can occur if DIRNAME
++		   occurs more than once in $NAUTILUS_EXTENSION_PATH.  */
++		if (!g_hash_table_contains (loaded, name))
++		  {
++		char *filename;
++
++		filename = g_build_filename (dirname,
++		 name,
++		 NULL);
++		nautilus_module_load_file (filename);
++		g_hash_table_add (loaded, g_strdup (name));
++		g_free (filename);
++		  }
++	  }
+ }
+ 
+ g_dir_close (dir);
+@@ -257,10 +268,24 @@ nautilus_module_setup (void)
+ 
+ if (!initialized)
+ {
++const gchar *extension_path;
+ initialized = TRUE;
+ 
+ load_module_dir (NAUTILUS_EXTENSIONDIR);

bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-10 Thread Christopher Baines

Liliana Marie Prikler  writes:

> Am Samstag, dem 01.10.2022 um 13:29 +0200 schrieb Tobias Kortkamp:
>> Hi,
>> 
>> The problem seems to be that NAUTILUS_EXTENSION_PATH contains the
>> same path twice and that it tries to load KgxNautilus from each of
>> the paths:
>> 
>> $ echo $NAUTILUS_EXTENSION_PATH
>> /run/current-system/profile/lib/nautilus/site-
>> extensions:/run/current-system/profile/lib/nautilus/site-extensions
>> 
>> Running Nautilus like this works fine:
>> 
>> $ NAUTILUS_EXTENSION_PATH=/run/current-
>> system/profile/lib/nautilus/site-extensions nautilus
>
> I only know of one thing setting this variable, that being nautilus'
> search-path.  Do you by chance source some profile multiple times?

There might be a related issue where there's duplicates in search paths,
I've tested in a simple VM and I see the duplication in
NAUTILUS_EXTENSION_PATH.

Anyway, this probably should be something that doesn't cause nautilus to
segfault.

Chris


signature.asc
Description: PGP signature


bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-09 Thread Liliana Marie Prikler
Am Samstag, dem 01.10.2022 um 13:29 +0200 schrieb Tobias Kortkamp:
> Hi,
> 
> The problem seems to be that NAUTILUS_EXTENSION_PATH contains the
> same path twice and that it tries to load KgxNautilus from each of
> the paths:
> 
> $ echo $NAUTILUS_EXTENSION_PATH
> /run/current-system/profile/lib/nautilus/site-
> extensions:/run/current-system/profile/lib/nautilus/site-extensions
> 
> Running Nautilus like this works fine:
> 
> $ NAUTILUS_EXTENSION_PATH=/run/current-
> system/profile/lib/nautilus/site-extensions nautilus
I only know of one thing setting this variable, that being nautilus'
search-path.  Do you by chance source some profile multiple times?

Cheers





bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-11-09 Thread Christopher Baines

Tobias Kortkamp  writes:

> I updated from c8112f3bd95269ce4aca12dedbfe61bb6b37acae to
> 0dec41f329c37a4293a2a8326f1fe7d9318ec455 and now Nautilus crashes
> with:
>
> (org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:09.877: Two 
> different plugins tried to register 'KgxNautilus'.
>
> (org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:09.877: 
> g_type_add_interface_dynamic: assertion 'G_TYPE_IS_INSTANTIATABLE 
> (instance_type)' failed
>
> (org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:09.877: Two 
> different plugins tried to register 'KgxNautilusMenuItem'.
>
> ** (org.gnome.Nautilus:3664): WARNING **: 13:25:09.882: Tracker 2 migration: 
> Couldn't run `tracker3`: Failed to execute child process “tracker3” (No such 
> file or directory)
>
> (org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:10.222: invalid 
> cast from 'KgxNautilus' to ''
>
> (org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:10.222: 
> g_object_new_valist: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
>
> (org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:10.222: 
> g_object_get: assertion 'G_IS_OBJECT (object)' failed
>
> The problem seems to be that NAUTILUS_EXTENSION_PATH contains the same
> path twice and that it tries to load KgxNautilus from each of the paths:
>
> $ echo $NAUTILUS_EXTENSION_PATH
> /run/current-system/profile/lib/nautilus/site-extensions:/run/current-system/profile/lib/nautilus/site-extensions
>
> Running Nautilus like this works fine:
>
> $ 
> NAUTILUS_EXTENSION_PATH=/run/current-system/profile/lib/nautilus/site-extensions
>  nautilus

Thanks for investigating Tobi, I've been experiencing this too, but
didn't get anywhere trying to use GDB, so thanks for tracking it down!

This NAUTILUS_EXTENSION_PATH is a Guix specific modification made to
nautilus at build time, so yeah, something is up here and it's down to
us to fix it.

Maybe the duplication of the directory in the search path is something
to fix, but I guess the code in nautilus using the search path probalbly
needs to be smarter to avoid loading plugins twice.

Chris


signature.asc
Description: PGP signature


bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-10-08 Thread Jascha Geerds
Am Sa, 1. Okt 2022, um 20:14, schrieb Tobias Geerinckx-Rice via Bug reports for 
GNU Guix:
> So it *still* fails to find tracker3 before segfaulting?  Possible.  
> Could be a missing substitution, or it falling back to some other 
> (search) path...

It seems like this issue is due to commit 
103d8229cbbd3baefe1f3b02bc2edff9c816b0bf where "gnome-terminal" is replaced by 
"gnome-console". There is some nautilus extension path stuff in the 
gnome-console derivation which I do not fully understand 
(cb2d5063a0353a3aa93d513979c8a7fc80db1460).





bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-10-01 Thread Tobias Geerinckx-Rice via Bug reports for GNU Guix
Hi Tobias,

On 1 October 2022 14:40:58 UTC, Tobias Kortkamp  
wrote:
>** (org.gnome.Nautilus:11879): WARNING **: 16:07:20.550: Tracker 2 migration: 
>Failed to parse key file data: Key file contains line “usage: tracker3 
>[--version] [--help]” which is not a key-value pair, group, or comment

There we go.  There it is.

>Same crash as before otherwise.

So it *still* fails to find tracker3 before segfaulting?  Possible.  Could be a 
missing substitution, or it falling back to some other (search) path...

>If I run that command manually I just get the usage screen. In fact
>none of the tracker3 subcommands actually seem to work like they do on
>Fedora. Not even "help".

This sounds exactly like hypothesis #2 (mis-wrapping).  I thought that was a 
thing of the past, but maybe the fix is still floating up to master, or 
incomplete...

Will be easy enough to confirm when I'm back at K.



Thanks!

T G-R

Sent on the go.  Excuse or enjoy my brevity.





bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-10-01 Thread Tobias Kortkamp
On Sat, Oct 01, 2022 at 02:32:43PM +0200, Tobias Geerinckx-Rice wrote:
> Hi… Tobias,
> 
> Tobias Kortkamp 写道:
> > ** (org.gnome.Nautilus:3664): WARNING **: 13:25:09.882: Tracker 2
> > migration: Couldn't run `tracker3`: Failed to execute child process
> > “tracker3” (No such file or directory)
> 
> Could you install ‘tracker@3’ into the same profile, and try again?  This
> part might be a relatively simple input fix.

Then I get

** (org.gnome.Nautilus:11879): WARNING **: 16:07:20.550: Tracker 2 migration: 
Failed to parse key file data: Key file contains line “usage: tracker3 
[--version] [--help]” which is not a key-value pair, group, or comment

Same crash as before otherwise.

According to
https://gitlab.gnome.org/GNOME/nautilus/-/blob/42.2/src/nautilus-tag-manager.c#L941
Nautilus tries to export Tracker2 metadata with

tracker3 export --2to3 files-starred --keyfile

If I run that command manually I just get the usage screen. In fact
none of the tracker3 subcommands actually seem to work like they do on
Fedora. Not even "help".

Best regards





bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-10-01 Thread Tobias Geerinckx-Rice via Bug reports for GNU Guix

Hi… Tobias,

Tobias Kortkamp 写道:
** (org.gnome.Nautilus:3664): WARNING **: 13:25:09.882: Tracker 
2
migration: Couldn't run `tracker3`: Failed to execute child 
process

“tracker3” (No such file or directory)


Could you install ‘tracker@3’ into the same profile, and try 
again?  This part might be a relatively simple input fix.


Please note whether it crashes for the *same* reason, as I fully 
expect it to still crash!  See this log[0] posted by nashdidan[m] 
on IRC[1].


Aside from the vague version mismatch hypothesis, another possible 
culprit is wrapping.  G-stuff needs a lot of wrapping to work 
properly & we might be introducing a bogus (argv[0]?) argument 
somewhere.  I didn't investigate.


Kind regards,

T G-R

[0]: 
https://libera.ems.host/_matrix/media/r0/download/libera.chat/b5ff1e283706b1ed86b1396ce7f8d3474405c698

[1]: https://logs.guix.gnu.org/guix/2022-09-30.log#090340


signature.asc
Description: PGP signature


bug#58221: nautilus: Crashes loading KgxNautilus plugin twice (problems with NAUTILUS_EXTENSION_PATH)

2022-10-01 Thread Tobias Kortkamp
Hi,

I updated from c8112f3bd95269ce4aca12dedbfe61bb6b37acae to
0dec41f329c37a4293a2a8326f1fe7d9318ec455 and now Nautilus crashes
with:

(org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:09.877: Two different 
plugins tried to register 'KgxNautilus'.

(org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:09.877: 
g_type_add_interface_dynamic: assertion 'G_TYPE_IS_INSTANTIATABLE 
(instance_type)' failed

(org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:09.877: Two different 
plugins tried to register 'KgxNautilusMenuItem'.

** (org.gnome.Nautilus:3664): WARNING **: 13:25:09.882: Tracker 2 migration: 
Couldn't run `tracker3`: Failed to execute child process “tracker3” (No such 
file or directory)

(org.gnome.Nautilus:3664): GLib-GObject-WARNING **: 13:25:10.222: invalid cast 
from 'KgxNautilus' to ''

(org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:10.222: 
g_object_new_valist: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(org.gnome.Nautilus:3664): GLib-GObject-CRITICAL **: 13:25:10.222: 
g_object_get: assertion 'G_IS_OBJECT (object)' failed

The problem seems to be that NAUTILUS_EXTENSION_PATH contains the same
path twice and that it tries to load KgxNautilus from each of the paths:

$ echo $NAUTILUS_EXTENSION_PATH
/run/current-system/profile/lib/nautilus/site-extensions:/run/current-system/profile/lib/nautilus/site-extensions

Running Nautilus like this works fine:

$ 
NAUTILUS_EXTENSION_PATH=/run/current-system/profile/lib/nautilus/site-extensions
 nautilus

Best regards,

Tobi