Trash mechanism

Dave Cridland dave at cridland.net
Wed Aug 25 16:56:41 EEST 2004


On Wed Aug 25 14:00:43 2004, Mike Hearn wrote:
> In particular you could delete a file, compile some software, try 
> and undelete the file and find it was garbage collected to make 
> room for the compile even though none of those files are data you 
> care about.

Well... Any remotely sane trash concept would probably do the same, I 
hope.

I'd hate the compile to fail because it can't get the device space - 
even though I've deleted files to make sure it has that space. If I 
ask the computer to do something, I want it to do it. I obviously 
care about the files the compile's doing - that's why I asked the 
compile to happen.

I think advice to users has to remain "Don't delete stuff you want. 
If you do, it may be gone for good, although it might be recoverable."

To put it another way, files I don't care about are ones I've 
deleted. Files I do care about are ones I haven't. Anything that 
contradicts that makes things more complex for users, who're quite 
capable of telling the computer which files they no longer care about.

I think any undelete/trash system should be:

1) Garbage collectable somehow.
- IIRC, Windows does this.
2) Take up minimal space when it's used. (Like, say, by compressing 
the files.)
- IIRC, Windows does this.
3) Optional, both by default and by modifying.
- Windows definitely does this. I turn mine off. SHIFT-DEL in 
Explorer always bypasses.
4) Intended for the "Oh, bollocks[*], I didn't mean to do that!" 
case, not as a substitute for backups, version-control systems, or 
any other means of permenant storage.
- Windows as a whole is the embodiment of something you didn't mean 
to do, of course.

Oddly, I think Windows does this largely right - it even indicates 
quite clearly to the user whether they're deleting the file or not. 
(It takes up 99% of the CPU by doing so with an animation, but hey.)

I think we can do better, mind:

a) We can use preloads to handle write() returning ENOSPC in order to 
recover diskspace and repeat the write(), potentially.
b) We can get optional metadata on how important a file is, and 
maintain that after it's trashed.
c) We can use heuristics and all sorts when we're garbage collecting. 
Competing implementations should lead to some really neat concepts.

Dave.
--
[*] - A British term meaning "whoops"



More information about the xdg mailing list