trash fails on filesystem whose mount point isn't writable

Bug #340277 reported by Myk Melez
4
Affects Status Importance Assigned to Milestone
trash-cli (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: trash-cli

I run Ubuntu in a VMware Fusion VM on a Mac OS X host machine. I mount the host OS's filesystem in Linux using Fusion's Shared Folders feature, which mounts it at /mnt/hgfs with permissions that don't allow me to modify the mount point itself (although I can modify the files it mounts):

myk@myk:~$ ls -lad /mnt/hgfs
dr-xr-xr-x 1 myk myk 4192 2009-03-09 17:48 /mnt/hgfs

When I try to trash a file on that filesystem using the trash command from the trash-cli package, the program throws an exception because it can't write the file to /mnt/hgfs/.Trash-1000:

myk@myk:~$ touch /mnt/hgfs/myk/foo
myk@myk:~$ trash /mnt/hgfs/myk/foo
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/libtrash/__init__.py", line 266, in persist_trash_info
    os.makedirs(self.getInfoPath(), 0700)
  File "/usr/lib/python2.5/os.py", line 164, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.5/os.py", line 171, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/mnt/hgfs/.Trash-1000'
trash: cannot trash `/mnt/hgfs/myk/foo': [Errno 13] Permission denied: '/mnt/hgfs/.Trash-1000'

This command should succeed, moving the file to the trash folder in my home directory (~/.local/share/Trash/) if necessary, as does the utility distributed in this discussion forum thread <http://ubuntuforums.org/showpost.php?p=4916033>.

myk@myk:~$ lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10

myk@myk:~$ apt-cache policy trash-cli
trash-cli:
  Installed: 0.10.r55-0ubuntu1
  Candidate: 0.10.r55-0ubuntu1
  Version table:
 *** 0.10.r55-0ubuntu1 0
        500 http://us.archive.ubuntu.com intrepid/universe Packages
        100 /var/lib/dpkg/status

Revision history for this message
Andrea Francia (andrea-francia) wrote :

The trash-cli version shipped with ubuntu is quite old.
In the current upstream version it doesn't crash but simply print an error:

    $ trash-put --version
    trash-put 0.2.1
    $ sudo mount test-volume.img ./test-volume -o loop
    $ sudo mkdir ./test-volume/.Trash-1000/
    $ sudo chmod a-r ./test-volume/.Trash-1000/
    $ trash-put ./test-volume/foo
    trash: cannot trash `./test-volume/foo': [Errno 13] Permission denied: '/home/andrea/Desktop/bug-ubuntu-340277/test-volume/.Trash-1000/info'

I'm hope that the new version could be early packaged in Ubuntu, in the meantime you can install the upstream version with these commands:

   sudo apt-get install python-setuptools
   sudo easy_install trash-cli

As far I know the trashcan spec does NOT says that "the home trash directory SHALL be used as fallback" but they say that it COULD be used and the choice is up to the implementation. I personally thinks that using it a fallback is not a good idea, but if many users want this I could add this features. If you want this feature fill a bug in http://code.google.com/p/trash-cli/issues page.

Revision history for this message
Myk Melez (myk-melez) wrote :

Andrea: thanks for the helpful info! I do think this would be a useful fix, so I have filed a bug as you suggested: http://code.google.com/p/trash-cli/issues/detail?id=40

Revision history for this message
jpfle (jpfle) wrote :

Until trash-cli is updated in the repositories, we can also create an up-to-date deb package with the little script presented on the following comment: https://bugs.launchpad.net/ubuntu/+source/trash-cli/+bug/336410/comments/4

Changed in trash-cli (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.