tags 184437 + patch I don't think this bug is actually in penguin-command. I think it is in sdl-mixer. Or maybe it is in libpng. The conditions that make penguin-command crash are really weird. It seems that a .mod file has to be playing in the background while a png file is blitted to the screen. Like I said, weird. I have a simple patch that fixes this segfault for me. Here it is: ----- Patch begin ------- diff -r src-orig/sound.c src/sound.c 8c8 < {"ramagard.s3m","icefront.s3m","pennight.mod","datajack.s3m"}; --- > {"ramagard.s3m","icefront.s3m","datajack.s3m"}; diff -r src-orig/sound.h src/sound.h 3c3 < #define MUSICNUM 4 --- > #define MUSICNUM 3 ------- Patch end ------- Yep. Not asking sdl-mixer to play a mod file fixes it, at least it does for me. I've narrowed down where I think the segfault occurs, and I think the problem is genuinely with sdl-mixer playing mod files. If I am right, this patch will work for everybody. While debugging, I tried replacing that line in sound.c with 4 pennights. I thought it would crash more. It didn't crash at all. I also tried moving it to the front, back, and second position. It didn't crash under those seemingly identical situations. Like I said, weird. Also worthy of note, is that every time I got penguin-command to crash , it was playing song #2 (starting from 0). Here is a log I have been keeping. I only added to this log sometimes when penguin-command would crash. I am not including the core dumps. If someone wants them, email me. Matches core penguin-command1.core I was using libsdl1.2debian-oss here. ~$ penguin-command ** Starting SDL init ** ** Init video ** ** Set video mode ** ** Create buffers ** ** Finding Joysticks ** ** Init joystick ** ** Loading Title Screen ** ** Opening Audio Mixer ** 8 channels allocated ** Loading Music ** ** Loading Sounds ** Warning: I could not open the options file for read: /home/wk/.penguin-command The error that occured was: No such file or directory ** Playing Music ** ** Ready to enter Menu ** Now playing song #1 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** ** Loading Font ** ** Init Font ** ** Loading Images ** Now playing song #1 FPS 74.932544 Now playing song #0 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Now playing song #2 FPS 74.029192 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Segmentation fault (core dumped) Matches core penguin-command2.core I was using libsdl1.2debian-alsa here. ** Starting SDL init ** ** Init video ** ** Set video mode ** ** Create buffers ** ** Finding Joysticks ** ** Init joystick ** ** Loading Title Screen ** ** Opening Audio Mixer ** 8 channels allocated ** Loading Music ** ** Loading Sounds ** ** Playing Music ** ** Ready to enter Menu ** Now playing song #1 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** ** Loading Font ** ** Init Font ** ** Loading Images ** Now playing song #1 Now playing song #0 FPS 73.957016 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Now playing song #2 Segmentation fault (core dumped) Matches core penguin-command3.core I was still using libsdl1.2debian-alsa here. I don't think it has to do with the particular sound thing in sdl. However, I played half an hour without sound, and penguin command did not crash. wk@ALPHA:~$ date Tue Feb 20 23:07:29 PST 2007 wk@ALPHA:~$ penguin-command ** Starting SDL init ** ** Init video ** ** Set video mode ** ** Create buffers ** ** Finding Joysticks ** ** Init joystick ** ** Loading Title Screen ** ** Opening Audio Mixer ** 8 channels allocated ** Loading Music ** ** Loading Sounds ** ** Playing Music ** ** Ready to enter Menu ** Now playing song #0 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** ** Loading Font ** ** Init Font ** ** Loading Images ** Now playing song #1 Now playing song #3 FPS 74.785722 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Now playing song #1 Now playing song #2 Segmentation fault (core dumped) wk@ALPHA:~$ date Tue Feb 20 23:21:25 PST 2007 This goes with penguin-command-debug1.core wk@ALPHA:~$ time penguin-command ** Starting SDL init ** ** Init video ** ** Set video mode ** ** Create buffers ** ** Finding Joysticks ** ** Init joystick ** ** Loading Title Screen ** ** Opening Audio Mixer ** 8 channels allocated ** Loading Music ** ** Loading Sounds ** ** Playing Music ** ** Ready to enter Menu ** Now playing song #0 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** ** Loading Font ** ** Init Font ** ** Loading Images ** Now playing song #0 FPS 74.185714 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Now playing song #3 Now playing song #3 FPS 74.027200 ** Fade in Music ** ** Showing Title Screen ** ** Blit Background ** ** Background image drawn ** Now playing song #3 Now playing song #2 Segmentation fault (core dumped) real 23m49.343s user 0m5.092s sys 0m5.528s wk@ALPHA:~$ Date was March 2, 2007. Here is a trace from *debug1.core: Core was generated by `penguin-command'. Program terminated with signal 11, Segmentation fault. #0 0xb7eb1413 in SDL_LowerBlit () from /usr/lib/libSDL-1.2.so.0 (gdb) backtrace #0 0xb7eb1413 in SDL_LowerBlit () from /usr/lib/libSDL-1.2.so.0 #1 0xb7eb16b4 in SDL_UpperBlit () from /usr/lib/libSDL-1.2.so.0 #2 0x0804ceea in Blit (Xpos=136111496, Ypos=510, image=0x805a750) at gfx.c:331 #3 0x0804bdab in DrawCannon (x=20, y=0) at game.c:160 #4 0x0804c0ad in ProcessEvents () at game.c:322 #5 0x0804c314 in StartGame () at game.c:429 #6 0x0804b1df in main (argc=136100536, argv=0x0) at main.c:460 (gdb) Notice that this has some things in common with the trace that Karl provided a few years ago, but some things are distinctly different. I've provided this extra information for the possibility that it be useful to somebody. Hopefully the patch will be useful to everybody. -Brandon