Bug#925207: libsys-statistics-linux-perl: Sys::Statistics::Linux::DiskStats fails to parse /proc/diskstats for kernel >= v4.18

Bryan Jurish moocow.bovine at gmail.com
Thu Mar 21 09:31:53 GMT 2019


Package: libsys-statistics-linux-perl
Version: 0.66-2
Severity: normal
Tags: upstream patch

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.

Already reported upstream as https://rt.cpan.org/Ticket/Display.html?id=128904



-- System Information:
Debian Release: 9.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libsys-statistics-linux-perl depends on:
ii  libuniversal-require-perl  0.17-1
ii  perl                       5.24.1-3+deb9u5

libsys-statistics-linux-perl recommends no packages.

libsys-statistics-linux-perl suggests no packages.
-------------- next part --------------
--- Sys-Statistics-Linux-0.66/lib/Sys/Statistics/Linux/DiskStats.pm	2019-03-21 10:12:36.584677649 +0100
+++ Sys-Statistics-Linux-0.66_patched/lib/Sys/Statistics/Linux/DiskStats.pm	2019-03-21 10:13:20.236575029 +0100
@@ -239,9 +239,9 @@
 
     if (open $fh, '<', $file_diskstats) {
         while (my $line = <$fh>) {
-            #                   --      --      --      F1     F2     F3     F4     F5     F6     F7     F8    F9    F10   F11
-            #                   $1      $2      $3      $4     --     $5     --     $6     --     $7     --    --    --    --
-            if ($line =~ /^\s+(\d+)\s+(\d+)\s+(.+?)\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d+$/) {
+	    #                   --      --      --      F1     F2     F3     F4     F5     F6     F7     F8    F9    F10   F11  (F12..F15)?
+            #                   $1      $2      $3      $4     --     $5     --     $6     --     $7     --    --    --    --   (-- .. --)?
+	    if ($line =~ /^\s+(\d+)\s+(\d+)\s+(.+?)\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d+(?:(?:\s+\d+){4})?$/) {
                 for my $x ($stats{$3}) { # $3 -> the device name
                     $x->{major}   = $1;
                     $x->{minor}   = $2;


More information about the pkg-perl-maintainers mailing list