Skip to content

Getting segfault when trying to use libapprun_hooks #7

@probonopd

Description

@probonopd

In an effort to solve probonopd/go-appimage#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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions