Gimp 2.10.10 build for OSX unable to be started using a symlink
GIMP version: gimp-2.10.10-x86_64.dmg
Operating System: OS X High Sierra (10.13.6)
Package: Official DMG
Description
Being a very command-line oriented person, I often create symlinks to start my OSX apps (especially if I might want to supply command-line arguments) via something like:
ln -s ~/Desktop/GIMP-2.10.app/Contents/MacOS/gimp ~/bin/gimp
However, this doesn't work with the gimp startup script due to there being a use of dirname $0
to determine where gimp is installed, which isn't correct if it's a symlink.
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Install gimp to user
Desktop/
folder (or elsewhere) - Create a symlink in some binary folder in your path to the
gimp
start script - Try to start gimp using that symlink (or with multiple layers of symlinks or symlinked dirs)
Expected result:
Gimp should start up.
Actual result:
/Users/user/bin/gimp: line 43: /Users/user/bin/gimp-bin: No such file or directory
/Users/user/bin/gimp: line 43: exec: /Users/user/bin/gimp-bin: cannot execute: No such file or directory
Additional information
This isn't a perfect solution, since realpath
isn't installed by default on OSX, but the workaround I used (which also resolves #3053 (moved)) was changing the gimp
shell script as follows (unified diff):
--- gimp.orig 2019-04-08 06:20:16.000000000 -0500
+++ gimp 2019-04-24 15:54:12.000000000 -0500
@@ -18,9 +18,7 @@
# export DYLD_PRINT_DOFS=1
# export DYLD_PRINT_RPATHS=1
-BASEDIR=$(dirname "$0")
-
-cd "$BASEDIR"
+BASEDIR=$(dirname `realpath "$0"`)
export PATH="${BASEDIR}:$PATH"
export GTK_PATH="${BASEDIR}/../Resources/lib/gtk-2.0/2.10.0"
@@ -40,6 +38,6 @@
shift 1
fi
-exec ./gimp-bin "$@"
+exec ${BASEDIR}/gimp-bin "$@"