mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Fix parsing of attributes
https://sourceforge.net/p/webadmin/bugs/5659/
This commit is contained in:
@@ -406,18 +406,25 @@ if ($config{'attribs'}) {
|
|||||||
push(@attribs, [ $2, $7 ]);
|
push(@attribs, [ $2, $7 ]);
|
||||||
}
|
}
|
||||||
elsif (/^\s*(\d+)\s+(\S+)\s+(0x\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
|
elsif (/^\s*(\d+)\s+(\S+)\s+(0x\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
|
||||||
# A new-style vendor attribute
|
# A new-style vendor attribute, like :
|
||||||
|
# 1 Raw_Read_Error_Rate 0x000f 130 130 039 Pre-fail Always - 4294967295
|
||||||
$doneknown = 1;
|
$doneknown = 1;
|
||||||
push(@attribs, [ $2, $10, undef, $4 ]);
|
push(@attribs, [ $2, $10, undef, $4 ]);
|
||||||
$attribs[$#attribs]->[0] =~ s/_/ /g;
|
$attribs[$#attribs]->[0] =~ s/_/ /g;
|
||||||
}
|
}
|
||||||
elsif (/^((\w+.*):\s+([0-9]+(,[0-9]+)+)|(\w+.*):\s+(\d+x\d+)|(\w+.*):\s+(\d+%)|^(\w+.*):\s+(\d+))/) {
|
elsif (/^((\w+.*):\s+([0-9]+(,[0-9]+)+)|(\w+.*):\s+(\d+x\d+)|(\w+.*):\s+(\d+%)|^(\w+.*):\s+(\d+))$/) {
|
||||||
# NVME style
|
# NVME style (what is this like??)
|
||||||
$doneknown = 1;
|
$doneknown = 1;
|
||||||
push(@attribs, [ $5 || $7 || $9 || $2, $6 || $8 || $10 || $3, undef, undef ]);
|
push(@attribs, [ $5 || $7 || $9 || $2, $6 || $8 || $10 || $3, undef, undef ]);
|
||||||
}
|
}
|
||||||
|
elsif (/^([A-Z][^:]+):\s+(\S.*)$/) {
|
||||||
|
# Some other attribute like :
|
||||||
|
# Form Factor: 2.5 inches
|
||||||
|
push(@attribs, [ $1, $2 ]);
|
||||||
|
}
|
||||||
elsif (/^(\S.*\S):\s+\(\s*(\S+)\)\s*(.*)/ && !$doneknown) {
|
elsif (/^(\S.*\S):\s+\(\s*(\S+)\)\s*(.*)/ && !$doneknown) {
|
||||||
# A known attribute
|
# A known attribute, like :
|
||||||
|
# Offline data collection status: (0x02) Offline data collection activity
|
||||||
local $attrib = [ $1, $2, $3 ];
|
local $attrib = [ $1, $2, $3 ];
|
||||||
if ($lastline =~ /^\S/ && $lastline !~ /:/) {
|
if ($lastline =~ /^\S/ && $lastline !~ /:/) {
|
||||||
$attrib->[0] = $lastline." ".$attrib->[0];
|
$attrib->[0] = $lastline." ".$attrib->[0];
|
||||||
@@ -425,7 +432,8 @@ if ($config{'attribs'}) {
|
|||||||
push(@attribs, $attrib);
|
push(@attribs, $attrib);
|
||||||
}
|
}
|
||||||
elsif (/^\s+(\S.*)/ && @attribs && !$doneknown) {
|
elsif (/^\s+(\S.*)/ && @attribs && !$doneknown) {
|
||||||
# Continuation of a known attribute description
|
# Continuation of a known attribute description, like :
|
||||||
|
# was completed without error.
|
||||||
local $cont = $1;
|
local $cont = $1;
|
||||||
local $ls = $attribs[$#attribs];
|
local $ls = $attribs[$#attribs];
|
||||||
if ($ls->[2] =~ /\.\s*$/) {
|
if ($ls->[2] =~ /\.\s*$/) {
|
||||||
|
|||||||
Reference in New Issue
Block a user