From 5178fb4c6b48bad9705cc6fbcf848601fd14d4df Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Thu, 14 Mar 2024 09:50:33 -0400 Subject: [PATCH] snapcraft/wrappers/remote-viewer: do not export XDG_ var The spec [1] contains this: > If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. > If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. > If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used. So let's not export those since applications should simply rely on the default/empty. Exporting those without any corresponding directory caused issue with `nano` as can be seen in the previous commit. Also, on a "normal" desktop environment, none of XDG_DATA_HOME, XDG_CONFIG_HOME and XDG_STATE_HOME are exported: ``` $ env | grep ^XDG_ XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg XDG_MENU_PREFIX=gnome- XDG_SESSION_DESKTOP=ubuntu XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=ubuntu:GNOME XDG_SESSION_CLASS=user XDG_RUNTIME_DIR=/run/user/1000 XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop ``` [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables Signed-off-by: Simon Deziel (cherry picked from commit 1c07fcf7de787facfcc26b4fe221d78016f6f7d9) --- snapcraft/wrappers/remote-viewer | 3 --- 1 file changed, 3 deletions(-) diff --git a/snapcraft/wrappers/remote-viewer b/snapcraft/wrappers/remote-viewer index 4caf7272d..085eab3de 100755 --- a/snapcraft/wrappers/remote-viewer +++ b/snapcraft/wrappers/remote-viewer @@ -7,9 +7,6 @@ run_cmd() { export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" export HOME="${SNAP_REAL_HOME}" export USER="${USERNAME}" - [ -z "${XDG_DATA_HOME:-}" ] && export XDG_DATA_HOME="${HOME}/.local/share/" - [ -z "${XDG_CONFIG_HOME:-}" ] && export XDG_CONFIG_HOME="${HOME}/.config/" - [ -z "${XDG_STATE_HOME:-}" ] && export XDG_STATE_HOME="${HOME}/.local/state/" exec unshare -U -r chroot "/var/lib/snapd/hostfs/" "${CMD}" "$@" }