From ff1486dfe23b58c9dbb29a133625fe71a6c85b05 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Feb 2026 11:25:56 -0500 Subject: [PATCH] Replace bc with awk for floating point comparison Use awk BEGIN block for comparing Ceph OSD reweight values instead of bc. Awk is more universally available and the previous fallback to "echo 0" could incorrectly evaluate to true. Fixes: https://code.lotusguild.org/LotusGuild/driveAtlas/issues/4 Co-Authored-By: Claude Opus 4.5 --- driveAtlas.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driveAtlas.sh b/driveAtlas.sh index 9e139c2..1d53f33 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -486,7 +486,8 @@ for bay in $(printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^[0-9]+$' | sort -n); d [[ -z "$reweight" ]] && reweight="0" # Determine in/out based on reweight (1.0 = in, 0 = out) - if (( $(echo "$reweight > 0" | bc -l 2>/dev/null || echo 0) )); then + # Use awk for floating point comparison (more portable than bc) + if awk "BEGIN {exit !($reweight > 0)}"; then in_status="in" else in_status="out"