From a01ce3abb49520170aa17b2b521214b182bb9bb3 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 1 Sep 2024 17:17:14 +0200 Subject: [PATCH] v9.8 - META | DietPi-Survey_report: Work around current bug in bash's printf function. Use mawk for now: https://bugs.debian.org/1078556 --- .meta/dietpi-survey_report | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 0c4e7c5a02..2b7870e730 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -791,7 +791,7 @@ shopt -s extglob eval "software=\${aSOFTWARE_NAME${version/./_}[$software]}" if [[ ! $software ]] then - echo "Invalid software ID for DietPi version $version" + echo "Invalid software ID \"$software\" for DietPi version $version" mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/ return 1 fi @@ -1005,9 +1005,12 @@ shopt -s extglob # Work out averages # - Divide CPU times by 100 and scale to revert decimal point removal - aBENCH_RESULT_CPU_MIN[i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MIN[i]}e-2") - aBENCH_RESULT_CPU_MAX[i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MAX[i]}e-2") - aBENCH_RESULT_CPU_AVG[i]=$(printf '%.2f' "$((${aBENCH_RESULT_CPU_AVG[i]}*10/${aBENCH_CPU_INDEX[i]}+1))e-3") + #aBENCH_RESULT_CPU_MIN[i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MIN[i]}e-2") + #aBENCH_RESULT_CPU_MAX[i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MAX[i]}e-2") + #aBENCH_RESULT_CPU_AVG[i]=$(printf '%.2f' "$((${aBENCH_RESULT_CPU_AVG[i]}*10/${aBENCH_CPU_INDEX[i]}+1))e-3") + aBENCH_RESULT_CPU_MIN[i]=$(mawk "{printf \"%.2f\", ${aBENCH_RESULT_CPU_MIN[i]}e-2}" <<< '') + aBENCH_RESULT_CPU_MAX[i]=$(mawk "{printf \"%.2f\", ${aBENCH_RESULT_CPU_MAX[i]}e-2}" <<< '') + aBENCH_RESULT_CPU_AVG[i]=$(mawk "{printf \"%.2f\", $((${aBENCH_RESULT_CPU_AVG[i]}*10/${aBENCH_CPU_INDEX[i]}+1))e-3}" <<< '') # CPU temps if available aBENCH_RESULT_CPU_TEMP_START_MIN[i]='N/A'