From 1fac60edb957801368713cae35a78a6c3ee5bed8 Mon Sep 17 00:00:00 2001 From: Heysion Yuan Date: Sun, 30 Aug 2026 22:04:32 +0800 Subject: [PATCH] fix(mem): enforce C locale for free command output parsing Prefix the free command with LC_ALL=C in detectmem() so that its output format stays consistent regardless of the user's locale, preventing awk parsing from breaking on localized environments. Log: Fix locale-dependent memory detection parsing on Linux Influence: 1. Memory detection output on non-English Linux locales 2. RAM usage display correctness in detectmem() Linux branch --- screenfetch-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screenfetch-dev b/screenfetch-dev index d95f9ade..92aad741 100755 --- a/screenfetch-dev +++ b/screenfetch-dev @@ -1888,7 +1888,7 @@ detectmem () { #done #usedmem=$((usedmem / 1024)) #totalmem=$((totalmem / 1024)) - mem=$(free -b | "${AWK}" -F ':' 'NR==2{print $2}' | "${AWK}" '{print $1"-"$6}') + mem=$(LC_ALL=C free -b | "${AWK}" -F ':' 'NR==2{print $2}' | "${AWK}" '{print $1"-"$6}') usedmem=$((mem / 1024 / 1024)) totalmem=$((${mem//-*} / 1024 / 1024)) fi