Comments (12)
Thank you for your feedback, please try this new version, it should be fixed.
Let me know.
from trash-cli.
I've realised that this wrapper was responsible for my erroneous issue #41. The problem is that readlink -e
dereferences symlinks. Instead, you can use realpath -s
, which resolves mounts but not symlinks. i.e. the full command is
#!/usr/bin/env bash
# Workaround for trash-cli not being able to trash files on the *same* partition. https://github.com/andreafrancia/trash-cli/issues/38
for i in "$@"; do
fullpath="$(realpath -s "$i")"
fixedpath="$(echo "$fullpath" | sed "s,/HDD/$USER,$HOME/HDD,")"
/usr/bin/trash "$fixedpath"
done
from trash-cli.
Does your problem still persist with the latest version of trash-cli?
from trash-cli.
Yes, it still persists.
from trash-cli.
What is the output of trash --version?
from trash-cli.
I was using a day-old commit (7b76dc6), but I just tested again with the latest commit (74e5f3f) and this bug is still present.
$ /usr/bin/trash --version
trash 0.17.1.1
from trash-cli.
Seems related to the way trash-put interprets the parent directory of foo
in this particular case. But it seem also a somewhat complicated setup.
Please, tell me what is the output of this command:
readlink -f /HDD/protist/.SDDsymlinks/home/protist/.local/share/Trash
Can you paste the output of the faulty cases using the verbose option (i.e. using trash --verbose
)?
Thank you
from trash-cli.
Please use the latest version of trash-cli
(4b6aa5c), in this version trash-put
prints more information when used with the verbose option.
from trash-cli.
Admittedly, this seems like a complicated setup, but it makes some sense. I have two drives: a small SSD (/
) and a large HDD (/HDD
). Hence, the quick SDD contains /
, and includes most system and user directories. However, there is not enough room on the SDD for most of my working files, so my user has ~/HDD
, which points to the HDD (/HDD/protist
). I then also link ~/.local/share/Trash
to the HDD (/HDD/protist/.SDDsymlinks/home/protist/.local/share/Trash
). This is because most of the files that I trash would originally come from the HDD (~/HDD
). This means trashed items are only moved, not copied to another volume. Also, this means that I don't waste space on the SDD with files scheduled to be deleted.
Hence, the path you enquired about is at its literal path.
$ readlink -f /HDD/protist/.SDDsymlinks/home/protist/.local/share/Trash
/HDD/protist/.SDDsymlinks/home/protist/.local/share/Trash
I upgraded to the latest version of trash-cli (949d4d5).
$ cd ~/HDD
$ touch foo
$ /usr/bin/trash --verbose foo
trash: Volume of file: /HDD
trash: found unusable .Trash dir (should be a dir): /HDD/.Trash
trash: Failed to trash foo in /HDD/.Trash/1000, because :[Errno 13] Permission denied: '/HDD/.Trash'
trash: Failed to trash foo in /HDD/.Trash-1000, because :[Errno 13] Permission denied: '/HDD/.Trash-1000'
trash: cannot trash regular empty file 'foo'
$ /usr/bin/trash --verbose ./foo
trash: Volume of file: /HDD
trash: found unusable .Trash dir (should be a dir): /HDD/.Trash
trash: Failed to trash ./foo in /HDD/.Trash/1000, because :[Errno 13] Permission denied: '/HDD/.Trash'
trash: Failed to trash ./foo in /HDD/.Trash-1000, because :[Errno 13] Permission denied: '/HDD/.Trash-1000'
trash: cannot trash regular empty file './foo'
$ /usr/bin/trash --verbose /HDD/protist/foo
trash: Volume of file: /HDD
trash: found unusable .Trash dir (should be a dir): /HDD/.Trash
trash: Failed to trash /HDD/protist/foo in /HDD/.Trash/1000, because :[Errno 13] Permission denied: '/HDD/.Trash'
trash: Failed to trash /HDD/protist/foo in /HDD/.Trash-1000, because :[Errno 13] Permission denied: '/HDD/.Trash-1000'
trash: cannot trash regular empty file '/HDD/protist/foo'
$ cd /HDD/protist
$ /usr/bin/trash --verbose foo
trash: Volume of file: /HDD
trash: found unusable .Trash dir (should be a dir): /HDD/.Trash
trash: Failed to trash foo in /HDD/.Trash/1000, because :[Errno 13] Permission denied: '/HDD/.Trash'
trash: Failed to trash foo in /HDD/.Trash-1000, because :[Errno 13] Permission denied: '/HDD/.Trash-1000'
trash: cannot trash regular empty file 'foo'
$ /usr/bin/trash --verbose ~/HDD/foo # works
trash: Volume of file: /home
trash: '/home/protist/HDD/foo' trashed in ~/.local/share/Trash
from trash-cli.
With this commit (acaaf35) I've fixed a bug that prevented trash-cli
to detect the right volume when the trash directory is a link to a different volume. I'm not sure that it is enough to fix the behavior of trash-put
in your setup.
Please the try again and let me know the output using --verbose.
from trash-cli.
I ran through the tests above that failed. These all work now.
$ cd ~/HDD
$ touch foo
$ /usr/bin/trash --verbose foo
trash: Volume of file: /HDD
trash: Trash-dir: /home/protist/.local/share/Trash from volume: /HDD
trash: 'foo' trashed in ~/.local/share/Trash
$ touch foo
$ /usr/bin/trash --verbose ./foo
trash: Volume of file: /HDD
trash: Trash-dir: /home/protist/.local/share/Trash from volume: /HDD
trash: './foo' trashed in ~/.local/share/Trash
$ touch foo
$ /usr/bin/trash --verbose /HDD/protist/foo
trash: Volume of file: /HDD
trash: Trash-dir: /home/protist/.local/share/Trash from volume: /HDD
trash: '/HDD/protist/foo' trashed in ~/.local/share/Trash
$ touch foo
$ cd /HDD/protist
$ /usr/bin/trash --verbose foo
trash: Volume of file: /HDD
trash: Trash-dir: /home/protist/.local/share/Trash from volume: /HDD
trash: 'foo' trashed in ~/.local/share/Trash
However, the one that did work before now fails.
$ /usr/bin/trash --verbose ~/HDD/foo
trash: Volume of file: /home
trash: Trash-dir: /home/protist/.local/share/Trash from volume: /HDD
trash: found unusable .Trash dir (should be a dir): /home/.Trash
trash: Trash-dir: /home/.Trash/1000 from volume: /home
trash: Failed to trash /home/protist/HDD/foo in /home/.Trash/1000, because :[Errno 13] Permission denied: '/home/.Trash'
trash: Trash-dir: /home/.Trash-1000 from volume: /home
trash: Failed to trash /home/protist/HDD/foo in /home/.Trash-1000, because :[Errno 13] Permission denied: '/home/.Trash-1000'
trash: cannot trash regular empty file '/home/protist/HDD/foo'
from trash-cli.
Perfect! I ran through all the tests above, and everything is fine now. Thank you!
from trash-cli.
Related Issues (20)
- Cannot restore a file from a mounted cifs volume HOT 10
- verbose output HOT 1
- trash-empty: option to only empty files trashed prior to application start HOT 1
- Confirm Dialog on `trash-empty` HOT 5
- trash-put: cannot trash regular file @raffaem
- Slow trash-empty taking hours to delete HOT 1
- If a trash fails before everything is deleted, all the files that *were* deleted *cannot be restored* HOT 9
- Provide an option to send deleted items to macOS Desktop Trash. HOT 6
- Hitting return on trash-restore without entering a number results in unclear behavior HOT 1
- Crash while removing file/dir wth utf-8 chars HOT 2
- [Question] How to correctly answer "Proceed? (y/n)" when using trash-empty in script? HOT 4
- Crash with `--volumes`: AttributeError: 'PrintVolumesList' object has no attribute 'run_action' HOT 1
- ZSH completion very slow HOT 3
- Add option to preserve folders containing recently modified files
- ZSH completion does not allow to specify multiple files to trash HOT 1
- Don't force user to install old mock library HOT 10
- I have a number of bind mounts, and `trash-list` shows trashed items without any duplication. HOT 4
- having `--dry-run` for `trash-put` HOT 4
- PermissionError in trash-empty incorrectly user's .Trash folder HOT 1
- Add a way to trash from stdin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trash-cli.