ports/61901: editors/vim: file loss with softupdates

Radim Kolar hsn at netmag.cz
Sun Jan 25 18:40:13 UTC 2004

>Number:         61901
>Category:       ports
>Synopsis:       editors/vim: file loss with softupdates
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 25 10:40:05 PST 2004
>Originator:     Radim Kolar
>Release:        FreeBSD 5.2-RELEASE i386
Sanatana Dharma
System: FreeBSD asura.bsd 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Thu Jan 15 18:35:03 CET 2004 root at asura.bsd:/usr/obj/usr/src/sys/GENERIC i386

There is a problem when using Vim on volume with softupdates. Problem
is not in softupdates itself. It happens on reiserfs, jfs, ntfs drives also.
You will got file with random data on them.

Vim uses following method for saving files:
unlink file.txt~
ren file.txt -> file.txt~
open file.txt , "w"
chmod (file.txt)
unlink (file.txt~)
i have vim 6.2.154

cat > testme.txt
vim testme.txt
edit that
press reset button, if correctly timed, you will loose that file. Not
too hard to get a 'correct' timing.
as workaround place fsync() call into vim's file saving code. This will not
hurt performance too much. Better is to modify VIM's saving code:
open ('file.txt~','w')
rename ('file.txt~ -> file.txt)
chmod, ... 

Report this bug to upstream VIM's authors. This bug is not freebsd specific.

More information about the freebsd-ports-bugs mailing list