After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 138058 - Ask to empty when unmounting media with items in trash
Ask to empty when unmounting media with items in trash
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Trash
2.16.x
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 143437 149584 166180 303154 311722 313641 316064 330260 347324 355969 355971 363493 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-03-25 05:24 UTC by Will Reinhart
Modified: 2010-09-13 16:28 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch against 2.16.3 (12.21 KB, patch)
2007-02-02 04:01 UTC, Jesse Stockall
none Details | Review

Description Will Reinhart 2004-03-25 05:24:11 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)".
Comment 1 Martin Wehner 2004-05-31 19:52:27 UTC
*** Bug 143437 has been marked as a duplicate of this bug. ***
Comment 2 Sebastien Bacher 2004-10-20 12:10:13 UTC
*** Bug 149584 has been marked as a duplicate of this bug. ***
Comment 3 Sebastien Bacher 2005-02-03 20:54:28 UTC
*** Bug 166180 has been marked as a duplicate of this bug. ***
Comment 4 Ryan F-D 2005-03-11 02:27:11 UTC
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.
Comment 5 Stefan Pauwels 2005-04-28 16:33:49 UTC
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.
Comment 6 Sebastien Bacher 2005-05-05 19:59:43 UTC
*** Bug 303154 has been marked as a duplicate of this bug. ***
Comment 7 Brent Smith (smitten) 2005-07-28 15:13:21 UTC
*** Bug 311722 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Le Thanh Duong 2005-08-18 13:43:23 UTC
*** Bug 313641 has been marked as a duplicate of this bug. ***
Comment 9 Federico Mena Quintero 2005-09-20 18:05:59 UTC
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.
Comment 10 Matthew Paul Thomas (mpt) 2005-11-30 17:09:04 UTC
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.
Comment 11 James Henstridge 2006-01-17 06:25:32 UTC
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.
Comment 12 Sebastien Bacher 2006-02-09 10:13:47 UTC
*** Bug 330260 has been marked as a duplicate of this bug. ***
Comment 13 Jonas De Vuyst 2006-02-11 20:12:09 UTC
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).
Comment 14 Christian Neumair 2006-02-26 08:55:02 UTC
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.
Comment 15 Teppo Turtiainen 2006-07-16 17:24:49 UTC
*** Bug 316064 has been marked as a duplicate of this bug. ***
Comment 16 Teppo Turtiainen 2006-07-16 17:24:56 UTC
*** Bug 347324 has been marked as a duplicate of this bug. ***
Comment 17 rogerioferro 2006-08-29 01:49:41 UTC
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...
Comment 18 Baptiste Mille-Mathias 2006-09-14 15:13:14 UTC
*** Bug 355969 has been marked as a duplicate of this bug. ***
Comment 19 Johannes Schmid 2006-09-14 15:19:11 UTC
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?
Comment 20 David Prieto 2006-10-06 07:31:37 UTC
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?
Comment 21 Christian Neumair 2006-10-06 08:08:44 UTC
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.
Comment 22 André Klapper 2006-10-19 21:22:19 UTC
*** Bug 363493 has been marked as a duplicate of this bug. ***
Comment 23 André Klapper 2006-10-19 21:23:01 UTC
*** Bug 355971 has been marked as a duplicate of this bug. ***
Comment 24 tomi 2006-10-20 10:05:31 UTC
Is this funcion now added in GNOME 2.16 or not
Comment 25 Sven Herzberg 2006-10-20 16:37:39 UTC
i don't think so
Comment 26 tomi 2006-10-20 17:46:05 UTC
great! Do they even do anything smart with their releases
Comment 27 Sven Herzberg 2006-10-20 18:13:30 UTC
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…)
Comment 28 tomi 2006-10-20 20:54:30 UTC
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.
Comment 29 David Prieto 2006-10-31 08:23:08 UTC
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.
Comment 30 tomi 2006-10-31 10:55:21 UTC
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! 
Comment 31 David Prieto 2006-10-31 13:24:12 UTC
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?
Comment 32 Johannes Schmid 2006-11-02 13:40:20 UTC
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...
Comment 33 Johannes Schmid 2006-11-02 14:31:43 UTC
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!
Comment 34 Andrew Jorgensen 2006-11-30 17:18:30 UTC
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!
Comment 35 Vitaliy Ischenko 2006-12-02 13:41:39 UTC
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
Comment 36 David Prieto 2006-12-04 10:54:24 UTC
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.
Comment 37 Dmitri 2006-12-25 22:55:55 UTC
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.
Comment 38 Jesse Stockall 2007-02-02 04:00:49 UTC
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.

Comment 39 Jesse Stockall 2007-02-02 04:01:37 UTC
Created attachment 81733 [details] [review]
Patch against 2.16.3
Comment 40 Alexander van Loon 2007-03-17 19:44:44 UTC
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?
Comment 41 Nick Veys 2007-03-22 02:35:08 UTC
Is 'unmount' misspelled or was it intended to be 'umount' on the dialog?
Comment 42 Sven Arvidsson 2007-09-05 20:09:14 UTC
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.
Comment 43 Federico Mena Quintero 2008-01-02 16:04:11 UTC
Nautilus now tells you if a volume has trash when unmounting it.  Closing the bug.
Comment 44 Johannes Rohr 2010-09-13 15:39:38 UTC
(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?