Some time ago I wrote here about race condition during file saving
(http://groups.google.com/group/vim_dev/tree/browse_frm/month/2009-01/0049693b73a6a1e6).
Some of you didn't share my opinion about this problem and said
"File systems is not databases with ACID properties". Ok, I agree and know
it is rather POSIX semantic's fault. But my case has come back to me.

In that thread, I suggested that rename() syscall should improve bahaviour
beacuse of atomical nature of this syscall. One of argument against using
rename() was that it would break hard and soft links.

In soft links case, I can't imagine how rename() could break it. If process
atomically exchange file which is pointed to by symlink, nothing will break
down. Even, if it is chain of symlinks.

In hard links case, really there is a problem, and this case should be
treated individually (fortunately, hardlinks are rather relatively rare
case). But in other cases, rename() should be safe.

Furthermore, even now, vim changes inode of edited file:

    # ls -li testfile 
    2955134269 -rw------- 1 root root 15 Jan 25 22:44 testfile
    # vim testfile
    [...edit file here...]
    # ls -li testfile 
    2955134271 -rw------- 1 root root 20 Jan 25 22:44 testfile

rename() would behave identically and moreover would be atomic.

So, I have a little request to developers. Please, read it again and try
to understand me. Atomic rename() is better solution. It's not so stupid
as it may appear at first look and shouldn't break to much. :-)

Regards.

-- 
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui