AppRun icon indicating copy to clipboard operation
AppRun copied to clipboard

Getting segfault when trying to use libapprun_hooks

Open probonopd opened this issue 4 years ago • 15 comments

In an effort to solve https://github.com/probonopd/go-appimage/issues/49, I was trying to use libapprun_hooks.so with an existing AppImage.

To reproduce:

  1. Download https://timepirate.org/downloads/Commandoo.tar.gz and get the AppImage contained therein
  2. Run the AppImage (it works)
  3. Unpack the AppImage
  4. Replace AppRun with the script below, make it executable
  5. Download libapprun_hooks.so and put it in usr/lib64
  6. Try to run
#!/bin/sh

HERE="$(dirname "$(readlink -f "${0}")")"
export APPDIR="$HERE"

MAIN=$(grep -r "^Exec=.*" "$HERE"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
MAIN_BIN=$(find "$HERE/usr/bin" -name "$MAIN" | head -n 1)
LD_LINUX=$(find "$HERE" -name 'ld-*.so.*' | head -n 1)

echo "Run $MAIN_BIN from experimental self-contained bundle"

export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}"
export INTERPRETER="${LD_LINUX}"
export LD_PRELOAD=libapprun_hooks.so

exec "${MAIN_BIN}" "$@"

Result:

me@host:~/squashfs-root$ ./AppRun 
Run /home/me/squashfs-root/usr/bin/commandoo from experimental self-contained bundle
Segmentation fault

What am I doing wrong?

probonopd avatar Aug 02 '20 20:08 probonopd