Skip to content

fix(mem): enforce C locale for free command output parsing - #821

Open
heysion wants to merge 1 commit into
KittyKatt:masterfrom
heysion:master
Open

fix(mem): enforce C locale for free command output parsing#821
heysion wants to merge 1 commit into
KittyKatt:masterfrom
heysion:master

Conversation

@heysion

@heysion heysion commented Aug 30, 2026

Copy link
Copy Markdown

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: 行 1892: -: 语法错误:需要操作数(错误记号是 "-")
         _,met$$$$$gg.           heysion@sysnpc
      ,g$$$$$$$$$$$$$$$P.        OS: Debian 13 trixie
   ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 6.12.94+deb13-amd64
 ,$$P'              `$$$.      Uptime: 2d 12h 31m
  ',$$P       ,ggs.     `$$b:    Packages: 4669
  `d$$'     ,$P"'   .    $$$     Shell: bash
   $$P      d$'     ,    $$P     Resolution: 2560x2520
   $$:      $$.   -    ,d$$'     DE: GNOME 48.4
   $$\;      Y$b._   _,d$P'      WM: Mutter
   Y$$.    `.`"Y$$$$P"'          WM Theme: 
   `$$b      "-.__               GTK Theme: Ant [GTK2/3]
    `Y$$                         Icon Theme: Papirus-Light
     `Y$$.                       Font: Noto Sans Mono 12
       `$$b.                     Disk: 721G / 1.1T (73%)
         `Y$$b.                  CPU: Intel Core i5-1035G7 @ 8x 3.7GHz [63.0°C]
            `"Y$b._              GPU: Mesa Intel(R) Iris(R) Plus Graphics (ICL GT2)
                `""""            RAM: -

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant