emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating backups in temporary directories


From: Davis Herring
Subject: Re: creating backups in temporary directories
Date: Tue, 11 Sep 2007 14:17:27 -0700 (PDT)
User-agent: SquirrelMail/1.4.8-6.el3.2lanl

> The code in backup-buffer-copy already does part of this;
> it calls copy-file  in a way that uses O_EXCL.

Ah.  That's good; I was trying to provide a self-contained concept rather
than a patch, if you take my meaning.

>     If /tmp/foo~ already exists, rename it first to
> /tmp/backupforthebackup~
>     rather than unlinking it; we have to get it out of the way and use
> O_EXCL
>     even if we own it in case the directory's owner is the attacker.
>
> Why is this needed?  When we're doing the copy, the actual source file
> also exists.

(By "this" you must mean the rename instead of the unlink; I trust that
the reason for having to do one or the other was understood.)  I guess
it's not actually necessary.  I was thinking it would be better to reduce
the amount of time when there was no backup; but at this point the user
wants the current contents of the actual file to _become_ the backup, so
the existing backup is completely expendable.  (Of course, it gets more
complicated with numbered backups...)

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]