Bug 240154

Summary: graphics/gimp-app: gimptool installs plugins into wrong directory
Product: Ports & Packages Reporter: Christoph Moench-Tegeder <cmt>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Only Me CC: fluffy, lantw44
Priority: --- Keywords: easy, patch, patch-ready
Version: LatestFlags: bugzilla: maintainer-feedback? (gnome)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fixes gimptool to install plugins into the actual plugin-directory none

Description Christoph Moench-Tegeder freebsd_committer freebsd_triage 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 freebsd_triage 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:
gimpplugindir="$libdir/$PACKAGE/gimp_plugin_version"

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.
-gimpplugindir="$libdir/$PACKAGE/2.0"
+gimpplugindir="$libexecdir/$PACKAGE/2.2"

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
/home/lantw44/gnome/devinstall/lib/gimp/2.99

$ 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 freebsd_triage 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.
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-12-27 08:47:09 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1a478727103345f3a83dd14a19c3d6c212584849

commit 1a478727103345f3a83dd14a19c3d6c212584849
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2021-12-27 08:44:47 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2021-12-27 08:46:29 +0000

    graphics/gimp-app: fixes gimptool to install plugins into the actual plugin-directory

    PR:     240154
    With hat:       desktop
    Sponsored by:   Netzkommune GmbH

 graphics/gimp-app/Makefile                           |  2 +-
 graphics/gimp-app/files/patch-tools_gimptool.c (new) | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)