--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: unblock: freeorion/0.4.8-3
- From: Markus Koschany <apo@debian.org>
- Date: Fri, 28 Jun 2019 01:50:23 +0200
- Message-id: <156167942329.29918.14504961386667208046.reportbug@spike>
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Please unblock package freeorion
Freeorion crashed when someone tried to load or save a game. We
believe this issue was resolved in version 0.4.8-3 and it would be
great if we could release Buster with this version.
This is Debian bug #930417.
Thanks,
Markus
unblock freeorion/0.4.8-3
-- System Information:
Debian Release: 10.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.9.0-9-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
diff -Nru freeorion-0.4.8/debian/changelog freeorion-0.4.8/debian/changelog
--- freeorion-0.4.8/debian/changelog 2018-08-31 17:09:10.000000000 +0200
+++ freeorion-0.4.8/debian/changelog 2019-06-23 01:52:26.000000000 +0200
@@ -1,3 +1,16 @@
+freeorion (0.4.8-3) unstable; urgency=medium
+
+ * Really fix save or load game crash. (Closes: #930417)
+
+ -- Markus Koschany <apo@debian.org> Sun, 23 Jun 2019 01:52:26 +0200
+
+freeorion (0.4.8-2) unstable; urgency=medium
+
+ * Fix save or load game crash. Thanks to Michal Mauser for the report and
+ Bernhard Übelacker for the investigation. (Closes: #930417)
+
+ -- Markus Koschany <apo@debian.org> Sun, 16 Jun 2019 01:02:41 +0200
+
freeorion (0.4.8-1) unstable; urgency=medium
* New upstream version 0.4.8.
diff -Nru freeorion-0.4.8/debian/patches/debian-bug-930417.patch freeorion-0.4.8/debian/patches/debian-bug-930417.patch
--- freeorion-0.4.8/debian/patches/debian-bug-930417.patch 1970-01-01 01:00:00.000000000 +0100
+++ freeorion-0.4.8/debian/patches/debian-bug-930417.patch 2019-06-23 01:52:26.000000000 +0200
@@ -0,0 +1,147 @@
+From: Markus Koschany <apo@debian.org>
+Date: Sun, 16 Jun 2019 01:10:41 +0200
+Subject: debian-bug-930417
+
+Bug-Debian: https://bugs.debian.org/930417
+Origin: https://github.com/freeorion/freeorion/pull/2366/commits/1e94e406fa309c60c4b68ef08b424b65a7bd0e4d
+---
+ server/SaveLoad.cpp | 70 +++++++++++++++++++++++++++++------------------------
+ 1 file changed, 39 insertions(+), 31 deletions(-)
+
+diff --git a/server/SaveLoad.cpp b/server/SaveLoad.cpp
+index ecb73a3..37614d7 100644
+--- a/server/SaveLoad.cpp
++++ b/server/SaveLoad.cpp
+@@ -333,8 +333,13 @@ void LoadGame(const std::string& filename, ServerSaveGameData& server_save_game_
+ if (!ifs)
+ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
+
+- try {
+- // first attempt binary deserialziation
++ std::string signature(5, '\0');
++ if (!ifs.read(&signature[0], 5))
++ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
++ boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++
++ if (strncmp(signature.c_str(), "<?xml", 5)) {
++ // XML file format signature not found; try as binary
+ freeorion_bin_iarchive ia(ifs);
+ DebugLogger() << "Reading binary iarchive";
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+@@ -350,14 +355,10 @@ void LoadGame(const std::string& filename, ServerSaveGameData& server_save_game_
+ Deserialize(ia, universe);
+
+ DebugLogger() << "Done deserializing";
+- } catch (...) {
+- // if binary deserialization failed, try more-portable XML deserialization
+-
+- // reset to start of stream (attempted binary serialization will have consumed some input...)
+- boost::iostreams::seek(ifs, 0, std::ios_base::beg);
+-
++ } else {
+ // create archive with (preallocated) buffer...
+ freeorion_xml_iarchive xia(ifs);
++ DebugLogger() << "Reading XML iarchive";
+ // read from save file: uncompressed header serialized data, with compressed main archive string at end...
+ // deserialize uncompressed save header info
+ xia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+@@ -458,18 +459,21 @@ void LoadGalaxySetupData(const std::string& filename, GalaxySetupData& galaxy_se
+ if (!ifs)
+ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
+
+- try {
+- // first attempt binary deserialziation
++ std::string signature(5, '\0');
++ if (!ifs.read(&signature[0], 5))
++ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
++ boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++
++ if (strncmp(signature.c_str(), "<?xml", 5)) {
++ // XML file format signature not found; try as binary
++ DebugLogger() << "Attempting binary deserialization...";
+ freeorion_bin_iarchive ia(ifs);
+
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+ ia >> BOOST_SERIALIZATION_NVP(galaxy_setup_data);
+
+- } catch(...) {
+- // if binary deserialization failed, try more-portable XML deserialization
+-
+- // reset to start of stream (attempted binary serialization will have consumed some input...)
+- boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++ } else {
++ DebugLogger() << "Attempting XML deserialization...";
+ freeorion_xml_iarchive ia(ifs);
+
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+@@ -498,8 +502,13 @@ void LoadPlayerSaveHeaderData(const std::string& filename, std::vector<PlayerSav
+ if (!ifs)
+ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
+
+- try {
+- // first attempt binary deserialziation
++ std::string signature(5, '\0');
++ if (!ifs.read(&signature[0], 5))
++ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
++ boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++
++ if (strncmp(signature.c_str(), "<?xml", 5)) {
++ // XML file format signature not found; try as binary
+ DebugLogger() << "Attempting binary deserialization...";
+ freeorion_bin_iarchive ia(ifs);
+
+@@ -507,13 +516,8 @@ void LoadPlayerSaveHeaderData(const std::string& filename, std::vector<PlayerSav
+ ia >> BOOST_SERIALIZATION_NVP(ignored_galaxy_setup_data);
+ ia >> BOOST_SERIALIZATION_NVP(ignored_server_save_game_data);
+ ia >> BOOST_SERIALIZATION_NVP(player_save_header_data);
+-
+- } catch (...) {
+- // if binary deserialization failed, try more-portable XML deserialization
+- DebugLogger() << "Trying again with XML deserialization...";
+-
+- // reset to start of stream (attempted binary serialization will have consumed some input...)
+- boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++ } else {
++ DebugLogger() << "Attempting XML deserialization...";
+ freeorion_xml_iarchive ia(ifs);
+
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+@@ -521,6 +525,7 @@ void LoadPlayerSaveHeaderData(const std::string& filename, std::vector<PlayerSav
+ ia >> BOOST_SERIALIZATION_NVP(ignored_server_save_game_data);
+ ia >> BOOST_SERIALIZATION_NVP(player_save_header_data);
+ }
++
+ // skipping additional deserialization which is not needed for this function
+ DebugLogger() << "Done reading player save game data...";
+ } catch (const std::exception& e) {
+@@ -545,8 +550,14 @@ void LoadEmpireSaveGameData(const std::string& filename, std::map<int, SaveGameE
+ if (!ifs)
+ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
+
+- try {
+- // first attempt binary deserialziation
++ std::string signature(5, '\0');
++ if (!ifs.read(&signature[0], 5))
++ throw std::runtime_error(UNABLE_TO_OPEN_FILE);
++ boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++
++ if (strncmp(signature.c_str(), "<?xml", 5)) {
++ // XML file format signature not found; try as binary
++ DebugLogger() << "Attempting binary deserialization...";
+ freeorion_bin_iarchive ia(ifs);
+
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
+@@ -555,11 +566,8 @@ void LoadEmpireSaveGameData(const std::string& filename, std::map<int, SaveGameE
+ ia >> BOOST_SERIALIZATION_NVP(ignored_player_save_header_data);
+ ia >> BOOST_SERIALIZATION_NVP(empire_save_game_data);
+
+- } catch (...) {
+- // if binary deserialization failed, try more-portable XML deserialization
+-
+- // reset to start of stream (attempted binary serialization will have consumed some input...)
+- boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++ } else {
++ DebugLogger() << "Attempting XML deserialization...";
+ freeorion_xml_iarchive ia(ifs);
+
+ ia >> BOOST_SERIALIZATION_NVP(ignored_save_preview_data);
diff -Nru freeorion-0.4.8/debian/patches/really-fix-debian-bug-930417.patch freeorion-0.4.8/debian/patches/really-fix-debian-bug-930417.patch
--- freeorion-0.4.8/debian/patches/really-fix-debian-bug-930417.patch 1970-01-01 01:00:00.000000000 +0100
+++ freeorion-0.4.8/debian/patches/really-fix-debian-bug-930417.patch 2019-06-23 01:52:26.000000000 +0200
@@ -0,0 +1,44 @@
+From: Markus Koschany <apo@debian.org>
+Date: Sun, 23 Jun 2019 01:50:54 +0200
+Subject: really fix debian bug 930417
+
+Bug-Upstream: https://github.com/freeorion/freeorion/issues/2406
+Origin: https://github.com/freeorion/freeorion/commit/3e840f8d747fd0e6a513f3ef0278d3931f813109
+---
+ util/SaveGamePreviewUtils.cpp | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/util/SaveGamePreviewUtils.cpp b/util/SaveGamePreviewUtils.cpp
+index b9d49df..92122b1 100644
+--- a/util/SaveGamePreviewUtils.cpp
++++ b/util/SaveGamePreviewUtils.cpp
+@@ -65,7 +65,14 @@ namespace {
+
+ DebugLogger() << "LoadSaveGamePreviewData: Loading preview from: " << path.string();
+ try {
+- try {
++ // read the first five letters of the stream and check if it is opening an xml file
++ std::string xxx5(5, ' ');
++ ifs.read(&xxx5[0], 5);
++ const std::string xml5{"<?xml"};
++ // reset to start of stream
++ boost::iostreams::seek(ifs, 0, std::ios_base::beg);
++ // binary deserialization iff document is not xml
++ if (xml5 != xxx5) {
+ ScopedTimer timer("LoadSaveGamePreviewData (binary): " + path.string(), true);
+
+ // first attempt binary deserialziation
+@@ -74,12 +81,7 @@ namespace {
+ ia >> BOOST_SERIALIZATION_NVP(save_preview_data);
+ ia >> BOOST_SERIALIZATION_NVP(galaxy_setup_data);
+
+- } catch (...) {
+- // if binary deserialization failed, try more-portable XML deserialization
+-
+- // reset to start of stream (attempted binary serialization will have consumed some input...)
+- boost::iostreams::seek(ifs, 0, std::ios_base::beg);
+-
++ } else {
+ DebugLogger() << "Deserializing XML data";
+ freeorion_xml_iarchive ia(ifs);
+ ia >> BOOST_SERIALIZATION_NVP(save_preview_data);
diff -Nru freeorion-0.4.8/debian/patches/series freeorion-0.4.8/debian/patches/series
--- freeorion-0.4.8/debian/patches/series 1970-01-01 01:00:00.000000000 +0100
+++ freeorion-0.4.8/debian/patches/series 2019-06-23 01:52:26.000000000 +0200
@@ -0,0 +1,2 @@
+debian-bug-930417.patch
+really-fix-debian-bug-930417.patch
--- End Message ---