Trash specification, version 0.1

Alexander Larsson alexl at redhat.com
Mon Aug 30 19:09:06 EEST 2004


On Mon, 2004-08-30 at 15:47, Dave Cridland wrote:
> > > C) What gets written first? The info file or the actual trash 
> > file? > (I think the trash file, since that may simply be renamed 
> > into > position. Then the info file, so that if we run out of disk 
> > space, we > can gracefully continue. Some operating systems 
> > apparently flag a > device full error as a fatal error while 
> > deleting files. This is > embarrassingly stupid.)
> > 
> > I would support writing the info file first. An "orphaned" info 
> > file is
> > just a nuisance; an "orphaned" trash file is a piece of lost
> > information.
> > 
> > 
> Again, I'd say this is the other way around. Whichever, an 
> implementation obviously can't erase the original and then write the 
> trash file. Alexander's comments suggest that it probably doesn't, in 
> fact, matter - you have to open/create both files before filling in 
> the content of the info file anyway. My gut feeling is that you 
> generally want to handle the trashed file itself first, then add the 
> metadata, which by definition is less critical to lose.

Lose? rename is atomical. How would you lose data? Even in the copy case
if the copy fails you won't delete the source file.

I think what we decided was to do metadata first, in an atomic way to
avoid races, and when you have the filename in the info dir you know its
safe to use that name in the files dir.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's a leather-clad crooked househusband whom everyone believes is mad. She's 
an enchanted red-headed bounty hunter descended from a line of powerful 
witches. They fight crime! 




More information about the xdg mailing list