kisslinux / kiss

KISS Linux - Package Manager
https://kisslinux.github.io
MIT License
464 stars 62 forks source link

kiss owns broken with bash #209

Closed jedahan closed 3 years ago

jedahan commented 3 years ago

so bash allows us to use kiss alternatives to set /bin/sh

but then kiss owns just exits with -1. I was not able to debug further

jedahan commented 3 years ago

Thanks to @E5ten , this patch fixes it:

diff --git a/contrib/kiss-owns b/contrib/kiss-owns
index 44ea546..aa37efd 100755
--- a/contrib/kiss-owns
+++ b/contrib/kiss-owns
@@ -4,7 +4,7 @@
 # Follow symlinks to any paths.
 case $1 in
     /*)
-        cd -P "$KISS_ROOT/${1%/*}"
+        cd -P "$KISS_ROOT${1%/*}"
     ;;

     */*)
E5ten commented 3 years ago

Just to explain the reason this change is needed for it to work with bash, in this case $1 starts with a slash, so when $KISS_ROOT is /, which gets removed by kiss itself because kiss removes trailing slashes from $KISS_ROOT, the command becomes cd -P //path. POSIX says that a leading // can be treated specially, and bash does treat it specially, so later on when $PWD is being used, it expands to //path instead of /path, so the grep does not find matches.