Jump to content

Crash on startup


fXKp5B
  • Pending

Hi, when I launch DST from Steam, it immediately crashes, before showing anything or printing anything interesting in the logs. Checking the system logs shows the following error:

[  668.663020] dontstarve_stea[42585]: segfault at 8 ip 00007f8183146876 sp 00007ffc71f6a310 error 4 in libX11.so.6.4.0[7f8183114000+8a000]

I tried to run DST under GDB to get a backtrace, but I just get a "Steam doesn't seem to be running. Trying to restart the game via Steam." message.

Thanks for the help, let me know if there's anything I can get you to solve this issue.

 

Edit: I've dug more into this. With a combination of libdebugme & gdb, I got a backtrace:

I put the following into the launch options in steam:

DEBUGME_OPTIONS=handle_signals=1:xterm=1 LD_PRELOAD=/home/user/dev/aur/libdebugme/bin/libdebugme.so %command%

I then started the program and quickly copy-pasted the command from the libdebugme logs:

libdebugme: failed to run gdb command: gdb -ex 'attach 146390' -ex 'set __debugme_go=1' -ex continue -ex finish

and got the following stack trace:

(gdb) bt
#0  debugme_debug (dbg_flags_=<optimized out>, dbg_opts_=<optimized out>) at src/debugme.c:108
#1  0x00007fb421974b36 in sighandler (sig=<optimized out>) at src/debugme.c:34
#2  <signal handler called>
#3  XGetICValues (ic=0x0) at ICWrap.c:289
#4  0x00007fb4218b58d8 in ?? ()
#5  0x00007ffefc652ba0 in ?? ()
#6  0x0000000000000001 in ?? ()
#7  0x0000000001d16810 in ?? ()
#8  0x0000000001be2ad0 in ?? ()
#9  0x000000000000220a in ?? ()
#10 0x00007ffefc652ad0 in ?? ()
#11 0x0000000001d16810 in ?? ()
#12 0x0000000000000000 in ?? ()

Looks like DST is calling XGetICValues with a null pointer. I unfortunately can't debug further, since DST doesn't come with debug symbols.

 

Someone on the Arch Linux wiki has also encountered this problem with another, non-Klei game, and they suggest it is a bug in SDL: https://wiki.archlinux.org/title/Steam/Game-specific_troubleshooting#Crash_on_start_in_libX11.so.6.3.0. However, that workaround does not work for DST.


Steps to Reproduce

When I launch DST from Steam, it immediately crashes.




User Feedback


Workaround for anyone else on arch linux:

$ asp checkout libx11
$ cd libx11/trunk
$ git apply <<EOF
commit 651b0119a8d8dc3b41480ec2f041b22cdaece292
Author: Flaviu Tamas <tamasflaviu@gmail.com>
Date:   Sun Oct 31 00:01:25 2021 -0400

    Fix DST

diff --git a/trunk/.SRCINFO b/trunk/.SRCINFO
new file mode 100644
index 0000000..d49c771
--- /dev/null
+++ b/trunk/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = libx11
+	pkgdesc = X11 client-side library
+	pkgver = 1.7.2
+	pkgrel = 1
+	url = https://xorg.freedesktop.org/
+	arch = x86_64
+	license = custom
+	makedepends = xorg-util-macros
+	makedepends = xtrans
+	depends = libxcb
+	depends = xorgproto
+	options = debug
+	options = !strip
+	source = https://xorg.freedesktop.org//releases/individual/lib/libX11-1.7.2.tar.bz2
+	source = icwrap.patch
+	sha512sums = d01e5c1848c76218605e5af2d353de6b301a251555b52a38dbe930e6635d5e8a92d1486eb6d328ad5d42a5939e0d16868ffa19a75e5a7863d1a32e0d0727bdc7
+	sha512sums = 02666f7a87ccc697a450374f0b0d6a832bef5510ead03d341c092d2addc1a24e562be0286e4a2dcf486b89934ddbacdfe53b44bcbcdd230f684697610fc785aa
+
+pkgname = libx11
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 47903d7..6133682 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -1,6 +1,7 @@
 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
 # Maintainer: Jan de Groot <jgc@archlinux.org>
 
+options=(debug !strip)
 pkgname=libx11
 pkgver=1.7.2
 pkgrel=1
@@ -12,14 +13,14 @@ url="https://xorg.freedesktop.org/"
 depends=('libxcb' 'xorgproto')
 makedepends=('xorg-util-macros' 'xtrans')
 license=('custom')
-source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.bz2{,.sig})
+source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.bz2 icwrap.patch)
 sha512sums=('d01e5c1848c76218605e5af2d353de6b301a251555b52a38dbe930e6635d5e8a92d1486eb6d328ad5d42a5939e0d16868ffa19a75e5a7863d1a32e0d0727bdc7'
-            'SKIP')
-validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>
-#validpgpkeys=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb@laas.fr>
-#validpgpkeys=('3BB639E56F861FA2E86505690FDD682D974CA72A') # Matt Turner <mattst88@gmail.com>
-#validpgpkeys=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # Adam Jackson <ajax@nwnk.net>
-#validpgpkeys=('C383B778255613DFDB409D91DB221A6900000011') # "Keith Packard <keithp@keithp.com>"
+            '02666f7a87ccc697a450374f0b0d6a832bef5510ead03d341c092d2addc1a24e562be0286e4a2dcf486b89934ddbacdfe53b44bcbcdd230f684697610fc785aa')
+
+prepare() {
+  cd libX11-${pkgver}
+  patch --forward --strip=1 --input="${srcdir}/icwrap.patch"
+}
 
 build() {
   cd libX11-${pkgver}
@@ -28,11 +29,6 @@ build() {
   make
 }
 
-check() {
-  cd libX11-${pkgver}
-  make check
-}
-
 package() {
   cd "${srcdir}/libX11-${pkgver}"
   make DESTDIR="${pkgdir}" install
diff --git a/trunk/icwrap.patch b/trunk/icwrap.patch
new file mode 100644
index 0000000..efae259
--- /dev/null
+++ b/trunk/icwrap.patch
@@ -0,0 +1,11 @@
+--- a/src/xlibi18n/ICWrap.c	2021-10-30 23:54:58.702382967 -0400
++++ b/src/xlibi18n/ICWrap.c	2021-10-30 23:55:28.558979114 -0400
+@@ -286,6 +286,8 @@
+     XIMArg *args;
+     char   *ret;
+ 
++    if (ic == NULL)
++	return (char *) NULL;
+     if (!ic->core.im)
+ 	return (char *) NULL;
+
EOF
$ makepkg -sf
$ sudo pacman -U libx11-1.7.2-1-x86_64.pkg.tar.zst

 

Share this comment


Link to comment
Share on other sites

Hey, I've looked into this some more, and it should be a straightforward fix. It looks like at least SDL 2.0.4 (from 2015) and better have a fix for this, and if you're running an older version of SDL, you've presumably forked it.

If you have forked it, this would take just a few minutes to fix. Here's the code in the latest version: https://github.com/libsdl-org/SDL/blob/19dee1cd16e38451f1d7beae67dd74b471b403a8/src/video/x11/SDL_x11window.c#L658-L662

Basically, just check if

windowdata->ic

is null before using it. Please let me know if there's anything else I can do to help get this fixed.

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...