--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Please unblock package amule
It fixes a crash when statistics.dat file is empty; #683680
unblock amule/2.3.1-9
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.5-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index e7bbc9a..434084a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+amule (2.3.1-9) unstable; urgency=low
+
+ * [bd952ab] handle gracefully (ie not crashing) an empty statistics.dat file;
+ thanks to florian for the report and to Michael Stapelberg for preparing
+ the patch; Closes: #683680
+
+ -- Sandro Tosi <morph@debian.org> Sat, 04 Aug 2012 12:24:53 +0200
+
amule (2.3.1-8) unstable; urgency=low
* [27f7932] mark libupnp patch as not-needed for forward (it's a Debian
diff --git a/debian/patches/handle_empty_statistics_file.patch b/debian/patches/handle_empty_statistics_file.patch
new file mode 100644
index 0000000..f215b09
--- /dev/null
+++ b/debian/patches/handle_empty_statistics_file.patch
@@ -0,0 +1,44 @@
+Description: Cope with empty statistics.dat file
+ If, for some reason (corruption), the ~/.aMule/statistics.dat is empty, aMule
+ will refuse to start until the file is deleted. This patch catches the
+ occuring exception, logs the problem, and then continues as if the file did
+ not exist in the first place.
+Bug-Debian: http://bugs.debian.org/683680
+Last-Update: 2012-02-11
+Origin: upstream, http://www.amule.org/abugs/view.php?id=1704
+Forwarded: not-needed
+
+Index: amule/src/Statistics.cpp
+===================================================================
+--- amule.orig/src/Statistics.cpp 2012-08-04 10:44:30.564102710 +0200
++++ amule/src/Statistics.cpp 2012-08-04 10:44:39.708219780 +0200
+@@ -50,6 +50,7 @@
+ #endif
+
+ #include "amule.h" // Needed for theApp
++#include "Logger.h"
+ #include <wx/intl.h>
+
+ #ifdef __BSD__
+@@ -311,12 +312,16 @@
+
+ s_totalSent = 0;
+ s_totalReceived = 0;
+- if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
+- uint8_t version = f.ReadUInt8();
+- if (version == 0) {
+- s_totalSent = f.ReadUInt64();
+- s_totalReceived = f.ReadUInt64();
++ try {
++ if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
++ uint8_t version = f.ReadUInt8();
++ if (version == 0) {
++ s_totalSent = f.ReadUInt64();
++ s_totalReceived = f.ReadUInt64();
++ }
+ }
++ } catch (CSafeIOException e) {
++ AddLogLineN(e.what());
+ }
+
+ // Load old values from config
diff --git a/debian/patches/series b/debian/patches/series
index f473898..ad39f0c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ fallocate.diff
version_check.diff
libupnp-fix-publisherurl.patch
gcc_4.7.diff
+handle_empty_statistics_file.patch
--- End Message ---