From 56225e7508fceab1bf1c03b614f85ae60b05229d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 28 May 2025 18:43:44 +0100 Subject: tree.sh: add sha512 error for check_project_hashes handle errors on sha512sum - also handle awk errors inside the mini subshell, and provide overall error handling. we know that the project.hash file should always exist, and always be read no matter what; technically, the find command that proceeds it might not yield any results, but an empty file would then be produced. the edge case of an empty file would have lead to an error beforehand, when configuring the project in function, configure_project(), so we've already got that covered. Signed-off-by: Leah Rowe --- include/tree.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/tree.sh') diff --git a/include/tree.sh b/include/tree.sh index 3e80c333..f945cc7c 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -174,7 +174,8 @@ check_project_hashes() -type f -not -path "*/.git*/*" | awk '{print $1}' > \ "$xbtmp/project.hash" || err "!h $project $tree" - pjhash="$(sha512sum "$xbtmp/project.hash" | awk '{print $1}')" || : + pjhash="$(x_ sha512sum "$xbtmp/project.hash" | awk '{print $1}' || \ + err)" || err "pjhash: Can't read sha512 of '$xbtmp/project.hash'" [ "$pjhash" != "$old_pjhash" ] && badhash="y" [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" -- cgit v1.2.1