From 8f2d6a7cbde94a12ce0f2191df59b3209f0bc397 Mon Sep 17 00:00:00 2001 From: kitadmin Date: Thu, 23 Jul 2026 03:29:10 +0000 Subject: [PATCH] fix: sanitize _mtime with tr to prevent ash arithmetic crash on Synology stat output can include non-numeric chars on some RT2600ac firmware versions, causing 0 to fail. Strip with tr -cd '0-9' before arithmetic. Co-Authored-By: Claude Sonnet 4.6 --- .../kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh b/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh index b7c97b3..8d86ab5 100755 --- a/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh +++ b/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh @@ -207,6 +207,7 @@ _detect_wan_roles() { _aiwanbal_available() { [ -d "$AIWANBAL_DIR" ] || return 1 _mtime=$(stat -c %Y "${AIWANBAL_DIR}/wan1_score_avg" 2>/dev/null || stat -f %m "${AIWANBAL_DIR}/wan1_score_avg" 2>/dev/null) + _mtime=$(printf '%s' "$_mtime" | tr -cd '0-9') [ -n "$_mtime" ] || return 1 _now=$(date +%s) _age=$(( _now - _mtime )) @@ -415,6 +416,7 @@ _cached_speedtest() { _f="${STATE_DIR}/speedtest-result-${_iface}" [ -f "$_f" ] || return 1 _mtime=$(stat -c %Y "$_f" 2>/dev/null || stat -f %m "$_f" 2>/dev/null) + _mtime=$(printf '%s' "$_mtime" | tr -cd '0-9') [ -n "$_mtime" ] || return 1 _st_now=$(date +%s) _age=$(( _st_now - _mtime ))