From chris@lion-around.at.yiff.net  Mon Jan 21 11:44:01 2002
Return-Path: <chris@lion-around.at.yiff.net>
Received: from lion-around.at.yiff.net (lion-around.at.yiff.net [167.206.208.229])
	by hub.freebsd.org (Postfix) with ESMTP id 78C1537B400
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Jan 2002 11:43:48 -0800 (PST)
Received: (from chris@localhost)
	by lion-around.at.yiff.net (8.11.6/8.11.6) id g0LJhUZ08799;
	Mon, 21 Jan 2002 14:43:30 -0500 (EST)
	(envelope-from chris)
Message-Id: <200201211943.g0LJhUZ08799@lion-around.at.yiff.net>
Date: Mon, 21 Jan 2002 14:43:30 -0500 (EST)
From: Christopher Masto <chris@netmonger.net>
Reply-To: Christopher Masto <chris@netmonger.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sdiff "e" doesn't work with some editors
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         34128
>Category:       gnu
>Synopsis:       sdiff(1) "e" doesn't work with some editors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 21 11:50:01 PST 2002
>Closed-Date:    
>Last-Modified:  Mon Aug 16 13:02:49 UTC 2010
>Originator:     Christopher Masto
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD lion-around.at.yiff.net 4.4-STABLE FreeBSD 4.4-STABLE #0: Tue Oct 9 13:36:55 EDT 2001 root@lion-around.at.yiff.net:/usr/obj/usr/src/sys/LION-AROUND i386


	
>Description:

When using sdiff, one of the options is to edit the left, right, both
or a new file.  The implementation creates a temporary file, runs
an editor on it, then seeks back to the beginning and reads the results.

Unfortunately, this doesn't work with some editors, principally emacs,
which do not rewrite the original file but instead write a new file
and then rename it into place.  sdiff still has the old file open
and won't read any of the changes.

There is no warning or notice that this is happening, and it can lead
to serious corruption of files.  Since sdiff is an integral part of
the mergemaster process, this is likely to bite people who are upgrading.

>How-To-Repeat:

With EDITOR set to emacs or xemacs, use the edit option within sdiff.
The following is sufficient:

chris@lion-around:~/tmp/sdiff$ echo 1 > one; echo 2 > two; sdiff -o out one two
1                                                             | 2
%e l
[emacs starts with "1" in the buffer.  Change it to anything, save, and exit.]
chris@lion-around:~/tmp/sdiff$ cat out 
1

Note that the change silently disappeared.

>Fix:

sdiff should reopen the file after the editor exits.  It should probably
also notice if no changes were made, and prompt/warn the user.
>Release-Note:
>Audit-Trail:
>Unformatted:
