From 764acdcde76a3ae9eeb7eaf0b7514c1d5d1dc310 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 5 Oct 2021 07:37:01 +0300 Subject: [PATCH] kiss: Fix #279 --- kiss | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kiss b/kiss index 220e062..fb6b842 100755 --- a/kiss +++ b/kiss @@ -153,15 +153,14 @@ pkg_owner() { resolve_path() { _rpath=$KISS_ROOT/${1#/} - # Attempt to resolve symlinks by using 'cd'. - # If this fails, fallback to the file's parent - # directory. - cd -P "${_rpath%/*}" 2>/dev/null || PWD=${_rpath%/*} + if cd -P "${_rpath%/*}" 2>/dev/null; then + _parent=$PWD + cd "$OLDPWD" + else + _parent=${_rpath%/*} + fi - # Final resolved path. - _rpath=${PWD#"$KISS_ROOT"}/${_rpath##*/} - - cd "$OLDPWD" + _rpath=${_parent#"$KISS_ROOT"}/${_rpath##*/} } run_hook() {