From df6c714d8253b4fd837fecc549a46c8685bc4fa6 Mon Sep 17 00:00:00 2001 From: pennae Date: Thu, 22 Apr 2021 17:18:46 +0200 Subject: [PATCH] libreoffice: kill private dbus instance on exit if the libreoffice wrapper doesn't find a dbus instance in the environment it starts one, but then neglects to clean it up. over time this can litter the system with orphaned dbus instances. kill the daemon as well instead of just removing the socket directory. --- pkgs/applications/office/libreoffice/wrapper.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/office/libreoffice/wrapper.sh b/pkgs/applications/office/libreoffice/wrapper.sh index 806dd0806ad5..9ab3a907a985 100644 --- a/pkgs/applications/office/libreoffice/wrapper.sh +++ b/pkgs/applications/office/libreoffice/wrapper.sh @@ -2,7 +2,7 @@ export JAVA_HOME="${JAVA_HOME:-@jdk@}" #export SAL_USE_VCLPLUGIN="${SAL_USE_VCLPLUGIN:-gen}" -if uname | grep Linux > /dev/null && +if uname | grep Linux > /dev/null && ! ( test -n "$DBUS_SESSION_BUS_ADDRESS" ); then dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus" if ! test -d "$dbus_tmp_dir" && test -d "/run"; then @@ -14,6 +14,7 @@ if uname | grep Linux > /dev/null && fi dbus_socket_dir="$(mktemp -d -p "$dbus_tmp_dir")" "@dbus@"/bin/dbus-daemon --nopidfile --nofork --config-file "@dbus@"/share/dbus-1/session.conf --address "unix:path=$dbus_socket_dir/session" &> /dev/null & + dbus_pid=$! export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_socket_dir/session" fi @@ -27,5 +28,5 @@ done "@libreoffice@/bin/$(basename "$0")" "$@" code="$?" -test -n "$dbus_socket_dir" && rm -rf "$dbus_socket_dir" +test -n "$dbus_socket_dir" && { rm -rf "$dbus_socket_dir"; kill $dbus_pid; } exit "$code"