dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
22.13k stars 1.66k forks source link

Error with showing ram usage #2176

Closed Zbysiu3cytryny closed 2 years ago

Zbysiu3cytryny commented 2 years ago
Chikmyvoltage commented 2 years ago

00036280: value too great for base (error token is "00036280")

Looking into this, I believe it thinks its octal because of the leading zero when parsing /proc/meminfo... but the input is decimal and padded with zeros.

One way to fix this is to strip the leading zeros within the script.

Please apply this diff and report:

--- /usr/bin/neofetch   2022-08-20 03:17:00.242076721 +0300
+++ /usr/bin/neofetch.bak   2022-08-20 03:17:26.740413196 +0300
@@ -2540,6 +2540,7 @@
             # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
             # Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
             while IFS=":" read -r a b; do
+               b=${b#"${b%%[1-9]*}"}
                 case $a in
                     "MemTotal") ((mem_used+=${b/kB})); mem_total="${b/kB}" ;;
                     "Shmem") ((mem_used+=${b/kB}))  ;;
Zbysiu3cytryny commented 2 years ago

00036280: value too great for base (error token is "00036280")

Looking into this, I believe it thinks its octal because of the leading zero when parsing /proc/meminfo... but the input is decimal and padded with zeros.

One way to fix this is to strip the leading zeros within the script.

Please apply this diff and report:

--- /usr/bin/neofetch 2022-08-20 03:17:00.242076721 +0300
+++ /usr/bin/neofetch.bak 2022-08-20 03:17:26.740413196 +0300
@@ -2540,6 +2540,7 @@
             # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
             # Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
             while IFS=":" read -r a b; do
+             b=${b#"${b%%[1-9]*}"}
                 case $a in
                     "MemTotal") ((mem_used+=${b/kB})); mem_total="${b/kB}" ;;
                     "Shmem") ((mem_used+=${b/kB}))  ;;

Thanks for help, but kernel maintainer fixed that problem some time ago