Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

desktop-common.sh deletes XDG dirs and creates self-referential symlinks on classic snap first launch

Đang mở Phù hợp với người mới
#3,316 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
bash
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu trong desktop-common.sh quanh các dòng 204–213 và xem xét đường dẫn tạo symlink XDG dưới classic confinement. Nếu có thể, hãy tái hiện bằng một lần khởi chạy snap mới, sau đó xác minh rằng các thư mục real-home tiêu chuẩn vẫn nguyên vẹn và hành vi của strict-confinement vẫn tạo ra các liên kết như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

  1. Fresh Ubuntu install, user has standard XDG directories (Desktop, Documents, etc.)
  2. Install WaveTerm snap: snap install waveterm
  3. Launch WaveTerm for the first time
  4. 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
Ngôn ngữ chính
Go
Star
22.3k
Fork
1.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wavetermdev/waveterm

Tất cả issue của wavetermdev/waveterm

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.