desktop-common.sh deletes XDG dirs and creates self-referential symlinks on classic snap first launch
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- bash
- Ambito
- cli
Direzione di ricerca
Inizia in desktop-common.sh intorno alle righe 204–213 e esamina il percorso di creazione dei symlink XDG in classic confinement. Riproduci il problema con un nuovo avvio di snap, se possibile, quindi verifica che le directory real-home standard rimangano intatte e che il comportamento di strict-confinement continui a creare i link previsti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
On first launch of the WaveTerm snap (v0.14.5, Ubuntu 26.04), desktop-common.sh destroyed all standard XDG user directories (Desktop, Documents, Downloads, Music, Pictures, Public, Templates, Videos) and replaced them with broken self-referential symlinks, making them inaccessible from the file manager.
Root cause
WaveTerm uses confinement: classic, which means $HOME is not isolated — it stays as the user's real home (e.g. /home/leeCZ). The desktop-common.sh script was written for strict confinement where $HOME = $SNAP_USER_DATA ≠ $REALHOME. With classic confinement both variables are identical.
The broken code path (around line 204–213 of desktop-common.sh):
# can_open_file uses "head -c0" which always fails on directories → sets needs_xdg_links=true
b="$(realpath "${XDG_SPECIAL_DIRS_PATHS[$i]}" --relative-to="$HOME")"
if [ -e "$REALHOME/$b" ]; then
if [ -d "$HOME/$b" ]; then
rmdir "$HOME/$b" # ← DELETES the real directory
fi
if [ ! -e "$HOME/$b" ]; then
ln -s "$REALHOME/$b" "$HOME/$b" # ← ln -s /home/user/Desktop /home/user/Desktop
fi # (points to itself — both vars are /home/user)
fi
Steps to reproduce
- Fresh Ubuntu install, user has standard XDG directories (Desktop, Documents, etc.)
- Install WaveTerm snap:
snap install waveterm - Launch WaveTerm for the first time
- Open the file manager — standard home folders are now inaccessible broken symlinks
Expected
Snap home ($SNAP_USER_DATA) gets symlinks pointing to real XDG dirs — leaving the real home untouched.
Actual
Real XDG directories are deleted and replaced with self-referential symlinks in the real home:
lrwxrwxrwx Desktop -> /home/user/Desktop
lrwxrwxrwx Documents -> /home/user/Documents
...
Suggested fix
Guard the symlink creation block so it only runs when $HOME != $REALHOME (i.e. strict confinement):
if [ $needs_xdg_links = true ] && [ "$HOME" != "$REALHOME" ]; then
Notes
The bug also re-triggers on every snap version update (when SNAP_DESKTOP_COMPONENTS_NEED_UPDATE=true), so affected users will keep hitting it after each WaveTerm upgrade until fixed.
Environment
- WaveTerm: 0.14.5 (snap revision 204, classic confinement)
- OS: Ubuntu 26.04
- Shell: bash
- Lingua principale
- Go
- Stelle
- 22.3k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wavetermdev/waveterm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
wavetermdev/waveterm#3481 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
wavetermdev/waveterm#3435 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
wavetermdev/waveterm#3432 ·
-
enhancement triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
wavetermdev/waveterm#3431 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
wavetermdev/waveterm#3428 ·
Tutte le issue di wavetermdev/waveterm
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·