Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
296 stars 42 forks source link

String question crash #645

Open red-kangaroo opened 2 years ago

red-kangaroo commented 2 years ago

A string question history was introduced in e91cdad23a0a7de069f7048bbc1d03a531e14d26 and it seems that both crashes reported here are caused by a string question seg fault.

AquariusPower commented 2 years ago

demangled (c++filt) from:

./Main/ivan(globalerrorhandler::DumpStackTraceToStdErr(int)+0x34)[0x55d9d911a792]
./Main/ivan(CrashHandler(int)+0x15)[0x55d9d90ab870]
/lib/x86_64-linux-gnu/libc.so.6(+0x3f040)[0x7f0be6527040]
/lib/x86_64-linux-gnu/libc.so.6(rewind+0x1)[0x7f0be6570481]
./Main/ivan(iosystem::StringQuestion(festring&, festring const&, v2, int, unsigned long, unsigned long, bool, bool, bool (*)(int, festring&))+0x222)[0x55d9d911c1e6]
./Main/ivan(game::Init(festring const&)+0x136)[0x55d9d8fcb6cc]
./Main/ivan(main+0x9e8)[0x55d9d90ac2af]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f0be6509bf7]
./Main/ivan(_start+0x2a)[0x55d9d8e8cada]

I think it happens at

truth game::Init(cfestring& loadBaseName)
...
      if(iosystem::StringQuestion(PlayerName, CONST_S("What is your name? (1-20 letters)"),
                                  v2(30, 46), WHITE, 1, 20, true, true) == ABORTED

he said ubuntu 18

the other from the screenshot apparently happens when trying to change the player's name I guess. he said linuxmint 20.3

both crashes happens at the rewind.

int iosystem::StringQuestion(festring& Input,
...
  festring fsHistFile = festring()+GetUserDataDir()+".QuestionHistory_"+fsFixTopicToFileName+".txt";
  DBG1(fsHistFile.CStr());
  FILE *fl = fopen(fsHistFile.CStr(), "a+");
  rewind(fl);

It would be good to know the value of fsHistFile, and if that file is being really created. I think rewind is unnecessary in case the file have been just created also. May be the fopen mode "a+" could be a better option to prevent this crash?

AquariusPower commented 2 years ago

I think it could catch the error and retry a few times before aborting.
Most certainly their filesystems are not full neither readonly.

But... this could be a user write permission problem! I think we could check for user write permissions on the specified path?

btw: https://www.cplusplus.com/reference/cstdio/fopen/

arrowgent commented 2 years ago

ubuntu 18.04 game seems to run, but i was using 0.58 before without issues and overwrote my directories

build log:

cmake ..

-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done

*NOTICE*
    Highscore files and Bone files are now stored at "$HOME/.ivan".
    Your HOME directory is "/home/catbox".

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libpcre'
--   Found libpcre, version 8.39
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found SDL2: /usr/lib/x86_64-linux-gnu/libSDL2main.a;/usr/lib/x86_64-linux-gnu/libSDL2.so;-lpthread  
-- Checking for module 'libpng'
--   Found libpng, version 1.6.37
-- Found ALSA: /usr/lib/x86_64-linux-gnu/libasound.so (found version "1.2.2") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/catbox/Downloads/build/ivan/ivan-059/build

make

[  1%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/bitmap.cpp.o
[  3%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/config.cpp.o
[  4%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/error.cpp.o
[  6%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/febot.cpp.o
[  8%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/feio.cpp.o
[  9%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/felist.cpp.o
[ 11%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/femath.cpp.o
[ 12%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/festring.cpp.o
[ 14%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/fetime.cpp.o
[ 16%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/graphics.cpp.o
[ 17%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/hscore.cpp.o
[ 19%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/rawbit.cpp.o
[ 20%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/save.cpp.o
[ 22%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/sfx.cpp.o
[ 24%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/specialkeys.cpp.o
[ 25%] Building CXX object FeLib/CMakeFiles/FeLib.dir/Source/whandler.cpp.o
[ 27%] Linking CXX static library libFeLib.a
[ 27%] Built target FeLib
[ 29%] Building CXX object audio/CMakeFiles/FeAudio.dir/MIDIDebug.cpp.o
[ 30%] Building CXX object audio/CMakeFiles/FeAudio.dir/MIDIUtils.cpp.o
[ 32%] Building CXX object audio/CMakeFiles/FeAudio.dir/RtMidi.cpp.o
[ 33%] Building CXX object audio/CMakeFiles/FeAudio.dir/audio.cpp.o
[ 35%] Building CXX object audio/CMakeFiles/FeAudio.dir/audio_stack.cpp.o
[ 37%] Building CXX object audio/CMakeFiles/FeAudio.dir/linkedlist.cpp.o
[ 38%] Building CXX object audio/CMakeFiles/FeAudio.dir/midiparser.cpp.o
[ 40%] Building CXX object audio/CMakeFiles/FeAudio.dir/midiplayback.cpp.o
[ 41%] Linking CXX static library libFeAudio.a
[ 41%] Built target FeAudio
[ 43%] Building CXX object FastNoise/CMakeFiles/fastnoise.dir/FastNoise.cpp.o
[ 45%] Linking CXX static library libfastnoise.a
[ 45%] Built target fastnoise
[ 46%] Building CXX object xbrzscale/CMakeFiles/xbrzscale.dir/libxbrzscale.cpp.o
[ 48%] Building CXX object xbrzscale/CMakeFiles/xbrzscale.dir/xbrz/xbrz.cpp.o
[ 50%] Linking CXX static library libxbrzscale.a
[ 50%] Built target xbrzscale
[ 51%] Building CXX object fantasyname/CMakeFiles/fantasyname.dir/namegen.cc.o
[ 53%] Linking CXX static library libfantasyname.a
[ 53%] Built target fantasyname
[ 54%] Building CXX object Main/CMakeFiles/ivan.dir/Source/actset.cpp.o
[ 56%] Building CXX object Main/CMakeFiles/ivan.dir/Source/areaset.cpp.o
[ 58%] Building CXX object Main/CMakeFiles/ivan.dir/Source/bugworkaround.cpp.o
[ 59%] Building CXX object Main/CMakeFiles/ivan.dir/Source/charset.cpp.o
[ 61%] Building CXX object Main/CMakeFiles/ivan.dir/Source/charsset.cpp.o
[ 62%] Building CXX object Main/CMakeFiles/ivan.dir/Source/command.cpp.o
[ 64%] Building CXX object Main/CMakeFiles/ivan.dir/Source/coreset.cpp.o
[ 66%] Building CXX object Main/CMakeFiles/ivan.dir/Source/dataset.cpp.o
[ 67%] Building CXX object Main/CMakeFiles/ivan.dir/Source/definesvalidator.cpp.o
[ 69%] Building CXX object Main/CMakeFiles/ivan.dir/Source/devcons.cpp.o
[ 70%] Building CXX object Main/CMakeFiles/ivan.dir/Source/dungeon.cpp.o
[ 72%] Building CXX object Main/CMakeFiles/ivan.dir/Source/game.cpp.o
[ 74%] Building CXX object Main/CMakeFiles/ivan.dir/Source/godset.cpp.o
[ 75%] Building CXX object Main/CMakeFiles/ivan.dir/Source/iconf.cpp.o
[ 77%] Building CXX object Main/CMakeFiles/ivan.dir/Source/id.cpp.o
[ 79%] Building CXX object Main/CMakeFiles/ivan.dir/Source/igraph.cpp.o
[ 80%] Building CXX object Main/CMakeFiles/ivan.dir/Source/itemset.cpp.o
[ 82%] Building CXX object Main/CMakeFiles/ivan.dir/Source/levelset.cpp.o
[ 83%] Building CXX object Main/CMakeFiles/ivan.dir/Source/main.cpp.o
[ 85%] Building CXX object Main/CMakeFiles/ivan.dir/Source/materset.cpp.o
[ 87%] Building CXX object Main/CMakeFiles/ivan.dir/Source/message.cpp.o
[ 88%] Building CXX object Main/CMakeFiles/ivan.dir/Source/object.cpp.o
[ 90%] Building CXX object Main/CMakeFiles/ivan.dir/Source/roomset.cpp.o
[ 91%] Building CXX object Main/CMakeFiles/ivan.dir/Source/script.cpp.o
[ 93%] Building CXX object Main/CMakeFiles/ivan.dir/Source/slotset.cpp.o
[ 95%] Building CXX object Main/CMakeFiles/ivan.dir/Source/trapset.cpp.o
[ 96%] Building CXX object Main/CMakeFiles/ivan.dir/Source/wmapset.cpp.o
[ 98%] Building CXX object Main/CMakeFiles/ivan.dir/Source/wskill.cpp.o
[100%] Linking CXX executable ivan
[100%] Built target ivan

run game, start new character, move around alt-f4 to exit

ivan-linux

fluidsynth: no process found
FluidSynth runtime version 2.2.5
Copyright (C) 2000-2022 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

fluidsynth: panic: An error occurred while reading from stdin.
fluidsynth: panic: An error occurred while reading from stdin.
fluidsynth: error: Failed to create server socket: 97
Failed to create the server.
Continuing without it.
fluidsynth: warning: Failed to set thread to high priority
fluidsynth: Using PulseAudio driver
fluidsynth: warning: Failed to set thread to high priority
Segmentation fault
/home/catbox/.local/games/ivan/ivan(_ZN18globalerrorhandler22DumpStackTraceToStdErrEi+0x34)[0x56473108e236]
/home/catbox/.local/games/ivan/ivan(_Z12CrashHandleri+0x15)[0x56473101edd8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef10)[0x7fbe0ace3f10]
/home/catbox/.local/games/ivan/ivan(_ZN8iosystem4MenuESt6vectorIP6bitmapSaIS2_EE2v2RK8festringS8_iS8_S8_b+0x19b)[0x56473108eb3f]
/home/catbox/.local/games/ivan/ivan(_ZN4game4MenuESt6vectorIP6bitmapSaIS2_EE2v2RK8festringS8_iS8_S8_+0x81)[0x564730f4e91b]
/home/catbox/.local/games/ivan/ivan(_ZN4game17HandleQuitMessageEv+0x477)[0x564730f4bc79]
/home/catbox/.local/games/ivan/ivan(_ZN19globalwindowhandler14ProcessMessageEP9SDL_Event+0x106)[0x5647310c266e]
/home/catbox/.local/games/ivan/ivan(_ZN19globalwindowhandler10PollEventsEP9SDL_Event+0x80)[0x5647310c1eba]
/home/catbox/.local/games/ivan/ivan(_ZN19globalwindowhandler6GetKeyEb+0x161)[0x5647310c1d25]
/home/catbox/.local/games/ivan/ivan(_ZN6felist12DrawFilteredERb+0xa9d)[0x56473109ca29]
/home/catbox/.local/games/ivan/ivan(_ZN6felist4DrawEv+0x104)[0x56473109bcf4]
/home/catbox/.local/games/ivan/ivan(_ZN13commandsystem13ShowKeyLayoutEP9character+0xb9c)[0x564730ed6c12]
/home/catbox/.local/games/ivan/ivan(_ZN9character16GetPlayerCommandEv+0x3c5)[0x564730e20651]
/home/catbox/.local/games/ivan/ivan(_ZN9character2BeEv+0x624)[0x564730e134cc]
/home/catbox/.local/games/ivan/ivan(_ZN4pool2BeEv+0x3b)[0x564730ef94a5]
/home/catbox/.local/games/ivan/ivan(_ZN4game3RunEv+0x3cb)[0x564730f3e833]
/home/catbox/.local/games/ivan/ivan(main+0xa0a)[0x56473101f839]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fbe0acc6c87]
/home/catbox/.local/games/ivan/ivan(_start+0x2a)[0x564730dfbd9a]

repeat, run game, see menu, press 5 to exit ivan-linux

fluidsynth: no process found
FluidSynth runtime version 2.2.5
Copyright (C) 2000-2022 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

fluidsynth: panic: An error occurred while reading from stdin.
fluidsynth: panic: An error occurred while reading from stdin.
fluidsynth: warning: Failed to set thread to high priority
fluidsynth: error: Failed to create server socket: 97
Failed to create the server.
Continuing without it.
fluidsynth: Using PulseAudio driver
fluidsynth: warning: Failed to set thread to high priority

possibly since the game wants to use the folder /usr/local/share/ivan i own this folder so lets sudo chown -R root:root /usr/local/share/ivan game runs fine

sorry. nothing to see here...

SSUPII commented 2 years ago

Can anyone check if this issue is still happening on their end? We might close this issue if it is.

BillyIII commented 1 year ago

Can anyone check if this issue is still happening on their end? We might close this issue if it is.

The crash is happening for me on 059, but it is not present in master.