Bug 240154 - graphics/gimp-app: gimptool installs plugins into wrong directory
Summary: graphics/gimp-app: gimptool installs plugins into wrong directory
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gnome (Nobody)
Keywords: easy, patch, patch-ready
Depends on:
Reported: 2019-08-27 20:12 UTC by Christoph Moench-Tegeder
Modified: 2019-08-30 21:21 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (gnome)

fixes gimptool to install plugins into the actual plugin-directory (448 bytes, patch)
2019-08-27 20:12 UTC, Christoph Moench-Tegeder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Moench-Tegeder freebsd_committer 2019-08-27 20:12:15 UTC
Created attachment 206961 [details]
fixes gimptool to install plugins into the actual plugin-directory

The Gimp plugin directory has been set to /usr/local/libexec/gimp/2.2 by means of the patched configure script.
When querying the plugin directory via gimptool-2.0:

: cmt@elch:/tmp$ /usr/local/bin/gimptool-2.0 --gimpplugindir                     
: /usr/local/libexec/gimp/2.2

But when using gimptool to actually install a plugin:

: cmt@elch:/tmp$ /usr/local/bin/gimptool-2.0 --dry-run --install-admin-bin foo
: cp 'foo' '/usr/local/lib/gimp/2.0/plug-ins'

Note the difference in target directories. When looking at gimp's tools/gimptool.c, it's obvious that get_sys_plugin_dir() does not use GIMPPLUGINDIR but constructs the plugin directory name from scratch.

Attached patch (to be dropped into files/) fixes that. Obviously, PORTREVISION needs to be increased when applying.
A quick grep through the ports tree suggests that currently no port had been using "gimptool --install...", so any chasing of gimp plugins should be unneccessary.
Comment 1 Ting-Wei Lan 2019-08-29 08:38:29 UTC
(In reply to Christoph Moench-Tegeder from comment #0)
It looks like a downstream bug. What is the reason for the port to use patch-configure to change the plugin path?
Comment 2 Christoph Moench-Tegeder freebsd_committer 2019-08-29 21:27:54 UTC
(In reply to Ting-Wei Lan from comment #1)

Downstream? Upstream? I'd say upstream, as the way to determine the plugin path is clearly inconsistent. But then I don't have the energy to figure out where they keep their bugs and repos this week.
Comment 3 Ting-Wei Lan 2019-08-30 04:18:59 UTC
(In reply to Christoph Moench-Tegeder from comment #2)
I meant downstream. The inconsistency comes from a downstream patch.

In configure.ac, the plugin directory is defined as:

In tools/gimptool.c, the file you modified, defines it as:
dir = g_build_path (..., LIBDIR, "gimp", GIMP_PLUGIN_VERSION, ..., NULL);

They should be the same. It is files/patch-configure in the port changing the the definition in configure.ac that causes the problem.

I have an installation of GIMP under my home directory for testing, and the two commands you mentioned did return consistent results.

$ gimptool-2.99 --gimpplugindir

$ gimptool-2.99 --dry-run --install-admin-bin foo
cp 'foo' '/home/lantw44/gnome/devinstall/lib/gimp/2.99/plug-ins'
Comment 4 Christoph Moench-Tegeder freebsd_committer 2019-08-30 21:21:12 UTC
(In reply to Ting-Wei Lan from comment #3)
I'd still argue that the real bug is upstream: the "real" plugin directory value is set in configure.ac and propagated via config.h GIMPPLUGINDIR to all the places where it might be needed. Deducing some plugindir by any other means is just inconsistent, even if it gives the same value as the upstream default.

Anyways, the more important question is how to fix this situation:
FreeBSD is settings it's own gimpplugindir "since forever" (ports r46408 from 18 years ago) - to match FreeBSD's filesystem hierarchy which is ever so slightly different from what that Linux does.
a) we could drop that modification, but then we'd have to at least rebuild all the plugins which were installed in the "modified" path (plus whatever users built and installed on their own)
b) or we modify gimptool to use the declared path and not make up another path

a might be the cleaner option (if we could argue that the plugins may live under lib/), but b looks like it will cause less breakage, so.