[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#834268: RFS: open-invaders/0.3-5 [NMU] [ITA]



On Wed, Aug 17, 2016 at 10:59:46PM +0200, Hanno 'Rince' Wagner wrote:
> I am packaging open-invaders, a clone of space invaders. I was able to
> "port" it (with a lot of help from friends) to gcc-6, but I have a
> problem with the used libraries.
> 
> I am able to successfully compile and package open-invaders. But when
> I want to start it, the initialization of allegro4 seems to fail:
> 
> [~]$ open-invaders 
> /usr/share
> Segmentation fault
> 
> 
> I used gdb and found that open-invaders crashed while initializing
> allegro:
> 
> (gdb) run
> Starting program: /usr/share/open-invaders/open-invaders 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> /usr/share
> [New Thread 0x7ffff433a700 (LWP 7044)]
> [Thread 0x7ffff433a700 (LWP 7044) exited]
> 
> Thread 1 "open-invaders" received signal SIGSEGV, Segmentation fault.
> 0x00007ffff7704cc7 in install_timer () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
> (gdb) bt
> #0  0x00007ffff7704cc7 in install_timer () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
> #1  0x000055555555fbd5 in initialise_game () at init.cc:521
> #2  0x00005555555574f4 in main (argc=1, argv=0x7fffffffe668) at main.cc:81
> (gdb) 

My splat is different:

[~]$ open-invaders
/usr/share
Allegro initialised...
Loading graphics...
Fatal error: Could not load file ship.pcx
Fatal error: Could not load file invader_top.pcx
Aborted (core dumped)

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#1  0x00007f679d2c740a in __GI_abort () at abort.c:89
#2  0x00007f679df90101 in ?? () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
#3  <signal handler called>
#4  0x00007f679def975e in blit () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
#5  0x0000565519e152db in load_data_files () at init.cc:92
#6  0x0000565519e0f8af in define_sprites () at graphics.cc:317
#7  0x0000565519e08377 in main (argc=1, argv=0x7ffdfb9aba98) at main.cc:89

Curiously, when you start the game from the directory you have unpacked the
sources to, it does work.  As if, it tried to load sprites from the current
dir.  Could that be?

.--====[ src/init.cc lines 619..642 ]
BITMAP *oi_load_graphic(std::string filename, std::string defsymbol)
{
        BITMAP *loaded_graphic;
        ostringstream filenamebuffer;

        filenamebuffer << "./data/" << filename;

        loaded_graphic=load_bitmap(filenamebuffer.str().c_str(),NULL);

#ifdef ALLEGRO_LINUX    
        if(!loaded_graphic)
        {
                loaded_graphic=load_bitmap(defsymbol.c_str(), NULL);
        }
#endif  
 
        if(!loaded_graphic)
        {
                cout << "Fatal error: Could not load file " << filename << "\n";
                return NULL;
        }
 
        return loaded_graphic;
}
`----

and the part that dies is:
.--====[ src/init.cc lines 81..93 ]
              switch(aliens)
              {
                      case 0: alienbuffer=oi_load_graphic("invader_top.pcx",GFX_ALIEN_TOP); break;
                      case 1: alienbuffer=oi_load_graphic("invader_middle.pcx",GFX_ALIEN_MIDDLE); break;
                      case 2: alienbuffer=oi_load_graphic("invader_bottom.pcx",GFX_ALIEN_BOTTOM); break;
                      case 3: alienbuffer=oi_load_graphic("invader_bottom.pcx",GFX_ALIEN_BOTTOM); break;
              }
         
              for(int animframes=0; animframes<3; animframes++)
              {
                      alien[aliens][animframes]=create_bitmap(64,64);
splat here-->         blit(alienbuffer,alien[aliens][animframes],animframes*64,0,0,0,64,64);
              }
`----

Thus:
1.  please make the part that says "Fatal" indeed fatal; returning NULL does
nothing good if the return value never gets checked.  It'd be good to die
immediately, gracefully restoring the screen resolution.  At least XFCE and
Gnome 2[1] completely lose your screen setup in this case, I guess most if
not all of other window managers fail in similar ways.  I need to manually
restore the resolution, turn on the other monitor, set the correct one as
primary, re-configure their layout, etc.  Not nice.

2. you install everything (sprites and sounds) to /usr/share/open-invaders/
rather than ./data/, please make the code use packaged paths.


Meow!

[1]. I'm too lazy to check how others handle such failures these days.
-- 
Second "wet cat laying down on a powered-on box-less SoC on the desk" close
shave in a week.  Protect your ARMs, folks!


Reply to: