GNOME Bugzilla – Bug 138058
Ask to empty when unmounting media with items in trash
Last modified: 2010-09-13 16:28:42 UTC
I use nautilus to move pictures from my digital camera to my computer. Several times after deleting items on the camera, I have forgotten to empty the trash, so a large fraction of the memory stick is filled with a .Trash folder that I can't remove with the camera's file managment functions. It would be nice if nautilus would ask before unmounting a removeable device with files in the trash. What's needed is a dialog asking something like "There are 24 files totalling 30 megabytes in the trash on /mnt/digicam. Do you want to delete those files now? (Delete Files) (Keep Files) (Don't Unmount)".
*** Bug 143437 has been marked as a duplicate of this bug. ***
*** Bug 149584 has been marked as a duplicate of this bug. ***
*** Bug 166180 has been marked as a duplicate of this bug. ***
This seems the right place for this one as it seems to be part of the same general problem. When I delete something on any transient volume, Nautilus does a 'move' to the .Trash folder on that volume. This is understandable, as a 'file relink' has a far lower cost than a copy-then-delete. What is annoying is that even after emptying the trash, the .Trash folder remains and remains locked open by FAM. This means I cannot properly unmount these filesystems or rely on autofs to do so automatically when I am not using them. What is perhaps worse is that when I restart, FAM attempts to restore the open-file on the transient filesystem, even if it isn't mounted (thus triggering autofs to do so.) I am willing to abandon use of autofs in favor of other methods of handling transient filesystems, but as far as I can tell, the problem isn't there. You can contact me at sithriel-at-earthlink-dot-net.
I think this is an important issue: It is very anoying not being able to umount a disk that is not used by any program just because there is an empty .Trash-user that has to be deleted first.
*** Bug 303154 has been marked as a duplicate of this bug. ***
*** Bug 311722 has been marked as a duplicate of this bug. ***
*** Bug 313641 has been marked as a duplicate of this bug. ***
This needs to be tested again with the latest code. Does FAM keep a monitor open even after trying to unmount the removable volume from Nautilus? If so, the code around nautilus-merged-directory.c:merged_remove_real_directory() is lacking a call to remove the FAM monitor.
This is not a good approach if you are, in the long term, trying to remove the necessity for manual "unmounting". Perhaps much of the problem could be satisfied by offering to delete original photos when importing, and also by encouraging use of bug 302038's "Erase Disk..." item for erasing all items.
Note that FAM monitors are dropped before unmount if you are using the GnomeVFSVolumeMonitor APIs to perform the unmount. When using this API, a notification is sent to interested applications before unmount. Nautilus will drop FAM watches on the volume's trash folder and close any windows opened on the volume. The trash applet will also drop watches on the trash folder. I'd also recommend against pushing the "format disk" action as a way to delete all files on removeable media, since it can be problematic in some cases: 1. some devices will store user settings along with the photos/media files on the volume. 2. Olympus digital cameras only enable the panoramic photo assist feature if you use Olympus brand xD memory cards. Reformatting the card from the computer deletes the magic "I'm an Olympus xD card" signature, disabling the feature in the process. 3. many other devices recommend only formatting media with the device itself.
*** Bug 330260 has been marked as a duplicate of this bug. ***
Note that 'duplicate' bug 330260 is about there being different .Trash-$USER directories on removable disks with non-user-aware file systems (e.g. VFAT).
Updating version. Might be nice to have this as part of our new (to be introduced in 2.16) trash concept discussed in bug 315022.
*** Bug 316064 has been marked as a duplicate of this bug. ***
*** Bug 347324 has been marked as a duplicate of this bug. ***
I have a sugestion to make this more intuitive: 1. When you delete a file in a transient volume, should appear a trash can emblem in the volume icon. 2. When you right click in the volume icon, should have an option to empty the trash can for this volume. I think it would make the thing more intuitive...
*** Bug 355969 has been marked as a duplicate of this bug. ***
So, this problem is well known and the solution is quite easy (if there is nobody out there I can even create a patch!). What is the problem with this bug?
Hello, wasn't this milestoned for 2.14? People are offering to write a patch here, what's the big problem to get this going? Oh, and have you thought about the possibility to give the user two options: the one to the right (highlighted) = delete files, the one in the center = move to user's trash and the one to the left = cancel?
Johannes: Feel free to come up with a patch! :) David: I think we should offer "Don't Empty Trash", "Cancel", "Empty Trash" I don't really see the advantage of the additional functionality you propose, having four buttons in a dialog doesn't sound like a good idea.
*** Bug 363493 has been marked as a duplicate of this bug. ***
*** Bug 355971 has been marked as a duplicate of this bug. ***
Is this funcion now added in GNOME 2.16 or not
i don't think so
great! Do they even do anything smart with their releases
Comment #26 from tomi (points: 2): > great! Do they even do anything smart with their releases Well, they do really smart things: #1 "they" created a nice document http://live.gnome.org/CodeOfConduct #2 2.16 is a lot nicer to use than 2.14, even if this issue remains If you are so annoyed by this bug, there are several ways to get it fixed: #1 read the source code and provide a patch (this is the time people oftem complain about having no idea where to look for, just ask here, people will help you) #2 Get someone to fix this for you (I would do this if I had time, but time's money, I guess you understand…)
sorry for jumping like this! I was wrong I apologies. This ppl are contributing usually for free. But I just got very pissed since this feature gives us a lot of touble with our students in school. Not to mention that this issue wAs on the roadmap for 0.14 and I believe an unoffical patch was also writen.
Is this issue really that hard to fix, or do the devs just want to let it be? People have been asking for a solution since 2.5 years ago and it looks like the kind of issue that could be solve in half an hour.
I believe that they just want it to let it be! Apperantly they like this TRASH behaviour and are unwilling to change it. Although LOTS*LOTS of ppl have already said that it gives them trouble! Personally I've switched to KDE on my home computere a week ago cos I got tired of such little things such as this one! But on other computers, such as our school, and my server I'll probably be running GNOME still, since its more stable than KDE and less resource hungry!
I just talked to Sebastien Bacher and he told me that devs are just too busy to work on this, so could someone write a patch for this? Maybe Johannes Schmid from post 19?
Could someone point me to the right direction where this can be fixed or if there is anything special I need to deal with? The nautilus codebase is large...
Hi! OK, appending <a href="http://pastebin.ca/234386">this</a> to nautilus-application.c:volume_unmounted_callback() could help but I am not sure if it is the correct way. And I am still missing the code to really delete the directories because gnome_vfs_async_transfer is simply not documented... Would be really nice if someone would simple write a empty_trash_on_volume(GnomeVFSVolume* volume). This could also go into gvfs!
I think the description of this bug should be something more like "nautilus leaves trash on removable devices" or something. When there's disagreement about how a bug should be solved the description should describe the problem, not a proposed solution. The problem here is that deleting items from a removable device does not free the space on the device. It is also a problem that in order to free up that space one must empty all their trash, not just the trash on the device. I would prefer that user-removable / user-mounted devices be treated like remote filesystems with regard to trash (like sftp://, for instance). That way the user would be presented with a dialog saying that the items can't be moved to the trash and asking if they're sure they want to delete. I haven't looked at the code (I don't do C yet, sorry) but this doesn't sound like a very difficult solution. Make it configurable through gconf-editor if enough people disagree. Another acceptable solution would be to move the items to the user's trash bin in their home directory rather than store them on the device. Asking the user what to do might be okay but I'll bet there would be a great deal more disagreement about how that should be done. In any case I think this is a very serious problem that needs to be solved. Grandma's MP3 player is getting full and deleting old episodes of "A Prairie Home Companion" doesn't help for some reason!
I think that there is a code for deleting files without moving them to Trash it is triggered with "Shift + Delete". And there is a dialog which informs, that files will be deleted permanently
The problem with that is, people who don't know why deleting files doesn't increase free space won't probably know that they can press "Shift + Delete" to really delete stuff. The whole process should be transparent for the user, and none of the existing workarounds are.
I'm pretty new to Linux, so I never realized the trash bin in USB exists... until I've done a Google search on this issue. I agree this is a serious issue to newcomers and well, yea, it kinda destroys your Flash drive in the long run.. Really disappointed by whole USB deal.
Attached is a patch against 2.16.3 to prompt the user when they unmount a drive or volume with trash on it. It's my first time hacking on Gnome so I'm sure there is room for improvement.
Created attachment 81733 [details] [review] Patch against 2.16.3
This was just on Planet GNOME: http://blogs.gnome.org/view/thos/2007/03/17/0 So, if this problem is fixed now, can this bug be closed?
Is 'unmount' misspelled or was it intended to be 'umount' on the dialog?
This doesn't work for some of my devices (e.g. my ipod), I'm guessing this is because it's ejected and not unmounted.
Nautilus now tells you if a volume has trash when unmounting it. Closing the bug.
(In reply to comment #43) > Nautilus now tells you if a volume has trash when unmounting it. Closing the > bug. No, it does not. Unfortunately. Has the fix been removed again in the meatime?