sysinfo.pl: fix memory usage on kernel >= 6.x, auto-scale units - #610
Closed
TehPeGaSuS wants to merge 1 commit into
Closed
sysinfo.pl: fix memory usage on kernel >= 6.x, auto-scale units#610TehPeGaSuS wants to merge 1 commit into
TehPeGaSuS wants to merge 1 commit into
Conversation
The kernel version regex only matched majors 3-5, so on kernel 6.x/7.x neither $l26 nor $l3 got set and memoryusage() fell through to a stale vmstat-style branch that reads $vara/$vard as uninitialized, causing 'Illegal division by zero' (closes weechat#581). Also show memory/disk usage with an auto-scaled unit (B/KB/MB/GB/TB) instead of always hardcoding MB/GB.
TehPeGaSuS
force-pushed
the
fix-sysinfo-kernel-memory-detection
branch
from
September 5, 2026 16:45
8f75104 to
bd1e3f8
Compare
Member
|
Thanks, merged! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The kernel version detection regex only matched majors 3-5:
On kernel 6.x/7.x neither
$l26nor$l3gets set, somemoryusage()fallsthrough to the old vmstat-style branch which reads garbage from
$vara/$vard,causing the uninitialized-value warnings and "Illegal division by zero" from
#581.
This patch:
human_size()helper and uses it for both memory and diskusage output, so results are auto-scaled (B/KB/MB/GB/TB) instead of always
hardcoded to MB/GB
Tested on kernel 7.0.0,
/sysinfo memoryand/sysinfo diskboth work asexpected.
Closes #581