Having a very large directory tree (including symlinks) prevents SRB2 from starting

Sparkette

Member
This is on Linux.


SRB2 started giving me an issue where it wouldn't start, and instead stayed frozen on "D_CheckNetGame(): Checking network game status." I was stumped as to what could be causing this. It wasn't until I tried running it under strace that I realized it was recursing through my entire file system, calling stat on everything.


Not long before, I installed ZoneBuilder under Wine. (It didn't actually run properly, but that's a different issue.) I placed its WINEPREFIX directory under the SRB2 directory, in ~/.srb2/zbwine. Well, one thing every WINEPREFIX directory contains is a "dosdevices" directory, containing symbolic links to where the emulated Windows drive letters should map. By default, this includes an entry mapping drive Z to the root directory, which of course takes the form of a symbolic link to the root directory. It had followed this symbolic link, and began iterating through the whole rest of the file system, which of course takes a very long time, especially considering it would end up doing it multiple times as it gets to other symbolic links, or even the same one again.


(Side note: I did an experiment where I created a directory containing a symlink pointing to that same directory, and it still launched pretty quickly. It seems to stop after a certain number of iterations, strangely before it hits the system path limit.)


I looked at the source code and found only one section of code that uses "stat", which is in filesrch.c, and it even contains comments suggesting the author was unsure whether symbolic links should be followed, and to change it to "lstat" if not. But unless I'm missing something (which isn't unlikely) it doesn't seem like that code is called at that point in the startup process.


Anyway, just thought I'd bring that to your attention, as well as that of anyone else who might be having this problem in the meantime.
 
Screenshot 2021-12-30 4.08.43 PM.png
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top