From owner-freebsd-bugs Sat Jan 18 7:40: 5 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08B9637B401 for ; Sat, 18 Jan 2003 07:40:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A824E43F1E for ; Sat, 18 Jan 2003 07:40:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h0IFe3NS001840 for ; Sat, 18 Jan 2003 07:40:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h0IFe3cR001839; Sat, 18 Jan 2003 07:40:03 -0800 (PST) Date: Sat, 18 Jan 2003 07:40:03 -0800 (PST) Message-Id: <200301181540.h0IFe3cR001839@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Doug Moen Subject: Re: bin/32374: vi -r doesn't work, file contained unexpected binary data Reply-To: Doug Moen Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/32374; it has been noted by GNATS. From: Doug Moen 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