From 16b2e1be75ae80dd2c3df4067fac45d33454f9d5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 25 Nov 2020 08:49:32 +0200 Subject: [PATCH] kiss: Fix crash caused by sh256(). Closes #204 --- kiss | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/kiss b/kiss index 73e401b..298e7b0 100755 --- a/kiss +++ b/kiss @@ -113,17 +113,19 @@ sh256() { # All utilities must match 'sha256sum' output. # # Example: ' ' - [ -f "$1" ] || return 0 - hash=$( - sha256sum "$1" || - sha256 -r "$1" || - openssl dgst -sha256 -r "$1" || - shasum -a 256 "$1" || - digest -a sha256 "$1" - ) + # Skip non-files and broken symlinks. + if { [ -h "$1" ] && [ -e "$1" ] } || [ -f "$1" ]; then + hash=$( + sha256sum "$1" || + sha256 -r "$1" || + openssl dgst -sha256 -r "$1" || + shasum -a 256 "$1" || + digest -a sha256 "$1" + ) - printf '%s\n' "${hash%% *}" + printf '%s\n' "${hash%% *}" + fi } pkg_lint() {