From 7e9e227873d85adbceca07bd8b9f635853b10f1c Mon Sep 17 00:00:00 2001 From: git-bruh Date: Sun, 11 Sep 2022 14:42:44 +0530 Subject: [PATCH] ignore /lib and /usr/lib --- kiss | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/kiss b/kiss index 570657f..600a8cf 100755 --- a/kiss +++ b/kiss @@ -647,18 +647,28 @@ pkg_strip() { esac done < "$pkg_dir/$1/$pkg_db/$1/manifest" || : } +strstrip() { + # Intentional, globbing disabled. + # shellcheck disable=2086 + { IFS=$1; set -- $2; unset IFS; } + + for split do + ok "$split" && printf '%s' "$split" + done +} + should_ignore_rpath() { # Intentional, globbing disabled. # shellcheck disable=2086 { IFS=:; set -- $1; unset IFS; } for path do - # TODO maybe check if the RPATH is set to a redundant value - # like /lib or /usr/lib ? # ORIGIN is relative - no need to ignore it. + # Also ignore /lib and /usr/lib as they're pretty much + # guaranteed to be present in the dynamic linker's search path # Library rpath: [$ORIGIN/../lib] # shellcheck disable=2016 - case $path in '$ORIGIN'*|'${ORIGIN}'*) continue; esac + case $(strstrip '/' "$path") in '$ORIGIN'*|'${ORIGIN}'*|'lib'|'usrlib') continue; esac # Non-relative path, should be ignored. return 0 done