GNU bug report logs - #44730
[GAJIM]: Fix loading of installed plugins

Previous Next

Package: guix-patches;

Reported by: Raghav Gururajan <rg <at> raghavgururajan.name>

Date: Wed, 18 Nov 2020 23:46:02 UTC

Severity: normal

Merged with 44728

To reply to this bug, email your comments to 44730 AT debbugs.gnu.org.

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

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


Report forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Wed, 18 Nov 2020 23:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raghav Gururajan <rg <at> raghavgururajan.name>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 18 Nov 2020 23:46:02 GMT) Full text and rfc822 format available.

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

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: guix-patches <at> gnu.org
Cc: Julien Lepiller <julien <at> lepiller.eu>
Subject: [GAJIM]: Fix loading of installed plugins
Date: Wed, 18 Nov 2020 15:50:14 -0500
[Message part 1 (text/plain, inline)]
Hello Guix!

Please find the attached patch to fix plugins issue in Gajim.

@Julien
Will you be able to push this patch? This patch is a follow-up of #43575.

Thank you!

Regards,
RG.
[0001-gnu-gajim-Fix-loading-of-os-installed-plugins.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Merged 44728 44730. Request was from "Raghav Gururajan" <raghavgururajan <at> disroot.org> to control <at> debbugs.gnu.org. (Thu, 19 Nov 2020 00:46:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Thu, 19 Nov 2020 14:45:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Raghav Gururajan <rg <at> raghavgururajan.name>
Cc: Julien Lepiller <julien <at> lepiller.eu>, 44730 <at> debbugs.gnu.org,
 guix-patches <at> gnu.org
Subject: Re: [bug#44730] [GAJIM]: Fix loading of installed plugins
Date: Thu, 19 Nov 2020 15:44:31 +0100
[Message part 1 (text/plain, inline)]
Hullo Raghav!

Thanks for taking care of Gajim.

Raghav Gururajan 写道:
> fix plugins issue in Gajim.

Please provide more information: what was wrong with the original 
code, and why and how will your patch fix it?  It's better to put 
this in the commit message itself (above the change log), not just 
the cover letter (your mail).  No more than a few lines.

The more clear your explanation, the faster the fix can be 
reviewed and merged.

I assume that the problem is the empty ‘Plugins’ list when I run:

 $ guix environment guix \
   -- ./pre-inst-env guix environment \
   --pure --ad-hoc gajim{,-openpgp,-omemo} \
   -- gajim

However, the fix doesn't look right to me.

After applying your patch, Gajim is broken.  Menus don't work.

--8<---------------cut here---------------start------------->8---
Traceback (most recent call last):
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/application.py", 
 line 222, in _activate
   self.interface.run(self)
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/gui_interface.py", 
 line 1965, in run
   app.plugin_manager = plugins.PluginManager()
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/helpers.py", 
 line 1002, in __call__
   cls._instances[cls] = super(Singleton, cls).__call__(
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py", 
 line 224, in __init__
   self._load_plugins()
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py", 
 line 668, in _load_plugins
   for plugin_dir in configpaths.get_plugin_dirs():
 File 
 "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/configpaths.py", 
 line 50, in get_plugin_dirs
   Path(os.getenv['PLUGINS_OS']),
--8<---------------cut here---------------end--------------->8---

I wrote my own patch (attached; no, I don't speak much Python).  I 
think it fixes the problem but I can't test it.

[0001-gnu-gajim-Honour-GAJIM_PLUGIN_PATH.patch (text/x-patch, inline)]
From 866593af88993ab5068f165b1284b8b4cb32e04e Mon Sep 17 00:00:00 2001
From: Tobias Geerinckx-Rice <me <at> tobias.gr>
Date: Thu, 19 Nov 2020 15:20:14 +0100
Subject: [PATCH] gnu: gajim: Honour $GAJIM_PLUGIN_PATH.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This perhaps fixes <http://issues.guix.gnu.org/44730> maybe.

* gnu/packages/messaging.scm (gajim)[arguments]: Replace the
‘add-plugin-dirs’ substitution phase with a...
[source]: ...patch that won't silently break in the future.
* gnu/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                        |  1 +
 gnu/packages/messaging.scm                          | 13 ++-----------
 .../patches/gajim-honour-GAJIM_PLUGIN_PATH.patch    | 11 +++++++++++
 3 files changed, 14 insertions(+), 11 deletions(-)
 create mode 100644 gnu/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a1da838aee..e728ed28d1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -990,6 +990,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/freedink-engine-fix-sdl-hints.patch	\
   %D%/packages/patches/freeimage-unbundle.patch		\
   %D%/packages/patches/fuse-overlapping-headers.patch				\
+  %D%/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch	\
   %D%/packages/patches/ganeti-deterministic-manual.patch	\
   %D%/packages/patches/ganeti-disable-version-symlinks.patch	\
   %D%/packages/patches/ganeti-drbd-compat.patch			\
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index 624ad72c23..99131dcf05 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -743,7 +743,8 @@ of xmpppy.")
                        (version-major+minor version)
                        "/gajim-" version ".tar.gz"))
        (sha256
-        (base32 "1gfcp3b5nq43xxz5my8vfhfxnnli726j3hzcgwh9fzrzzd9ic3gx"))))
+        (base32 "1gfcp3b5nq43xxz5my8vfhfxnnli726j3hzcgwh9fzrzzd9ic3gx"))
+       (patches (search-patches "gajim-honour-GAJIM_PLUGIN_PATH.patch"))))
     (build-system python-build-system)
     (arguments
      `(#:imported-modules
@@ -756,16 +757,6 @@ of xmpppy.")
         (guix build utils))
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'add-plugin-dirs
-           (lambda _
-             (substitute* "gajim/common/configpaths.py"
-               (("_paths\\['PLUGINS_USER'\\]\\]")
-                "_paths['PLUGINS_USER']] + \
-([os.getenv('GAJIM_PLUGIN_PATH')] \
-if os.getenv('GAJIM_PLUGIN_PATH') \
-and Path(os.getenv('GAJIM_PLUGIN_PATH')).is_dir() \
-else [])"))
-             #t))
          (replace 'check
            (lambda _
              ;; Tests require a running X server.
diff --git a/gnu/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch b/gnu/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch
new file mode 100644
index 0000000000..cb3313197c
--- /dev/null
+++ b/gnu/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch
@@ -0,0 +1,11 @@
+--- a/gajim/common/configpaths.py	2020-11-19 12:12:02.004414323 +0100
++++ a/gajim/common/configpaths.py	2020-11-19 15:34:52.211476895 +0100
+@@ -47,7 +47,7 @@
+         return [Path(_paths['PLUGINS_BASE']),
+                 Path('/app/plugins')]
+     return [Path(_paths['PLUGINS_BASE']),
+-            Path(_paths['PLUGINS_USER'])]
++            Path(_paths['PLUGINS_USER'])] + ([Path(os.getenv('GAJIM_PLUGIN_PATH'))] if os.getenv('GAJIM_PLUGIN_PATH') and Path(os.getenv('GAJIM_PLUGIN_PATH')).is_dir() else [])
+ 
+ 
+ def get_paths(type_: PathType) -> Generator[str, None, None]:
-- 
2.29.2

[Message part 3 (text/plain, inline)]
The plug-ins are found, but won't load with my version of Gajim.

--8<---------------cut here---------------start------------->8---
11/19/20 15:10:01 (W) gajim.plugin_system        Plugin omemo not 
loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 1.3.90
11/19/20 15:10:01 (W) gajim.plugin_system        Plugin openpgp 
not loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 
1.3.90
--8<---------------cut here---------------end--------------->8---

This is on current master.  How are these plug-ins expected to be 
used?

> -       (variable "GAJIM_PLUGIN_PATH")
> +       (variable "PLUGINS_OS")

This doesn't look related to the fix at hand.

Why remove GAJIM_?
Why rename _PATH?
TBH, both strike me as unnecessary regressions.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Thu, 19 Nov 2020 14:46:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Fri, 20 Nov 2020 00:15:01 GMT) Full text and rfc822 format available.

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

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: Julien Lepiller <julien <at> lepiller.eu>, 44730 <at> debbugs.gnu.org,
 guix-patches <at> gnu.org
Subject: Re: [bug#44730] [GAJIM]: Fix loading of installed plugins
Date: Thu, 19 Nov 2020 15:50:49 -0500
[Message part 1 (text/plain, inline)]
Hello Tobias!

> Thanks for taking care of Gajim.

Anytime! :-)

> Raghav Gururajan 写道:
>> fix plugins issue in Gajim.
> 
> Please provide more information: what was wrong with the original code, 
> and why and how will your patch fix it?  It's better to put this in the 
> commit message itself (above the change log), not just the cover letter 
> (your mail).  No more than a few lines.
> 
> The more clear your explanation, the faster the fix can be reviewed and 
> merged.

I keep doing this, my apologies. I have included comment in commit 
message of revised patch.

> I assume that the problem is the empty ‘Plugins’ list when I run:
> 
>   $ guix environment guix \
>     -- ./pre-inst-env guix environment \
>     --pure --ad-hoc gajim{,-openpgp,-omemo} \
>     -- gajim

Yes!

> However, the fix doesn't look right to me.
> 
> After applying your patch, Gajim is broken.  Menus don't work.
> 
> --8<---------------cut here---------------start------------->8---
> Traceback (most recent call last):
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/application.py",  line 222, in _activate
>     self.interface.run(self)
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/gui_interface.py",  line 1965, in run
>     app.plugin_manager = plugins.PluginManager()
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/helpers.py",  line 1002, in __call__
>     cls._instances[cls] = super(Singleton, cls).__call__(
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py",  line 224, in __init__
>     self._load_plugins()
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py",  line 668, in _load_plugins
>     for plugin_dir in configpaths.get_plugin_dirs():
>   File 
>   "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/configpaths.py",  line 50, in get_plugin_dirs
>     Path(os.getenv['PLUGINS_OS']),
> --8<---------------cut here---------------end--------------->8---

Sorry, I was misled by a dev. I tries your patch instead now.

> I wrote my own patch (attached; no, I don't speak much Python).  I think 
> it fixes the problem but I can't test it.

Thanks! I just tested it. It works. :-)

> The plug-ins are found, but won't load with my version of Gajim.
> 
> --8<---------------cut here---------------start------------->8---
> 11/19/20 15:10:01 (W) gajim.plugin_system        Plugin omemo not 
> loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 1.3.90
> 11/19/20 15:10:01 (W) gajim.plugin_system        Plugin openpgp not 
> loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 1.3.90
> --8<---------------cut here---------------end--------------->8---
> 
> This is on current master.  How are these plug-ins expected to be used?

I think you installed plugins, both via guix and via gajim's plugin 
installer. You should remove one of them.

>> -       (variable "GAJIM_PLUGIN_PATH")
>> +       (variable "PLUGINS_OS")
> 
> This doesn't look related to the fix at hand.
> 
> Why remove GAJIM_?
> Why rename _PATH?
> TBH, both strike me as unnecessary regressions.
I was discussing with a Gajim Dev. They agreed to merge our patch in 
Gajim's upstream. So it can be useful for other non-conventional distros 
as well.

Regards,
RG.
[0001-gnu-gajim-Fix-loading-of-os-installed-plugins.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Fri, 20 Nov 2020 00:15:02 GMT) Full text and rfc822 format available.

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

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: Julien Lepiller <julien <at> lepiller.eu>, 44730 <at> debbugs.gnu.org,
 guix-patches <at> gnu.org
Subject: Re: [bug#44730] [GAJIM]: Fix loading of installed plugins
Date: Thu, 19 Nov 2020 16:44:00 -0500
[Message part 1 (text/plain, inline)]
Hello Tobias!

As we discussed in IRC, here are the patches to downgrade gajim-plugins.

Regards,
RG.
[0001-gnu-gajim-omemo-Downgrade-to-2.6.80.patch (text/x-patch, attachment)]
[0002-gnu-gajim-openpgp-Downgrade-to-1.2.14.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Fri, 20 Nov 2020 00:15:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#44730; Package guix-patches. (Fri, 20 Nov 2020 00:15:03 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 205 days ago.

Previous Next


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