[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: creating backups in temporary directories
From: |
David Kastrup |
Subject: |
Re: creating backups in temporary directories |
Date: |
Mon, 10 Sep 2007 21:55:11 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
"Davis Herring" <address@hidden> writes:
>> Well, seems I misread the manual page for open/creat. I thought that
>> without O_EXCL, the file would get replaced.
>>
>> Well, then there still is the contorted way of hard linking /tmp/foo
>> to /tmp/foo~, opening /tmp/randomfilename for write, renaming it to
>> /tmp/foo and then finishing the write operation.
>
> Why not just rename /tmp/foo to /tmp/foo~, then open /tmp/foo with O_EXCL?
> If it fails, then write (again with O_EXCL) to /tmp/randomfile so that
> the user's work is on disk -somewhere-, and tell them that they have
> enemies.
I would simply not save at all if O_EXCL fails, leave the buffer
marked as modified, and set a buffer-permanent local variable
save-only-when-nonexistent to buffer-filename. Attempts to save the
buffer to a file with the filename save-only-when-nonexistent will use
O_EXCL.
Auto save files should always be opened O_EXCL.
When a file lock for a non-existing file is created,
save-only-when-nonexistent is set at the same time. Hm, this is sort
of a mess. There will always be somewhat predictable names on /tmp
and similar. Perhaps we should have some rule not to write through
symlinks in such directories after all.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Re: creating backups in temporary directories, (continued)
- Re: creating backups in temporary directories, Stefan Monnier, 2007/09/07
- Re: creating backups in temporary directories, Richard Stallman, 2007/09/08
- Re: creating backups in temporary directories, Stefan Monnier, 2007/09/09
- Re: creating backups in temporary directories, David Kastrup, 2007/09/09
- Re: creating backups in temporary directories, Andreas Schwab, 2007/09/09
- Re: creating backups in temporary directories, David Kastrup, 2007/09/09
- Re: creating backups in temporary directories, Davis Herring, 2007/09/10
- Re: creating backups in temporary directories,
David Kastrup <=
- Message not available
- Re: creating backups in temporary directories, Davis Herring, 2007/09/10
- Re: creating backups in temporary directories, Richard Stallman, 2007/09/11
- Re: creating backups in temporary directories, Davis Herring, 2007/09/11
- Re: creating backups in temporary directories, Richard Stallman, 2007/09/09
- Re: creating backups in temporary directories, Stefan Monnier, 2007/09/09
- Re: creating backups in temporary directories, Davis Herring, 2007/09/07
- Re: creating backups in temporary directories, Chris Moore, 2007/09/08
- Re: creating backups in temporary directories, Richard Stallman, 2007/09/08
- Re: creating backups in temporary directories, Stefan Monnier, 2007/09/09
- Re: creating backups in temporary directories, David Kastrup, 2007/09/09