Comment 5 for bug 1846890

Revision history for this message
Martin Wimpress  (flexiondotorg) wrote :

This issue is due to an upstream (erroneous) change in libpeas 1.24.

The only reference to python loader is at https://github.com/mate-desktop/pluma/blob/1.22/pluma/pluma-plugins-engine.c#L63

```
pluma/pluma-plugins-engine.c:63
    peas_engine_enable_loader (PEAS_ENGINE (engine), "python");
```

Looking at the blibpeas code here's that function: https://github.com/GNOME/libpeas/blob/master/libpeas/peas-engine.c#L943

```
libpeas/peas-engine.c:943
 * peas_engine_enable_loader:
```

It still references `python` as Python 2 loader and then it calls peas_utils_get_loader_id to get loader id by name https://github.com/GNOME/libpeas/blob/master/libpeas/peas-utils.c#L257

```
libpeas/peas-utils.c:257
peas_utils_get_loader_id (const gchar *loader)
```

That function looks at all_plugin_loaders array with all known loaders names

```
static const gchar *all_plugin_loaders[] = {
  "c", "lua5.1", "python", "python3"
};
```

The Python 2 loader is still named `python` this means, if we change python loader name to python2 in Pluma, libpeas won't find it.

This is where the loader library name was changed without changing the loader name in the list of loaders: https://github.com/GNOME/libpeas/commit/dabb83a2e217694220a55c2019a081365a4a1288#diff-ad34de593e22ad307274456f3b4724a3

After that, they dropped autotools build files where you can see that the library was called libpythonloader in the makefile: https://github.com/GNOME/libpeas/commit/eadd10dbdd5b9b6b0488aeb41d4bf1592ba9d5d2#diff-f2abb793309b0ed9d8e63c1e038b1e31

Here is a test case:

```
#include <libpeas/peas-engine.h>

int
main (int argc, char **argv) {
    PeasEngine *engine = peas_engine_get_default ();
    peas_engine_enable_loader (engine, "python2");
    return 0;
}
```

Build the above with:

```
gcc -Wall -o peas-test peas-test.c `pkg-config --cflags libpeas-1.0` `pkg-config --libs libpeas-1.0`
```

And run it:

```
$ ./peas-test
```

You'll get this output:

```
(process:13201): libpeas-WARNING **: 13:25:09.920: Failed to enable unknown plugin loader 'python2'
```

And with that, we can confirm that the `python2` loader won't be found by libpeas and that the debdiff above is the correct way to fix this issue.