kisslinux / kiss

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

pkg_find: Don't search in "/" #211

Closed git-bruh closed 3 years ago

git-bruh commented 3 years ago
# mkdir /kiss
$ kiss b kiss
-> Resolving dependencies
-> Building: kiss
-> kiss Checking repository files
ERROR Version file not found

$ kiss s kiss
/kiss
/home/testuser/kiss/grepo/core/kiss
/var/db/kiss/installed/kiss

$ echo $KISS_PATH
:/home/testuser/kiss/kiss-repo/optim...
cemkeylan commented 3 years ago

: is a separator, it separates your directories. If your path starts with the separator, and this is also the same for many programs as using the UNIX PATH, you are saying to the package manager that there is an empty string as your first path.

You should not start any of your *PATH variables with a separator, you can replicate this problem with PATH as well.

cd /
export PATH=:$PATH
:> testcmd
chmod +x testcmd
command -v testcmd

If you think that this should be changed in the package manager regardless, you can simplify the code change by only adding [ "$path" ] || continue

for path in $KISS_PATH "${what:-$sys_db}"; do set +f
    [ "$path" ] || continue
    for path2 in "$path/"$query; do
        test "${what:--d}" "$path2" && set -f -- "$@" "$path2"
    done
done
git-bruh commented 3 years ago

Thanks for the info @cemkeylan, i made the PR because the official install guide made the KISS_PATH start with : due to it being empty on the first definition:

export KISS_PATH=' '
KISS_PATH=$KISS_PATH:$HOME/repos/personal/games

I'll close this since it's a problem with KISS_PATH not being set properly, not the package manager.

cemkeylan commented 3 years ago

Yeah, the documentation on this should be fixed, really.