From 6c8e73ae2f8a2dfacb63d892ff676a0dee125777 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz Date: Apr 05 2021 08:03:23 +0000 Subject: subr.rtl/rtl_fetch.subr:rtl_fetch_url_wget(): log actual SHA256 message digest of downloaded file on hash mismatch. --- diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr index 255c23f..1b230b9 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