andreafrancia / trash-cli

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

trash-empty ignores NFS mountpoints #229

Closed ytoku closed 2 years ago

ytoku commented 2 years ago

Describe the bug

trash-empty command does not list and clean NFS mountpoints.

The problem was introduced at commit 22e655b3 to solve issue #214. PR #178 fixed same problem before.

trash-cli version

trash-put 0.22.4.16

Operating system:

Ubuntu 22.04

To Reproduce

  1. Mount NFS
  2. Execute trash-empty
$ sudo mount -t nfs4 nfsserver:/export /mnt/nfs
$ trash-empty        
Would empty the following trash directories:
    - /home/user/.local/share/Trash
    - /.Trash-1000
    - /home/.Trash-1000
    - /boot/.Trash-1000
    - /boot/efi/.Trash-1000
Proceed? (y/n) 

Expected behavior

trash-empty should list and clean trash directories in NFS mountpoints too.

$ sudo mount -t nfs4 nfsserver:/export /mnt/nfs
$ trash-empty        
Would empty the following trash directories:
    - /home/user/.local/share/Trash
    - /.Trash-1000
    - /home/.Trash-1000
    - /boot/.Trash-1000
    - /boot/efi/.Trash-1000
    - /mnt/nfs/.Trash-1000
Proceed? (y/n) 

Or trash-empty should check all mountpoints and simply ignore it if the trash directory does not exist.

$ sudo mount -t nfs4 nfsserver:/export /mnt/nfs
$ trash-empty        
Would empty the following trash directories:
    - /home/user/.local/share/Trash
    - /mnt/nfs/.Trash-1000
Proceed? (y/n) 

Related issues

issue #214, PR #178

andreafrancia commented 2 years ago

Understood.

Unfortunately at the moment I am unable to implement the solution soon. If anyone wants to send a pull request they are welcome.

ehusby commented 2 years ago

I installed trash-cli with pip today, and found that I needed to use the fix in PR https://github.com/andreafrancia/trash-cli/pull/230 in order for the trash-list command to list the items trashed on my primary NFS filesystem.

andreafrancia commented 2 years ago

The PR #230 seems good, I just need someone that can test it on an environment with NFS mount points. At the moment I don't have yet access to any machine with NFS where I can test trash-cli. If you want to use #230 PR try this:

$ pip uninstall trash-cli
$ pip install git+https://github.com/masgouri/trash-cli@patch-1

If the patch works please add a comment to this page letting me know. I will merge the patch.

ehusby commented 2 years ago

The patch as applied through pip install works for me!

andreafrancia commented 2 years ago

Thank you @ehusby

ytoku commented 2 years ago

nfs fstype is fixed by #230, but nfs4 fstype is not still fixed. Please merge #244.

andreafrancia commented 2 years ago

Merged! Thank you @ytoku