Package: workrave Version: 1.10.4-3 Severity: wishlist Tags: patch This is a followup for bug#825982.
The scripts mentionned in that bug report don't actually work so well, so I have made the following patch so that the collection script actually runs properly and that it deals with corrupted data a little better. --- workrave-1.10.15.orig/contrib/plot/workrave-dump +++ workrave-1.10.15/contrib/plot/workrave-dump @@ -1,6 +1,8 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; +use warnings::register; use integer; use POSIX qw(strftime); use Time::Local; @@ -51,13 +53,18 @@ sub dumpdata($$$$$) { my ($tmdate, $break, $misc, $breakstats, $miscstats) = @_; - die "No timestamp at line $.\n" if !defined($tmdate); - die "No breaks at line $.\n" if !defined($break); + warnings::warn "No timestamp at line $.\n" if !defined($tmdate); + warnings::warn "No breaks at line $.\n" if !defined($break); foreach my $breaktype (0..2) { - die "No breaktype #$breaktype at line $.\n" - if !defined($break->{$breaktype}); + if (!defined($break->{$breaktype})) { + warnings::warn "No breaktype #$breaktype at line $.\n"; + return; + } } - die "No misc at line $.\n" if !defined($misc); + warnings::warn "No misc at line $.\n" if !defined($misc); + if (!defined($tmdate) || !defined($break) || !defined($misc)) { + return; + } my $ts = strftime("%Y%m%d%H%M", gmtime(timegm(0, @$tmdate{qw(min hour mday mon year)}))); @@ -85,7 +92,7 @@ my $step = 24 * 3600; # 24-hr steps my $heartbeat = 4 * $step; my (@DS); -my @breaktypes qw(micro rest daily); +my @breaktypes = qw(micro rest daily); foreach my $breaktype (@breaktypes) { foreach my $breakstat (@breakstats) { my $key = "$breaktype$breakstat"; @@ -106,6 +113,7 @@ my ($tmdate, $break, $misc) = (undef, un open(SOURCE, $source) or die "open $source: $!\n"; while (<SOURCE>) { chomp; + s/^\0*//; # remove corrupted data if (/^WorkRaveStats 4$/) { # Ignore header next; -- System Information: Debian Release: 8.5 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable'), (1, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.5.0-0.bpo.2-amd64 (SMP w/2 CPU cores) Locale: LANG=fr_CA.UTF-8, LC_CTYPE=fr_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages workrave depends on: ii gconf-service 3.2.6-3 ii libatk1.0-0 2.14.0-1 ii libatkmm-1.6-1 2.22.7-2.1 ii libc6 2.19-18+deb8u4 ii libcairo-gobject2 1.14.0-2.1+deb8u1 ii libcairo2 1.14.0-2.1+deb8u1 ii libcairomm-1.0-1 1.10.0-1.1 ii libdbusmenu-glib4 12.10.2-1 ii libdbusmenu-gtk3-4 12.10.2-1 ii libgcc1 1:4.9.2-10 ii libgconf-2-4 3.2.6-3 ii libgdk-pixbuf2.0-0 2.31.1-2+deb8u5 ii libgdome2-0 0.8.1+debian-6 ii libglib2.0-0 2.42.1-1+b1 ii libglibmm-2.4-1c2a 2.42.0-1 ii libgstreamer0.10-0 0.10.36-1.5 ii libgtk-3-0 3.14.5-1+deb8u1 ii libgtkmm-3.0-1 3.14.0-1 ii libice6 2:1.0.9-1+b1 ii libindicator3-7 0.5.0-2 ii libpanel-applet-4-0 3.8.1-7+b1 ii libpango-1.0-0 1.36.8-3 ii libpangocairo-1.0-0 1.36.8-3 ii libpangomm-1.4-1 2.34.0-1.1 ii libpulse-mainloop-glib0 5.0-13 ii libpulse0 5.0-13 ii libsigc++-2.0-0c2a 2.4.0-1 ii libsm6 2:1.2.2-1+b1 ii libstdc++6 4.9.2-10 ii libx11-6 2:1.6.2-3 ii libxml2 2.9.1+dfsg1-5+deb8u1 ii libxss1 1:1.2.2-1 ii libxtst6 2:1.2.2-1+b1 ii multiarch-support 2.19-18+deb8u4 ii workrave-data 1.10.4-3 workrave recommends no packages. Versions of packages workrave suggests: ii gnome-panel 3.8.1-7+b1 ii gnome-shell 3.14.4-1~deb8u1 -- Configuration Files: /etc/sound/events/workrave.soundlist 5948a761ed3cc48d661d99c7e230587f [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/sound/events/workrave.soundlist 5948a761ed3cc48d661d99c7e230587f' -- no debconf information