andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.63k stars 177 forks source link

rm: cannot trash regular empty file '1.txt' #169

Closed gebangfeng closed 11 months ago

gebangfeng commented 4 years ago

I replaced the command trash-put with rm. Many machines do this, but an error such as rm: cannot trash regular empty file '1.txt' appears on one machine. There is no problem with the permission of the directory where the file is located. The user I am using has the permission.There is also a.local directory in the user's home directory.There are brothers know how to solve, please answer.

gebangfeng commented 4 years ago

我用rm替换了命令trash-put。许多机器都这样做,但是出现一个错误,例如rm: cannot trash regular empty file '1.txt' 出现在一台机器上。 文件所在目录的权限没有问题。我正在使用的用户具有该权限。还有一个。用户的主目录中的本地目录。有兄弟知道如何解决,请回

andreafrancia commented 4 years ago

Try these commands and paste here the output:

ls -ld . 1.txt
whoami
ZitroWasTaken commented 3 years ago

I have similar issues, the one thing I found suspicious, that trash -v ./script.sh gives this output:

trash: Volume of file: /
trash: Trash-dir: /home/zitro/.local/share/Trash from volume: /home
trash: found unusable .Trash dir (should be a dir): /.Trash
trash: Trash-dir: /.Trash-1000 from volume: /
trash: Failed to trash ./script.sh in /.Trash-1000, because :[Errno 13] Permission denied: '/.Trash-1000'
trash: cannot trash regular empty file './script.sh'

The file's location is /tmp/script.sh Additional info:

/tmp 
❯ ls -ld . ./script.sh
  whoami
drwxrwxrwt 1 root  root  2018 Apr 22 17:20 ./
-rwxr-xr-x 1 zitro zitro    0 Apr 22 16:33 ./script.sh*
zitro
ZitroWasTaken commented 3 years ago

Okay, so I did some research, and it turned out that even gio can't trash file in /tmp (What a great testing location I've chosen).

/tmp 
❯ gio trash ./script.sh 
gio: file:///tmp/script.sh: Trashing on system internal mounts is not supported

But, if you first mv the file to other writable location (like user's home folder ~/), you can easily trash it from there. Is there anyone up to task to implement this workaround, or this feature is not by design of the tool?

andreafrancia commented 11 months ago

@ZitroWasTaken please try the latest version of trash-cli, now it prints more error message and maybe it solve your problem. If this doesn't solve your problem feel free to open another issue.

@gebangfeng I'm closing your issue because I'have received feedback, feel free add a comment you need more help.