From e9e33d4b4d6c7d2fc48f667c9f19ab710203228d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 13 Sep 2026 14:30:02 +0100 Subject: [PATCH] lib.sh: always sanitize xbmkver before writing this removed the need to check it in xbmk_set_version as it calls update_xbmkver, which in turn performs the same check. this increases the general reliability and safety of xbmk when recording its own version after update. Signed-off-by: Leah Rowe --- include/init.sh | 4 ---- include/lib.sh | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/init.sh b/include/init.sh index 25e2dc75..d0edb3fb 100644 --- a/include/init.sh +++ b/include/init.sh @@ -259,10 +259,6 @@ xbmk_set_version() versiondate="$(git show --no-patch --no-notes \ --pretty='%ct' HEAD)" || versiondate="$versiondate_" - if [ -z "$version" ] || [ -z "$versiondate" ]; then - err "version and/or versiondate unset" "xbmk_set_version" "$@" - fi - update_xbmkver "." relname="$projectname-$version" diff --git a/include/lib.sh b/include/lib.sh index 427a6aec..8bcfc216 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -26,6 +26,9 @@ update_xbmkver() { xbmk_sanitize_version + [ -z "${version-}${versiondate-}" ] && \ + err "version and/or versiondate unset" "update_xbmkver" "$@" + printf "%s\n" "$version" > "$1/.version" || \ err "can't write '$1'" "update_xbmkver" "$@"; :