Trash mechanism
David Faure
dfaure at trolltech.com
Mon Aug 30 00:48:23 EEST 2004
On Sunday 29 August 2004 22:40, C. Gatzemeier wrote:
>
> > > hmm, thought with the date "attached" we could spare us the separate meta
> > > info file tree if a file is moved to a trash subdirectory that
> > > corresponds to its original location.
> >
> > This doesn't work. Without meta info, if you delete A/B and later on A
> > itself, and then you restore A, it's going to come up with a strange
> > "A/B[dateofdeletion]" file in it,
>
> Yes, unless the date is striped or better the file is correctly not moved out
> because the deletion date preceeds the one of the requested undo action.
But what if you delete the same file (e.g. B) multiple times? The whole point of
this trash improvement is to be able to do that. That's what the fileid vs filename
distinction is for.
> That would be the cost of an implementation that would work without any extra
> metadata (unlikely?). But a trash directory like this would be logicaly
> usable even from the comand line or other filemanagers without any special
> undo tools.
Well, you still need to strip out the date of deletion, as well as the additional
"id" added to the file in case of multiple files deleted with the same name.
So if your command-line script has to do that, it could just as well get the
original path from the info/ file and move over the actual file from files/,
it's actually much simpler than "moving out the files in subdirectories that
were deleted earlier".
> BTW wouldn't pooled meta data also produce another permission (listing)
> problem?
No, because it would go in $topdir/.Trash/$uid/info, so only $uid can
read it - no listing problem. I think you forgot that we were talking about a $uid
subdir in non-home trash partitions?
> There is also a syncing issue, when permissions on the normaly used filesystem
> are changed possibly when files are recreated from the trash manually.
Like, you lost write access to the directory where the file used to be?
No problem, you can still drag it to another directory.
Same thing if the original directory doesn't exist at all anymore.
> BTW 2 how do you think the trash is mostly used? I for one tend to use it only
> against accidential deletion. So my trash is really rather small, most of the
> time. I don't think I keep any trash for longer than a week ;-)
The trash is used in all sorts of creative ways - I've seen people really use it
as storage, and constantly looking into it for digging up stuff out of it.
I've seen others too scared to ever empty the trash, not knowing if they might
need some file later on. There is a myriad of ways to use the trash :)
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the xdg
mailing list