oberblastmeister / trashy

a cli system trash manager, alternative to rm and trash-cli
Apache License 2.0
362 stars 13 forks source link

Unable to clear trash when deleting dead symlink #97

Closed omernaveedxyz closed 1 year ago

omernaveedxyz commented 1 year ago

Expected behavior

When a dead symlinked file is deleted, it should be able to be cleared from the trash directory

Actual behavior

When a dead symlink is deleted, it correctly goes into the trash directory, but the trash restore/empty commands no longer work as long as the dead symlink is there

Steps to reproduce behavior

touch test
ln -sf test test2

trash put test
trash empty

trash put test2
trash empty

The final command will result in following error

thread 'main' panicked at 'assertion failed: file.exists()', /build/trashy-2.0.0-vendor.tar.gz/trash/src/freedesktop.rs:238:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
santibreo commented 1 year ago

The same was happening to me.

This issue is an issue with trash, but it was corrected by this commit. So updating trash dependency version from 3.0.1 to 3.0.2 should solve the issue. At least I have tried, and it solved my case.

perlinm commented 1 year ago

This issue is an issue with trash, but it was corrected by this commit. So updating trash dependency version from 3.0.1 to 3.0.2 should solve the issue. At least I have tried, and it solved my case.

Completed by #101. I think we can close this issue.

j-lakeman commented 6 months ago

Similar thing happened to me on trashy 2.0.0:

[I] ➜  ~ trash empty bash

3 items will be emptied
╭───┬──────────────┬───────────────────╮
│ i │ Time         │ Path              │
├───┼──────────────┼───────────────────┤
│ 2 │ 7 months ago │ /home/xxx/.bashrc │
│ 1 │ 7 months ago │ /home/xxx/.bashrc │
│ 0 │ 7 months ago │ /home/xxx/.bashrc │
╰───┴──────────────┴───────────────────╯
Are you sure? yes
thread 'main' panicked at 'assertion failed: file.exists()', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/trash-2.1.5/src/freedesktop.rs:238:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The three files are all dead symlinks. Pls reopen

santibreo commented 6 months ago

The issue was solved by committing this but this change is not incorporated to version 2.0.0 (as you can see here).

j-lakeman commented 6 months ago

Any idea when this will be incorporated in a new release?