commit 3c83974160199d5184f491ae2588c757e977a1e9 parent 7396406513996799c852671239d61ac0a40087d6 Author: Cem Keylan <cem@ckyln.com> Date: Thu, 14 May 2020 17:08:17 +0300 kiss-owns: only read the link for the directory, not the file itself Diffstat:
M | contrib/kiss-owns | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/contrib/kiss-owns b/contrib/kiss-owns @@ -5,7 +5,9 @@ case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-owns <file>" ; exit 0 ; es # Strip 'KISS_ROOT' from the file path if passed and # follow symlinks. -file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}") +file="${1#$KISS_ROOT}" +dirname=$(kiss-readlink "$KISS_ROOT/{$file%/*}") +file="$dirname/${file##*/}" # Check if the file exists and exit if it is not. [ -f "$file" ] || { @@ -17,7 +19,7 @@ file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}") # Print the full path to the manifest file which contains # the match to our search. -pkg_owns=$(grep -lFx "${file##$KISS_ROOT}" \ +pkg_owns=$(grep -lFx "${file#$KISS_ROOT}" \ "$KISS_ROOT/var/db/kiss/installed/"*/manifest)