Bug Fixes!!! Continuing internal refactor!!

This bug report came in right after 3.2.00 went out live, but I would never have
found it myself in testing so better found than not found!

Bugs:

1. A bug was introduced to dmidecode data handlers in 3.2.00 resulted in the
dmidecode data array basically eating itself up until errors appear. Quite difficult
to trigger, but babydr from Slackware forums figured it out, using -F --dmidecode
to force dmidecode use for all features that support it triggered thee bug always.
This was a result of the refactor, previously inxi had worked on copies of referenced
arrays, but in this case, it was working on the original array of arrays, subtle,
but obvious. This method was only used on dmidecode arrays.

2. A second bug was exposed almost by accident, for -M --dmidecode data, there was
a missing field and also a missing is set test on that field that led to an error
of using undefined value in string comparison. This was strictly speaking 2 bugs,
both very old, from 2.9 first rewrite, one failing to set/get the value, and the
other failing to test if the value was set before using it.

Fixes:

1. There were a few glitches in help menu and man page related to -L option, those
are corrected.

INTERNAL CODE CHANGES:
1. removed bug inducing splice use in some cases, and added parens to splice to make
it fit the new way of with perl builtins, when taking 2 or more arguments, use parens.

2. Found many more instances to add -> dereferencing operator. I have to say, not
doing that consistently made the code much harder to read, and created situations
where it's somewhat ambiguous what item belongs to what, with everything consistently
-> operator run, the code is more clear and obvious, and some of the hacks I'd added
because of the lack of clarity were also removed.

3. Removed explicit setting of hash references with null value, that was done out
of failure to use -> operators which clearly indicate to Perl and coder what is
happening, so those crutches were removed. Also got rid of unnecessary array
priming like: my @array = (); Some of these habits came from other languages,
but in Perl, declaring my @array means it's an array that is null, and you don't
need to do a further (). @array = () is obviously fine for resetting arrays in
loops or whatever, but not in the initial declaration.
This commit is contained in:
Harald Hope 2020-12-17 14:51:11 -08:00
parent 9503a0010e
commit df45e6d4ae
3 changed files with 763 additions and 715 deletions

1410
inxi

File diff suppressed because it is too large Load diff

11
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2020\-12\-15" inxi "inxi manual" .TH INXI 1 "2020\-12\-17" inxi "inxi manual"
.SH NAME .SH NAME
inxi \- Command line system information script for console and IRC inxi \- Command line system information script for console and IRC
@ -296,7 +296,7 @@ use: \fB\-pl\fR.
.TP .TP
.B \-L\fR, \fB\-\-logical\fR .B \-L\fR, \fB\-\-logical\fR
Show Logical volume information, for LVM, LUKS, bcache, MultiPath, etc. Shows Show Logical volume information, for LVM, LUKS, bcache, etc. Shows
size, free space (for LVM VG). For LVM, shows \fBDevice\-[xx]: VG:\fR size, free space (for LVM VG). For LVM, shows \fBDevice\-[xx]: VG:\fR
(Volume Group) size/free, \fBLV\-[xx]\fR (Logical Volume). LV shows type, (Volume Group) size/free, \fBLV\-[xx]\fR (Logical Volume). LV shows type,
size, and components. Note that components are made up of either containers size, and components. Note that components are made up of either containers
@ -364,10 +364,9 @@ devices (p\-1) sdj2 and sdk2.
size: 12.79 GiB\fR size: 12.79 GiB\fR
.fi .fi
Other types of logical block handling like LUKS, bcache, multipath, Other types of logical block handling like LUKS, bcache show as:
show as:
\fBDevice\-[xx] [name/id] type: [LUKS|Crypto|bcache|MultiPath]:\fR \fBDevice\-[xx] [name/id] type: [LUKS|Crypto|bcache]:\fR
.TP .TP
.B \-m\fR,\fB \-\-memory\fR .B \-m\fR,\fB \-\-memory\fR
@ -402,7 +401,7 @@ are different, you will see this instead:
\fBspeed: spec: [specified speed] MT/S actual: [actual] MT/S\fR \fBspeed: spec: [specified speed] MT/S actual: [actual] MT/S\fR
Also, if DDR, and speed in MHz, will change to: \fBspeed: [speed] MT/S ([speed] MHz\fR Also, if DDR, and speed in MHz, will change to: \fBspeed: [speed] MT/S ([speed] MHz)\fR
If the detected speed is logically absurd, like 1 MT/s or 69910 MT/s, adds: If the detected speed is logically absurd, like 1 MT/s or 69910 MT/s, adds:
\fBnote: check\fR. Sample: \fBnote: check\fR. Sample:

View file

@ -1,3 +1,60 @@
=====================================================================================
Version: 3.2.01
Patch: 00
Date: 2020-12-17
-----------------------------------
Changes:
-----------------------------------
Bug Fixes!!! Continuing internal refactor!!
This bug report came in right after 3.2.00 went out live, but I would never have
found it myself in testing so better found than not found!
Bugs:
1. A bug was introduced to dmidecode data handlers in 3.2.00 resulted in the
dmidecode data array basically eating itself up until errors appear. Quite difficult
to trigger, but babydr from Slackware forums figured it out, using -F --dmidecode
to force dmidecode use for all features that support it triggered thee bug always.
This was a result of the refactor, previously inxi had worked on copies of referenced
arrays, but in this case, it was working on the original array of arrays, subtle,
but obvious. This method was only used on dmidecode arrays.
2. A second bug was exposed almost by accident, for -M --dmidecode data, there was
a missing field and also a missing is set test on that field that led to an error
of using undefined value in string comparison. This was strictly speaking 2 bugs,
both very old, from 2.9 first rewrite, one failing to set/get the value, and the
other failing to test if the value was set before using it.
Fixes:
1. There were a few glitches in help menu and man page related to -L option, those
are corrected.
INTERNAL CODE CHANGES:
1. removed bug inducing splice use in some cases, and added parens to splice to make
it fit the new way of with perl builtins, when taking 2 or more arguments, use parens.
2. Found many more instances to add -> dereferencing operator. I have to say, not
doing that consistently made the code much harder to read, and created situations
where it's somewhat ambiguous what item belongs to what, with everything consistently
-> operator run, the code is more clear and obvious, and some of the hacks I'd added
because of the lack of clarity were also removed.
3. Removed explicit setting of hash references with null value, that was done out
of failure to use -> operators which clearly indicate to Perl and coder what is
happening, so those crutches were removed. Also got rid of unnecessary array
priming like: my @array = (); Some of these habits came from other languages,
but in Perl, declaring my @array means it's an array that is null, and you don't
need to do a further (). @array = () is obviously fine for resetting arrays in
loops or whatever, but not in the initial declaration.
-----------------------------------
-- Harald Hope - Thu, 17 Dec 2020 14:27:13 -0800
===================================================================================== =====================================================================================
Version: 3.2.00 Version: 3.2.00
Patch: 00 Patch: 00