Linux 64-bit Statue of Inconsequentia crash

Discussion in 'Bugs' started by Pulsewidth, Nov 30, 2011.

  1. Pulsewidth

    Pulsewidth Member

    Accepting a quest sometimes causes crashes. I ran Dredmor in GDB and got a backtrace:

    #0 0x000000000054a199 in PHYSFS_read ()
    #1 0x0000000000484aae in Sprite::Load(char const*, char const*, int, int, int) ()
    #2 0x000000000048ba30 in SpriteMgr_AutoLoad(char const*, char const*, char const*, int, int, int) ()
    #3 0x00000000004c606b in Monster::RebuildSprites() ()
    #4 0x00000000004c82ee in Monster::Monster(monDBEntry*) ()
    #5 0x000000000045b5a1 in Level::SpawnNamedMonster(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) ()
    #6 0x00000000004a2515 in Statue::Clicked() ()
    #7 0x00000000004f6a89 in DoPlayerClickedProcessing(int, int) ()
    #8 0x00000000004fa12e in HandleMouseClick(int, int, int) ()
    #9 0x00000000004fe4bb in ParsePlayerInput() ()
    #10 0x000000000049231f in Mainloop() ()
    #11 0x0000000000493d7c in PlayGameWithPlayer(Player*) ()
    #12 0x0000000000493a8c in main ()

    My first guess is that there's a problem with filenames being case sensitive on Linux.
     
    Krushak likes this.
  2. Pulsewidth

    Pulsewidth Member

    Ran strace, found this:

    lstat("./sprites/monster/octo/octo_Walk_Right.spr", 0x7fff06c16240) = -1 ENOENT (No such file or directory)
    --- SIGSEGV (Segmentation fault) @ 0 (0) ---

    File is actually Octo_Walk_Right.spr, with an uppercase 'O'. I suspect most of the Linux crashes are down to this kind of error. AFAICT all the filenames are defined in the XML files, so anybody who wants to fix these bugs can go through all the XML files checking all the referenced filenames match the real filenames.
     
    Essence likes this.
  3. xolotl

    xolotl Member

    Ah, interesting, good catch! I wrote a quick util to check the XML files versus the actual filenames, and it looks like there are nine affected monsters (the only XML file with mismatches was game/monDB.xml). I'm guessing that this isn't the same issue as all the stuff in the "major instability" thread, because otherwise that would be affecting me as well, and I haven't actually seen this issue yet. At any rate, here's a list of the lines that need changing in game/monDB.xml:

    Code:
    game/monDB.xml:282 -> sprites/monster/octo/Octo_Walk_Left.spr
    game/monDB.xml:283 -> sprites/monster/octo/Octo_Walk_Right.spr
    game/monDB.xml:284 -> sprites/monster/octo/Octo_Walk_Up.spr
    game/monDB.xml:285 -> sprites/monster/octo/Octo_Walk_Down.spr
    game/monDB.xml:286 -> sprites/monster/octo/Octo_Atk_Left.spr
    game/monDB.xml:287 -> sprites/monster/octo/Octo_Atk_Right.spr
    game/monDB.xml:288 -> sprites/monster/octo/Octo_Atk_Up.spr
    game/monDB.xml:289 -> sprites/monster/octo/Octo_Atk_Down.spr
    game/monDB.xml:290 -> sprites/monster/octo/Octo_Hit_Left.spr
    game/monDB.xml:291 -> sprites/monster/octo/Octo_Hit_Right.spr
    game/monDB.xml:292 -> sprites/monster/octo/Octo_Hit_Up.spr
    game/monDB.xml:293 -> sprites/monster/octo/Octo_Hit_Down.spr
    game/monDB.xml:295 -> sprites/monster/octo/Octo_Cast.spr
    game/monDB.xml:296 -> sprites/monster/octo/Octo_Die.spr
    game/monDB.xml:386 -> sprites/monster/djinn/Djinn_Attack_Left.spr
    game/monDB.xml:387 -> sprites/monster/djinn/Djinn_Attack_Right.spr
    game/monDB.xml:388 -> sprites/monster/djinn/Djinn_Attack_Up.spr
    game/monDB.xml:389 -> sprites/monster/djinn/Djinn_Attack_Down.spr
    game/monDB.xml:390 -> sprites/monster/djinn/Djinn_Hit_Left.spr
    game/monDB.xml:391 -> sprites/monster/djinn/Djinn_Hit_Right.spr
    game/monDB.xml:392 -> sprites/monster/djinn/Djinn_Hit_Up.spr
    game/monDB.xml:393 -> sprites/monster/djinn/Djinn_Hit_Down.spr
    game/monDB.xml:433 -> sprites/monster/djinn/Djinn_Attack_Left.spr
    game/monDB.xml:434 -> sprites/monster/djinn/Djinn_Attack_Right.spr
    game/monDB.xml:435 -> sprites/monster/djinn/Djinn_Attack_Up.spr
    game/monDB.xml:436 -> sprites/monster/djinn/Djinn_Attack_Down.spr
    game/monDB.xml:437 -> sprites/monster/djinn/Djinn_Hit_Left.spr
    game/monDB.xml:438 -> sprites/monster/djinn/Djinn_Hit_Right.spr
    game/monDB.xml:439 -> sprites/monster/djinn/Djinn_Hit_Up.spr
    game/monDB.xml:440 -> sprites/monster/djinn/Djinn_Hit_Down.spr
    game/monDB.xml:546 -> sprites/monster/pumpkinn/DemPum_Atk_Left.spr
    game/monDB.xml:547 -> sprites/monster/pumpkinn/DemPum_Atk_Right.spr
    game/monDB.xml:548 -> sprites/monster/pumpkinn/DemPum_Atk_Up.spr
    game/monDB.xml:549 -> sprites/monster/pumpkinn/DemPum_Atk_Down.spr
    game/monDB.xml:550 -> sprites/monster/pumpkinn/DemPum_Hit_Left.spr
    game/monDB.xml:551 -> sprites/monster/pumpkinn/DemPum_Hit_Right.spr
    game/monDB.xml:552 -> sprites/monster/pumpkinn/DemPum_Hit_Up.spr
    game/monDB.xml:553 -> sprites/monster/pumpkinn/DemPum_Hit_Down.spr
    game/monDB.xml:621 -> sprites/monster/witch/Witch_Walk_Left.spr
    game/monDB.xml:622 -> sprites/monster/witch/Witch_Walk_Right.spr
    game/monDB.xml:623 -> sprites/monster/witch/Witch_Walk_Up.spr
    game/monDB.xml:624 -> sprites/monster/witch/Witch_Walk_Down.spr
    game/monDB.xml:625 -> sprites/monster/witch/Witch_Atk_Left.spr
    game/monDB.xml:626 -> sprites/monster/witch/Witch_Atk_Right.spr
    game/monDB.xml:627 -> sprites/monster/witch/Witch_Atk_Up.spr
    game/monDB.xml:628 -> sprites/monster/witch/Witch_Atk_Down.spr
    game/monDB.xml:629 -> sprites/monster/witch/Witch_Hit_Left.spr
    game/monDB.xml:630 -> sprites/monster/witch/Witch_Hit_Right.spr
    game/monDB.xml:631 -> sprites/monster/witch/Witch_Hit_Up.spr
    game/monDB.xml:632 -> sprites/monster/witch/Witch_Hit_Down.spr
    game/monDB.xml:634 -> sprites/monster/witch/Witch_Die.spr
    game/monDB.xml:636 -> sprites/monster/witch/Witch_Cast.spr
    game/monDB.xml:813 -> sprites/monster/golem/Ice_Walk_Left.spr
    game/monDB.xml:814 -> sprites/monster/golem/Ice_Walk_Right.spr
    game/monDB.xml:815 -> sprites/monster/golem/Ice_Walk_Up.spr
    game/monDB.xml:816 -> sprites/monster/golem/Ice_Walk_Down.spr
    game/monDB.xml:817 -> sprites/monster/golem/Ice_Atk_Left.spr
    game/monDB.xml:818 -> sprites/monster/golem/Ice_Atk_Right.spr
    game/monDB.xml:819 -> sprites/monster/golem/Ice_Atk_up.spr
    game/monDB.xml:820 -> sprites/monster/golem/Ice_Atk_Down.spr
    game/monDB.xml:821 -> sprites/monster/golem/Ice_Hit_Left.spr
    game/monDB.xml:822 -> sprites/monster/golem/Ice_Hit_Right.spr
    game/monDB.xml:823 -> sprites/monster/golem/Ice_Hit_Up.spr
    game/monDB.xml:824 -> sprites/monster/golem/Ice_Hit_Down.spr
    game/monDB.xml:826 -> sprites/monster/golem/Ice_Die.spr
    game/monDB.xml:1009 -> sprites/monster/fire/Fire_Walk_Left.spr
    game/monDB.xml:1010 -> sprites/monster/fire/Fire_Walk_Right.spr
    game/monDB.xml:1011 -> sprites/monster/fire/Fire_Walk_Up.spr
    game/monDB.xml:1012 -> sprites/monster/fire/Fire_Walk_Down.spr
    game/monDB.xml:1014 -> sprites/monster/fire/Fire_Atk_Left.spr
    game/monDB.xml:1015 -> sprites/monster/fire/Fire_Atk_Right.spr
    game/monDB.xml:1016 -> sprites/monster/fire/Fire_Atk_Up.spr
    game/monDB.xml:1017 -> sprites/monster/fire/Fire_Atk_Down.spr
    game/monDB.xml:1019 -> sprites/monster/fire/Fire_Atk_Left.spr
    game/monDB.xml:1020 -> sprites/monster/fire/Fire_Atk_Right.spr
    game/monDB.xml:1021 -> sprites/monster/fire/Fire_Atk_Up.spr
    game/monDB.xml:1022 -> sprites/monster/fire/Fire_Atk_Down.spr
    game/monDB.xml:1024 -> sprites/monster/fire/Fire_Hit_Left.spr
    game/monDB.xml:1025 -> sprites/monster/fire/Fire_Hit_Right.spr
    game/monDB.xml:1026 -> sprites/monster/fire/Fire_Hit_Up.spr
    game/monDB.xml:1027 -> sprites/monster/fire/Fire_Hit_Down.spr
    game/monDB.xml:1029 -> sprites/monster/fire/Fire_Cast.spr
    game/monDB.xml:1030 -> sprites/monster/fire/Fire_Die.spr
    game/monDB.xml:1134 -> sprites/monster/luck/Luck_Walk_Left.spr
    game/monDB.xml:1135 -> sprites/monster/luck/Luck_Walk_Right.spr
    game/monDB.xml:1136 -> sprites/monster/luck/Luck_Walk_Up.spr
    game/monDB.xml:1137 -> sprites/monster/luck/Luck_Walk_Down.spr
    game/monDB.xml:1138 -> sprites/monster/luck/Luck_Atk_Left.spr
    game/monDB.xml:1139 -> sprites/monster/luck/Luck_Atk_Right.spr
    game/monDB.xml:1140 -> sprites/monster/luck/Luck_Atk_Up.spr
    game/monDB.xml:1141 -> sprites/monster/luck/Luck_Atk_Down.spr
    game/monDB.xml:1142 -> sprites/monster/luck/Luck_Hit_Left.spr
    game/monDB.xml:1143 -> sprites/monster/luck/Luck_Hit_Right.spr
    game/monDB.xml:1144 -> sprites/monster/luck/Luck_Hit_Up.spr
    game/monDB.xml:1145 -> sprites/monster/luck/Luck_Hit_Down.spr
    game/monDB.xml:1147 -> sprites/monster/luck/Luck_Die.spr
    game/monDB.xml:1181 -> sprites/monster/Robo/Robo_Walk_Left.spr
    game/monDB.xml:1182 -> sprites/monster/Robo/Robo_Walk_Right.spr
    game/monDB.xml:1183 -> sprites/monster/Robo/Robo_Walk_Up.spr
    game/monDB.xml:1184 -> sprites/monster/Robo/Robo_Walk_Down.spr
    game/monDB.xml:1186 -> sprites/monster/Robo/Robo_Attack_Left.spr
    game/monDB.xml:1187 -> sprites/monster/Robo/Robo_Attack_right.spr
    game/monDB.xml:1188 -> sprites/monster/Robo/Robo_Attack_Up.spr
    game/monDB.xml:1189 -> sprites/monster/Robo/Robo_Attack_Down.spr
    game/monDB.xml:1191 -> sprites/monster/Robo/Robo_Hit_Left.spr
    game/monDB.xml:1192 -> sprites/monster/Robo/Robo_Hit_Right.spr
    game/monDB.xml:1193 -> sprites/monster/Robo/Robo_Hit_Up.spr
    game/monDB.xml:1194 -> sprites/monster/Robo/Robo_Hit_Down.spr
    game/monDB.xml:1196 -> sprites/monster/Robo/Robo_Die.spr
    game/monDB.xml:1235 -> sprites/monster/lich/Lich_Walk_Left.spr
    game/monDB.xml:1236 -> sprites/monster/lich/Lich_Walk_Right.spr
    game/monDB.xml:1237 -> sprites/monster/lich/Lich_Walk_Up.spr
    game/monDB.xml:1238 -> sprites/monster/lich/Lich_Walk_Down.spr
    game/monDB.xml:1239 -> sprites/monster/lich/Lich_Attack_Left.spr
    game/monDB.xml:1240 -> sprites/monster/lich/Lich_Attack_Right.spr
    game/monDB.xml:1241 -> sprites/monster/lich/Lich_Attack_Up.spr
    game/monDB.xml:1242 -> sprites/monster/lich/Lich_Attack_Down.spr
    game/monDB.xml:1243 -> sprites/monster/lich/Lich_Attack_Left.spr
    game/monDB.xml:1244 -> sprites/monster/lich/Lich_Attack_Right.spr
    game/monDB.xml:1245 -> sprites/monster/lich/Lich_Attack_Up.spr
    game/monDB.xml:1246 -> sprites/monster/lich/Lich_Attack_Down.spr
    game/monDB.xml:1247 -> sprites/monster/lich/Lich_Hit_Left.spr
    game/monDB.xml:1248 -> sprites/monster/lich/Lich_Hit_Right.spr
    game/monDB.xml:1249 -> sprites/monster/lich/Lich_Hit_Up.spr
    game/monDB.xml:1250 -> sprites/monster/lich/Lich_Hit_Down.spr
    game/monDB.xml:1252 -> sprites/monster/lich/Lich_Cast.spr
    game/monDB.xml:1253 -> sprites/monster/lich/Lich_Die.spr
    And, just for the record, the little script I bashed out to generate the list. It's not exactly elegant, but it does the trick. (Note that it doesn't actually make any changes to the files; I may modify it to do so soonish, though)

    Code:
    #!/usr/bin/env python
    # vim: set expandtab tabstop=4 shiftwidth=4:
    
    import os
    import sys
    
    # Gather some info
    filedict = {}
    xmlfiles = []
    for root, dirs, files in os.walk('.'):
        if root == '.':
            continue
        for f in files:
            fullfile = os.path.join(root, f)[2:]
            lowerfile = fullfile.lower()
            filedict[lowerfile] = fullfile
            if lowerfile[-4:] == '.xml':
                xmlfiles.append(fullfile)
    
    print 'Got %d files' % (len(filedict))
    print 'Got %d XML files' % (len(xmlfiles))
    
    # Now loop through XML files and look for cases that don't match
    for f in xmlfiles:
        with open(f, 'r') as df:
            linenum = 0
            for line in df:
                linenum += 1
                linelower = line.lower()
                for lower, real in filedict.iteritems():
                    idx = linelower.find(lower)
                    if idx >= 0:
                        if line[idx:idx+len(lower)] != real:
                            print '%s:%d -> %s' % (f, linenum, real)
     
    Essence likes this.
  4. xolotl

    xolotl Member

    And, what the heck - here's a patch to game/monDB.xml which should take care of it, as well. Can be applied (after unzipping) from inside the "game" directory with "patch < linux_case_fix.patch"

    (Edited with the actual correct instructions - I should've constructed the patchfile differently.)
     

    Attached Files:

    Krushak, ker- and Pulsewidth like this.
  5. ker-

    ker- Member

    actually it is "patch < linux_case_fix.patch" from the game dir. otherwise it creates an empty .orig and a .rej file in teh main dir...

    thanks, hopefully no crashes anymore now :D
     
    Krushak likes this.
  6. xolotl

    xolotl Member

    Oh, whoops. Right you are. Thanks!
     
  7. kit1980

    kit1980 Member

    Cool, you are my hero! (and Pulsewidth, who found the reason, of course) :)
    Open source community power!
    I'm going to test the patch today.
     
    Essence likes this.
  8. k0rd

    k0rd Member

    nice catch pulsewidth :)
     
  9. Krushak

    Krushak Member

    Yay thanks
     
  10. tarpit

    tarpit Member

    It works, thank you.
     
  11. D.S.

    D.S. Member

    I noticed and fixed it independently. Looks to me like a lot of copied and lightly-edited blocks, judging by the repeated errors. I also noticed that one inconsistent lack of capitalisation… then again, I didn't know about this forum until less than an hour ago.

    Still, at least it's publicly fixed now.
     
  12. Dimitri

    Dimitri Member

    Was getting the a similar backtrace, mostly when opening doors. Will check if the patch fixed it, thanks!

    Here is the backtrace, for the record:
    Code:
    #0  0x000000000054a199 in PHYSFS_read ()
    #1  0x0000000000484aae in Sprite::Load(char const*, char const*, int, int, int) ()
    #2  0x000000000048ba30 in SpriteMgr_AutoLoad(char const*, char const*, char const*, int, int, int) ()
    #3  0x00000000004c606b in Monster::RebuildSprites() ()
    #4  0x00000000004c82ee in Monster::Monster(monDBEntry*) ()
    #5  0x000000000045b5a1 in Level::SpawnNamedMonster(std::string, int) ()
    #6  0x000000000051dee6 in DirectorFillZoo(RoomRecord*) ()
    #7  0x000000000051ea40 in DirectorScanPass() ()
    #8  0x0000000000410ed9 in GameTick() ()
    #9  0x0000000000500739 in ParsePlayerInput() ()
    #10 0x000000000049231f in Mainloop() ()
    #11 0x0000000000493ad8 in main ()