Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault on startup #22

Closed
timsoftgit opened this issue Nov 11, 2019 · 8 comments
Closed

segmentation fault on startup #22

timsoftgit opened this issue Nov 11, 2019 · 8 comments

Comments

@timsoftgit
Copy link

running from a kterminal gives the following output.
neil@timhome:~$ blobwarsAttrition
INFO: Locale is en_US
INFO: Language is en
INFO: Numeric is C
INFO: atof(2.75) is 2.750000
INFO: User home = /home/neil
Segmentation fault

it was working, (but not fullscreen and full resolution of 1920x1080).
I changed the screen resolution and selected fullscreen and restarted, but it didn't restart, it gave the above output.
(running 64bit linux (slackware 14.2) (with paid-for data) Any suggestions to debug?
glxgears -info shows running gl version 3.0 Mesa 11.2.2
SDL2 2.0.9 SDL2_image 2.0.4 SDL2_mixer 2.0.4 and SDL2_ttf 2.0.14

@stephenjsweeney
Copy link
Owner

It could be that the config file has corrupted, which would cause a crash. The config file can be found in:

~/.local/share/blobwarsAttrition/config.json

That should be valid JSON. Try renaming it and restarting the game (which will effectively reset your configuration). If that works, it means your config was busted. Attach the file in a comment and I'll take a look (or you could see if you could fix it manually).

If that doesn't work, try running through gdb. This should show you a stacktrace of where the crash occurs.

gdb blobwarsAttrition
run
(upon crash) where

@timsoftgit
Copy link
Author

yes, that file was empty - 0 bytes long. having deleted the empty file blobwarsAttrition starts.
however, trying to load a game gives
ERROR: Corrupt save file: /home/neil/.local/share/blobwarsAttrition/0/game.json
and it crashes out
looking at the files in ~/.local/share/blobwarsAttrition/0/
there are 9 files. beachApproach.json beachFront1.json boss1.json game.json greenlands1.json greenlands2.json greenlands3.json and greenlands4.json

beachFront1.json boss1.json game.json and greenlands5.json are all 0 bytes
should I just delete all the zero length files?

@stephenjsweeney
Copy link
Owner

stephenjsweeney commented Nov 12, 2019

You shouldn't have any zero length files in there, at all. Sounds like the game isn't saving correctly for some reason.

You could delete them, yes. But it will put the game into an inconsistent state where you'll find you end up with more keys than you should do; it will basically make your playthrough too easy.

Did you compile the game yourself? Or are you using the version from itch.io?

Edit: a bit more info - those files are used to store the level state, for the purpose of creating a persistent game world. Deleting them will basically reset the level as if it's being visited for the first time.

@timsoftgit
Copy link
Author

ok, so it looks like it is safe to delete. my son is playing it and he quit out of a few levels (esc) because he got stuck (he needs more patience :-) ). I compiled it myself, using the source+data from itch.io
I created a package build script (for slackware) which is below. as you can see there are a couple of build patches and a cosmetic (default gore setting) patch included. It requires the source tar.gz file in the same ditrectory as the script (and also a slack-desc and README file, which I can post if you're interested)
#!/bin/sh

Slackware build script for blobwarsAttrition

Written by Tim Dickson dickson.tim@googlemail.com

(C) 2019

changelog

PRGNAM=blobwarsAttrition
VERSION=${VERSION:-1.2.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi

set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.src.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L .
( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555
-o -perm 511 ) -exec chmod 755 {} ; -o
( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444
-o -perm 440 -o -perm 400 ) -exec chmod 644 {} ;
#patch file to fix build problem
sed -i "/nextp/d" src/game/credits.h
sed -i 's/*strtok_r/*strtok_rr/g' src/util/util.c
#patch to make default more kiddy friendly
sed -i 's/app.config.blood = 1/app.config.blood = 0/g' src/system/init.c

make CFLAGS="$SLKCFLAGS" DATA_DIR="/usr/share/games/$PRGNAM"
make install DESTDIR=$PKG DATA_DIR="/usr/share/games/$PRGNAM"

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cp CHANGELOG.raw LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION/
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

@timsoftgit
Copy link
Author

(appologies for the weird formatting github put on my pasted text)

@stephenjsweeney
Copy link
Owner

I'm not having any luck duplicating this error.

Something you could try: backup or delete the ~/.local/share/blobwarsAttrition directory and start a new game using:

blobwarsAttrition -debug

When playing, you'll see debug stuff on screen, but you can also press 0 on the keyboard to automatically complete a mission. Do this on a few stages and then check to see that the save files are being created properly. If they're all still 0 in size then we'll need to do more digging.

The saving is done by first creating temporary files and then renaming them, in order to try and keep things in sync. This is done here:

https://github.com/stephenjsweeney/blobwarsAttrition/blob/master/src/hub/postMission.c#L91

The main level saving is done here:

https://github.com/stephenjsweeney/blobwarsAttrition/blob/master/src/world/worldSaver.c#L30

Perhaps more debug and error checking will be needed?

@timsoftgit
Copy link
Author

it seems to be saving ok. I tried completing a level in debug mode as well as "0" completing, and tried quitting the program (x) in corner, also tried kill -9 gamepid but no zero-length files. I'll have to see if my son can remember what he did when it "went wrong".

@timsoftgit
Copy link
Author

apparently it happened after he died on grasslands5, or whengrasslands5 was completed. Unfortunately it's not much to go on. I'll close this, and if it re-occurs open a fresh issue hopefully with more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants