Skip to content

Resolve symlink homes when choosing the trash device - #116

Open
ac1982 wants to merge 1 commit into
arsenetar:masterfrom
ac1982:fix/symlink-home-device
Open

ac1982 wants to merge 1 commit into
arsenetar:masterfrom
ac1982:fix/symlink-home-device

Conversation

@ac1982

@ac1982 ac1982 commented Oct 12, 2026

Copy link
Copy Markdown

Fixes #98.

When the home directory is a symlink located on a different filesystem from its target, the Freedesktop backend uses lstat on the link to choose the trash device. A file inside the actual home is then treated as external, potentially failing to find a writable volume trash even though its home trash is available.

Resolve the home path before probing its device. The source path still uses lstat, so trashing a symlink moves the link itself. Regression cases cover ordinary files and symlink sources, including the initially absent home trash.

Validation on Linux/arm64, Python 3.14.4:

  • Both new cases fail before the fix and pass afterward.
  • Full suite: 13 passed, 1 Windows-only module skipped. Tilde expansion was redirected to a temporary test directory before importing the suite, to isolate its home-directory file operations.
  • A separate real-filesystem check used a home symlink on /tmp pointing into /dev/shm (different device IDs) and verified the file and its trashinfo reached the home trash.
  • Flake8, Black for changed files, and git diff --check pass.

macOS and Windows were not run locally. Developed and verified with AI assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot find trash directory if home is symlink on Linux

2 participants