resolve symbolic links to the idp executable

Issue #656 resolved
Ingmar Dasseville created an issue

when a symbolic link to idp is made in /usr/local/bin, idp doesn't run because it searches for the kbs executable in that directory.

ingmar@42 ~> idp
/usr/local/bin/idp: line 6: /usr/local/bin/kbs: No such file or directory

This can be resolved by replacing

DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

with

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

in the idp startup-script

Comments (10)

  1. Broes De Cat

    Why does this not work? I have a symbolic link in /home/broes/bin/idp, also without kbs in that directory and it runs just fine?

  2. Broes De Cat

    I also do not agree that such a fix is merged without looking into whether it behaves the same on osx and windows.

  3. Bart Bogaerts

    Trouwens... Ik heb dit getest en op barrel had ik hetzelfde probleem als ingmar: symbolische links werden niet geresolved... Na de fix wel

  4. Log in to comment