tags 515203 + patch thanks I've been asked to look at a couple of RC bugs as part of the NM process, and I've picked this one as I've played supertux so am at least familiar with the package from the outside, and I know C++.
Firstly the upstream code doesn't build with the current version of g++ - the GCC developers have cleaned up a lot of implicitly included headers and this code needs updating to explicitly include headers it uses. This is fixed by the first patch: update-to-compile-with-current-gcc.patch On to this bug itself - when run from the menu, options are passed to disable sound and music, but this won't happen if the user invokes supertux from a terminal by running "supertux". I've addressed this by added a small silent WAV sample and adding fallback code so supertux will use this if it can't find the wav or ogg file it was asked to. This approach will also allow DFSG-free samples to be easily added one-by-one with missing samples continuing to use the fallback. There's a patch to add the fallback to the upstream code and a second to modify the debian packaging to generate and install the fallback wav file: fallback-to-silent-sample-upstream.patch fallback-to-silent-sample-debian.patch With these changes, I successfully built the package in a experimental pbuilder on amd64 and play tested for an hour or so. Cheers, Olly
--- supertux-0.3.0~dfsg.orig/src/object_factory.cpp +++ supertux-0.3.0~dfsg/src/object_factory.cpp @@ -19,6 +19,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <config.h> +#include <memory> #include <sstream> #include <stdexcept> --- supertux-0.3.0~dfsg.orig/src/textscroller.hpp +++ supertux-0.3.0~dfsg/src/textscroller.hpp @@ -21,6 +21,7 @@ #ifndef __TEXTSCROLLER_H__ #define __TEXTSCROLLER_H__ +#include <memory> #include <vector> #include <string> #include <map> --- supertux-0.3.0~dfsg.orig/src/console.cpp +++ supertux-0.3.0~dfsg/src/console.cpp @@ -18,6 +18,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <config.h> +#include <algorithm> #include <iostream> #include "console.hpp" #include "video/drawing_context.hpp" @@ -515,7 +516,7 @@ log_warning << "Command \"" << command << "\" not associated with a command receiver. Not dissociated." << std::endl; return; } - std::list<ConsoleCommandReceiver*>::iterator j = find(i->second.begin(), i->second.end(), ccr); + std::list<ConsoleCommandReceiver*>::iterator j = std::find(i->second.begin(), i->second.end(), ccr); if (j == i->second.end()) { log_warning << "Command \"" << command << "\" not associated with given command receiver. Not dissociated." << std::endl; return; @@ -529,7 +530,7 @@ for (std::map<std::string, std::list<ConsoleCommandReceiver*> >::iterator i = commands.begin(); i != commands.end(); i++) { std::list<ConsoleCommandReceiver*> &ccrs = i->second; std::list<ConsoleCommandReceiver*>::iterator j; - while ((j = find(ccrs.begin(), ccrs.end(), ccr)) != ccrs.end()) { + while ((j = std::find(ccrs.begin(), ccrs.end(), ccr)) != ccrs.end()) { ccrs.erase(j); } } --- supertux-0.3.0~dfsg.orig/src/console.hpp +++ supertux-0.3.0~dfsg/src/console.hpp @@ -22,6 +22,7 @@ #include <list> #include <map> +#include <memory> #include <vector> #include <string> #include <sstream> --- supertux-0.3.0~dfsg.orig/src/gameconfig.cpp +++ supertux-0.3.0~dfsg/src/gameconfig.cpp @@ -21,6 +21,7 @@ #include "gameconfig.hpp" #include <cstdlib> +#include <memory> #include <string> #include <stdexcept> --- supertux-0.3.0~dfsg.orig/src/statistics.cpp +++ supertux-0.3.0~dfsg/src/statistics.cpp @@ -22,6 +22,7 @@ #include <assert.h> #include <math.h> +#include <limits> #include <sstream> #include "video/drawing_context.hpp" #include "gettext.hpp" --- supertux-0.3.0~dfsg.orig/src/sprite/sprite_manager.hpp +++ supertux-0.3.0~dfsg/src/sprite/sprite_manager.hpp @@ -21,6 +21,7 @@ #define SUPERTUX_SPRITE_MANAGER_H #include <map> +#include <string> class SpriteData; class Sprite; --- supertux-0.3.0~dfsg.orig/src/tinygettext/tinygettext.cpp +++ supertux-0.3.0~dfsg/src/tinygettext/tinygettext.cpp @@ -19,8 +19,11 @@ #include <config.h> +#include <string.h> +#include <stdlib.h> #include <sys/types.h> #include <iconv.h> +#include <algorithm> #include <fstream> #include <iostream> #include <ctype.h> --- supertux-0.3.0~dfsg.orig/src/audio/sound_file.cpp +++ supertux-0.3.0~dfsg/src/audio/sound_file.cpp @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdint.h> +#include <string.h> #include <algorithm> #include <stdexcept> #include <sstream> --- supertux-0.3.0~dfsg.orig/src/lisp/lexer.cpp +++ supertux-0.3.0~dfsg/src/lisp/lexer.cpp @@ -19,6 +19,7 @@ #include <config.h> +#include <string.h> #include <sstream> #include <stdexcept> #include <iostream> --- supertux-0.3.0~dfsg.orig/src/lisp/parser.cpp +++ supertux-0.3.0~dfsg/src/lisp/parser.cpp @@ -19,6 +19,7 @@ #include <config.h> +#include <string.h> #include <sstream> #include <stdexcept> #include <fstream>
--- supertux-0.3.0~dfsg.orig/src/audio/sound_file.cpp +++ supertux-0.3.0~dfsg/src/audio/sound_file.cpp @@ -327,9 +328,15 @@ { PHYSFS_file* file = PHYSFS_openRead(filename.c_str()); if(!file) { - std::stringstream msg; - msg << "Couldn't open '" << filename << "': " << PHYSFS_getLastError(); - throw std::runtime_error(msg.str()); + // Debian package is missing non-DFSG sound effects, so default to silent + // sound file. + log_debug << "Couldn't open '" << filename << "': " << PHYSFS_getLastError() << std::endl; + file = PHYSFS_openRead("sounds/silent.wav"); + if(!file) { + std::stringstream msg; + msg << "Couldn't open '" << filename << "': " << PHYSFS_getLastError(); + throw std::runtime_error(msg.str()); + } } try {
diff -u supertux-0.3.0~dfsg/debian/control supertux-0.3.0~dfsg/debian/control --- supertux-0.3.0~dfsg/debian/control +++ supertux-0.3.0~dfsg/debian/control @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian Games Team <pkg-games-de...@lists.alioth.debian.org> Uploaders: Gürkan Sengün <gur...@linuks.mine.nu>, Bartosz Fenski <fe...@debian.org>, Cyril Brulebois <cyril.bruleb...@enst-bretagne.fr> -Build-Depends: debhelper (>= 5), libsdl1.2-dev (>=1.2.7+1.2.8cvs20041007-5.2), libsdl-image1.2-dev (>= 1.2.3-5), libsdl-mixer1.2-dev, libphysfs-dev, jam, libopenal-dev +Build-Depends: debhelper (>= 5), libsdl1.2-dev (>=1.2.7+1.2.8cvs20041007-5.2), libsdl-image1.2-dev (>= 1.2.3-5), libsdl-mixer1.2-dev, libphysfs-dev, jam, libopenal-dev, perl Build-Conflicts: nvidia-glx, nvidia-glx-legacy Standards-Version: 3.7.2 diff -u supertux-0.3.0~dfsg/debian/rules supertux-0.3.0~dfsg/debian/rules --- supertux-0.3.0~dfsg/debian/rules +++ supertux-0.3.0~dfsg/debian/rules @@ -57,6 +57,9 @@ dh_clean -k dh_installdirs jam -sprefix=$(CURDIR)/debian/tmp/usr install + install -d $(CURDIR)/debian/supertux-data/usr/share/games/supertux/sounds + perl -e 'print "RIFF%\0\0\0WAVEfmt \x10\0\0\0\x01\0\x01\x000u\0\x000u\0\0\x01\0\x08\0data\x01\0\0\0\x80"' > $(CURDIR)/debian/supertux-data/usr/share/games/supertux/sounds/silent.wav + chmod 0644 $(CURDIR)/debian/supertux-data/usr/share/games/supertux/sounds/silent.wav #cp -vR src/supertux $(CURDIR)/debian/supertux/usr/games #cp -vR data/images $(CURDIR)/debian/supertux-data/usr/share/games/supertux #cp -vR data/levels $(CURDIR)/debian/supertux-data/usr/share/games/supertux