Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jan 2003 07:40:03 -0800 (PST)
From:      Doug Moen <doug@moens.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/32374: vi -r doesn't work, file contained unexpected binary data
Message-ID:  <200301181540.h0IFe3cR001839@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/32374; it has been noted by GNATS.

From: Doug Moen <doug@moens.org>
To: freebsd-gnats-submit@FreeBSD.org, andreas@frebsd.org
Cc:  
Subject: Re: bin/32374: vi -r doesn't work, file contained unexpected binary data
Date: Sat, 18 Jan 2003 10:31:02 -0500

 I've had lots of experience with vi -r not working, mostly in 4.2.
 However, I just upgraded to 4.7, and vi is still broken.
 
 It's easy to reproduce the bug without power cycling your machine.
 For example,
 
 # create a test file
 % cp /etc/termcap test
 # edit the test file
 % vi test
 # make a lot of individual changes
 :%s/^/>/
 
 # now, from a separate window, determine PID of vi process
 % ps -x | grep vi
 # simulate a crash due to power loss
 % kill -9 $pid
 
 # now, try to recover the file
 % vi -r test
 # try to write the modified file
 :w
 
 The :w command fails.  In my case, I get this message:
 
 +=+=+=+=+=+=+=+
 Error: unable to retrieve line 531; Error: test: Invalid argument.
 test: WARNING: FILE TRUNCATED.
 Press any key to continue
 
 Normally, vi -r only screws up when vi is terminated abnormally,
 eg because of a momentary power loss, or in this case kill -9.
 In most cases, vi -r works if vi was killed using "kill -HUP".
 
 However, yesterday, I lost an important source file after vi was
 killed by a hangup signal.  Unfortunately, I don't have a reproduceable
 test case for this.
 
 In my opinion, based on years of experience, the source code for /bin/vi
 is so buggy that it probably isn't worth fixing.  The base distribution 
 for
 FreeBSD should replace this implementation of vi with another 
 implementation
 that is better written.
 
 Doug Moen.
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301181540.h0IFe3cR001839>