I had a quick look. FWIW, the snap sandbox isnāt the problem. It doesnāt do anything except for sandboxing the child process, and as such it will not move your files around. However, what IMO appears to be the source of the problem is KDE Frameworks 6 snap which the vlc snap uses to provide the runtime.
Specifically, I installed vlc snap from edge, which pulled in the dependencies:
$ snap list vlc kf6-core24
Name Version Rev Tracking Publisher Notes
kf6-core24 6.10.1-6.20.0-6.5.3-25.08.3 36 latest/stable kdeā -
vlc 4.0.0-dev-37239-g012ad39687 4367 latest/edge videolanā -
the vlc app in the snap is declared this way:
15 ā apps:
16 ā vlc:
17 ā command: usr/bin/vlc-snap-wrapper.sh
18 ā common-id: org.videolan.vlc
...
46 ā command-chain:
47 ā - snap/command-chain/gpu-2404-wrapper
48 ā - snap/command-chain/desktop-launch
which invokes desktop-launch, provided by kf6-core24. Subsequently snap/command-chain/desktop-launch6 from kf6-core24 attempts to āupdateā user dirs for some reason. It does quite a bit:
# If needs XDG update and xdg-user-dirs-update exists in $PATH, run it
if [ "$needs_xdg_update" = true ] && command -v xdg-user-dirs-update >/dev/null; then
xdg-user-dirs-update
update_xdg_dirs_values
fi
# Create links for user-dirs.dirs
if [ "$needs_xdg_links" = true ]; then
if [ "$HOME" != "$SNAP_REAL_HOME" ]; then
for ((i = 0; i < ${#XDG_SPECIAL_DIRS_PATHS[@]}; i++)); do
b="$(realpath "${XDG_SPECIAL_DIRS_PATHS[$i]}" --relative-to="$HOME" 2>/dev/null)"
if [[ -n "$b" && "$b" != "." && -e "$SNAP_REAL_HOME/$b" ]]; then
[ -d "$HOME/$b" ] && rmdir "$HOME/$b" 2> /dev/null
[ ! -e "$HOME/$b" ] && ln -s "$SNAP_REAL_HOME/$b" "$HOME/$b"
fi
done
fi
else
# If we aren't creating new links, check if we have content saved in old locations and move it
for ((i = 0; i < ${#XDG_SPECIAL_DIRS[@]}; i++)); do
old="${XDG_SPECIAL_DIRS_INITIAL_PATHS[$i]}"
new="${XDG_SPECIAL_DIRS_PATHS[$i]}"
if [ -L "$old" ] && [ -d "$new" ] && [ "$(readlink "$old" 2>/dev/null)" != "$new" ] &&
(is_subpath "$old" "$SNAP_USER_DATA" || is_subpath "$old" "$SNAP_USER_COMMON"); then
mv -vn "$old"/* "$new"/ 2>/dev/null
elif [ -d "$old" ] && [ -d "$new" ] && [ "$old" != "$new" ] &&
(is_subpath "$old" "$SNAP_USER_DATA" || is_subpath "$old" "$SNAP_USER_COMMON"); then
mv -vn "$old"/* "$new"/ 2>/dev/null
fi
done
fi
IDK why this is needed, but thereās probably a good reason for it. I suppose this is ok and relevant to 99% of cases, except one like yours. Since the home interface is connected, the snap is allowed to access your real $HOME and mess things up.
The kf6-core26 snap is published directly by KDE. Unfortunately they do not list any contact points where you could report bugs or issues. I cannot tell whether the desktop-launch script is something they came up with, or perhaps something that snapcraft adds automatically.
@mr_cal do you know where the desktop-launch wrappers come from? or, do you how to reach out to the KDE folks who publish the snap?
edit: found a similar pattern in the gnome-46-2404 runtime snap in command-chain/desktop-launch script.