trash-cli
trash-cli copied to clipboard
`trash-put` hangs indefinitely if ownership of .Trash-<UID> is wrong
Describe the bug
When the ownership of the trash directory is incorrect, trash-put
hangs indefinitely trying to trash files.
trash-cli version 0.24.5.26 Originally found in 0.24.4.17; I cloned the latest git tag and confirmed the same behavior.
Operating system:
- OS: NixOS
To Reproduce
$ cd /external_drive
$ mkdir -p .Trash-$UID
$ bad_uid="$(( $UID + 1 ))"
$ sudo chown $bad_uid:$bad_uid .Trash-$UID
$ touch ./file_to_trash
$ trash-put -vv ./file_to_trash
trash-put: attempt for creating /external_drive/.Trash-1000/info/file_to_trash_35082.trashinfo failed.
trash-put: attempt for creating /external_drive/.Trash-1000/info/file_to_trash_24857.trashinfo failed.
trash-put: attempt for creating /external_drive/.Trash-1000/info/file_to_trash_3626.trashinfo failed.
...
Expected behavior
I would expect trash-cli
to fail, since a permission error is not recoverable.
Perhaps something similar to:
...
$ trash-put ./file_to_trash
trash-put: cannot trash regular empty file 'file_to_trash' (from volume '/external_drive')
trash-put: `- failed to trash file_to_trash in /external_drive/.Trash-1000, because failed to create /external_drive/.Trash-1000/info/file_to_trash_12345.trashinfo: Permission denied