kiss: fix bugs

- Fixed ldd mode not working.
- Fixed too strict argument validation (need to use IFS).
This commit is contained in:
Dylan Araps 2021-07-06 22:45:50 +03:00
parent 018c362a5f
commit 2008f7478e
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 10 additions and 13 deletions

23
kiss
View File

@ -528,11 +528,8 @@ pkg_fix_deps() {
find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null | find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null |
while read -r _fix_file; do while read -r _fix_file; do
ldd_buf=$(ldd -- "$_fix_file" 2>/dev/null) || ldd_buf=$(ldd -- "$_fix_file" 2>/dev/null) || continue
continue elf_buf=$("$cmd_elf" -d "$_fix_file" 2>/dev/null) || elf_buf=$ldd_buf
elf_buf=${cmd_elf:+"$("$cmd_elf" -d "$_fix_file" 2>/dev/null)"} ||
continue
while read -r line || [ "$line" ]; do while read -r line || [ "$line" ]; do
case $line in *NEEDED*\[*\] | *'=>'*) case $line in *NEEDED*\[*\] | *'=>'*)
@ -572,7 +569,7 @@ pkg_fix_deps() {
esac esac
esac esac
done <<EOF || : done <<EOF || :
${elf_buf:-"$ldd_buf"} $elf_buf
EOF EOF
done | sort -uk1,1 depends - > "$tmp_dir/.fixdeps" done | sort -uk1,1 depends - > "$tmp_dir/.fixdeps"
@ -1493,19 +1490,19 @@ args() {
# not be used here as they would conflict with kiss extensions. # not be used here as they would conflict with kiss extensions.
case $action in case $action in
a|alternatives) a|alternatives)
case $1 in *\**|*\!*|*\[*|*\]*|*' '*|*/*) case $1 in *\**|*\!*|*\[*|*\]*|*/*)
die "Invalid argument: '!*[] /' ($1)" die "Invalid argument: '!*[]/' ($1)"
esac esac
;; ;;
b|build|c|checksum|d|download|i|install|l|list|r|remove) b|build|c|checksum|d|download|i|install|l|list|r|remove)
case ${action%%"${action#?}"}-$* in case ${action%%"${action#?}"}-$* in
i-*\!*|i-*\**|i-*\[*|i-*\]*|i-*' '*) i-*\!*|i-*\**|i-*\[*|i-*\]*)
die "Arguments contain invalid characters: '!*[] ' ($*)" die "Arguments contain invalid characters: '!*[]' ($*)"
;; ;;
[!i]-*\!*|[!i]-*\**|[!i]-*\[*|[!i]-*\]*|[!i]-*' '*|[!i]-*/*) [!i]-*\!*|[!i]-*\**|[!i]-*\[*|[!i]-*\]*|[!i]-*/*)
die "Arguments contain invalid characters: '!*[] /' ($*)" die "Arguments contain invalid characters: '!*[]/' ($*)"
;; ;;
[!l]-) [!l]-)
@ -1715,7 +1712,7 @@ main() {
)"} || cmd_su=su )"} || cmd_su=su
# Figure out which utility is available to dump elf information. # Figure out which utility is available to dump elf information.
cmd_elf=${KISS_ELF:="$( cmd_elf=${KISS_ELF:-"$(
command -v readelf || command -v readelf ||
command -v eu-readelf || command -v eu-readelf ||
command -v llvm-readelf command -v llvm-readelf