Bug#925207: libsys-statistics-linux-perl: Sys::Statistics::Linux::DiskStats fails to parse /proc/diskstats for kernel >= v4.18
Florian Schlichting
fsfs at debian.org
Thu Mar 21 20:17:49 GMT 2019
Severity: important
thanks
On Thu, Mar 21, 2019 at 10:31:53AM +0100, Bryan Jurish wrote:
> According to https://www.kernel.org/doc/Documentation/iostats.txt, 4 new fields
> were added to /proc/diskstats for kernel version 4.18. As a result, device
> names and the "old" attribute fields are misparsed by the (very narrow) regexes
> in Sys/Statistics/Linux/DiskStats.pm . The attached patch appears to fix the
> problem.
The bug becomes visible when calling e.g.
$ perl -MData::Printer -MSys::Statistics::Linux::DiskStats -E'my $lxs = Sys::Statistics::Linux::DiskStats->new; $lxs->init; p $lxs->get;
The correct output will contain paragraphs like this:
sda1 {
major 8,
minor 1,
rdbyt 0.00,
rdreq 0.00,
ttbyt 0.00,
ttreq 0.00,
wrtbyt 0.00,
wrtreq 0.00
},
However on buster currently, output looks like this (notice the "device
name"):
'sda1 3352 39 102172 153321' {
major 8,
minor 1,
rdbyt 0.00,
rdreq 0.00,
ttbyt 0.00,
ttreq 0.00,
wrtbyt 0.00,
wrtreq 0.00
},
The patch from Bryan Jurish (thanks!) correctly fixes this issue for the
buster kernel, however to prevent this from happening again I think the
device name regex should make sure to never match the field separator,
by using (\S+) instead of (.+?) for example.
Florian
More information about the pkg-perl-maintainers
mailing list