From 6c8e73ae2f8a2dfacb63d892ff676a0dee125777 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?=
 <lucio@lucioillanes.de>
Date: Mon, 5 Apr 2021 09:03:23 +0100
Subject: subr.rtl/rtl_fetch.subr:rtl_fetch_url_wget(): log actual SHA256
 message digest of downloaded file on hash mismatch.

---
 subr.rtl/rtl_fetch.subr | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr
index 255c23f0..1b230b9d 100644
--- a/subr.rtl/rtl_fetch.subr
+++ b/subr.rtl/rtl_fetch.subr
@@ -128,8 +128,14 @@ rtl_fetch_url_wget() {
 				rtl_log_msg warning "Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"\
 						"${_url}" "${_sha256sum_src}";
 			else
-				rtl_log_msg fatal "Error: hash mismatch for URL \`%s' (from build variables: %s.)"\
-						"${_url}" "${_sha256sum_src}";
+				if _sha256sum_target="$(sha256sum "${_target_fname_full}" |\
+							awk '{print $1}' 2>/dev/null)"; then
+					rtl_log_msg fatal "Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"\
+							"${_url}" "${_sha256sum_src}" "${_sha256sum_target}";
+				else
+					rtl_log_msg fatal "Error: hash mismatch for URL \`%s' (should be: %s.)"\
+							"${_url}" "${_sha256sum_src}";
+				fi;
 				rtl_fileop rm "${_target_fname_full}"; break;
 			fi; ;;
 		*)	if [ "${_urls_count}" -ge 1 ]; then
-- 
cgit v1.2.3