From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GNU-EMACS-REQUEST" 16-MAR-1991 10:01:05.11
To:	ARISIA::EVERHART
CC:	
Subj:	Patch for VMS emacs.

From:	help-gnu-emacs-request@prep.ai.mit.edu@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.91)
	 id AA04916; Sat, 16 Mar 91 09:42:35 EST
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA29239; Sat, 16 Mar 91 09:21:58 EST
Return-Path: <youngdale@v6550c.nrl.navy.mil>
Received: from V6550C.NRL.NAVY.MIL by life.ai.mit.edu (4.1/AI-4.10) id AA29194; Sat, 16 Mar 91 09:20:05 EST
Date: Sat, 16 Mar 1991 09:24:29 EST
From: youngdale@v6550c.nrl.navy.mil (Eric Youngdale)
To: help-gnu-emacs@prep.ai.mit.edu
Cc: youngdale@v6550c.nrl.navy.mil
Message-Id: <00945af9.26ed0080.7506@v6550c.nrl.navy.mil>
Subject: Patch for VMS emacs.

	A problem has been discovered with Emacs running on VMS which has to do
with the way that Emacs writes back the file with the C-x C-s command.  The
problem is that Emacs will overwrite the old file if it is unable to create a
new one (if the directory protection is not set to allow write for example).
This can be made worse if the owner of the file is over their disk quota,
in which case Emacs will truncate the file and then be unable to write it back.

	I have made a patch that I would like people to try, which will disable
Emacs's ability to overwrite the old file.  Emacs will still be able to write
new files, of course. This patch is in a VMS specific section of code, so
non-VMS users do not need to bother trying this.

	I am concerned that there may be unforseen side effects to disabling
this, and this is the reason that I am asking people to try this.  This patch
was made for Emacs version 18.57, although I think that it will also work for
18.55.

	If there are no unforseen side effects, these changes will be
incorporated into Emacs in a later release.

------------------------------------------------------------------
Eric Youngdale          INTERNET:  YOUNGDALE@V6550C.NRL.NAVY.MIL
Naval Research Lab     	    SPAN:  11.13 (or 11277::)
Washington, DC	       FLAME-NET:  NLA0:
	Disclaimer:  The opinions expressed herein are my own and not
necessarily those of my employer.


*** fileio.c-orig
--- fileio.c
**************
*** 1710,1715
  		fn = fname;
  		fname = 0;
  		desc = creat (fn, 0666);
  		if (desc < 0)
  		  {
  		    /* We can't make a new version;
--- 1711,1722 -----
  		fn = fname;
  		fname = 0;
  		desc = creat (fn, 0666);
+ #if 0
+  /* this code is a baaaad idea.  If we cannot write a new file, there is
+   * usually a good reason (i.e. protections of some sort).  This can fail
+   * rather dramatically if the user running emacs is over his/her disk quota.
+   * The user can be left with a zero-length file (thus losing both the original
+   * file *and* the modified one. */
  		if (desc < 0)
  		  {
  		    /* We can't make a new version;
**************
*** 1717,1722
  		    vms_truncate (fn);
  		    desc = open (fn, O_RDWR);
  		  }
  	      }
  	  }
  	else
--- 1724,1730 -----
  		    vms_truncate (fn);
  		    desc = open (fn, O_RDWR);
  		  }
+ #endif
  	      }
  	  }
  	else


