*BSD News Article 13916


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!pipex!ibmpcug!iocgate!dfr
From: dfr@ioc.co.uk (Doug Rabson)
Subject: Re: File Truncation Philosophy
Sender: news@ioc.co.uk
Message-ID: <DFR.93Apr2120043@rhino.ioc.co.uk>
In-Reply-To: tinguely@plains.NoDak.edu's message of Thu, 1 Apr 1993 18:54:12 GMT
Date: Fri, 2 Apr 1993 12:00:43 GMT
Lines: 48
References: <C4tJ6C.C17@ns1.nodak.edu>
Nntp-Posting-Host: rhino.ioc.co.uk
Organization: Intelligent Office Company Ltd.

In article <C4tJ6C.C17@ns1.nodak.edu> tinguely@plains.NoDak.edu (Mark Tinguely) writes:
> 
> 		******** Request for Comments ********
> 
>  As most of you know that with 386bsd installing a new copy of a running
>  program causes the running program to crash and core. This happens due to
>  couple of things. Fist, with the Mach VM used in 386bsd, executing
>  instructions are paged directly from the executable in the filesystem
>  (whereas old BSD VMs copy the executable to swap and page from there).
>  Secondly, programs like "cp" TRUNCATES the existing file when copying in
>  the new copy of the program. When the executing program does the next page
>  fault the fault will fail and the program will crash/core.
> 
>  The easy fix is to move or remove the file before installing the new
>  program. The filesystem does work correctly and keep a copy of the executable
>  and the VM still finds and uses this copy.
> 
>  It would be NICE to not have to worry about unlinking the file associated
>  with running programs before making our copies. Nate and all the others
>  working the patchkit are interested in this, also very important if the user
>  is restoring from a backup (as I learned once).
> 
>  The philosophy question is should we change "cp" and "cat" to unlink (remove)
>  the file before opening? Or even lower in the filesystem (as would need be in
>  the restore example).
> 
>  I can think of several reasons to not do this:
> 	1) won't have the same inode.
> 	2) won't cover all cases -- using open(2) and O_TRUNC will still 
> 	   cause the same problem.
>  
>  If you have other ideas or opinions, flame away.
> 
> --mark.

We should leave cp and cat the same as they are now since otherwise
they would always break any hard links to the file even if you didn't
want them to.  The install program is the right place to do this (does
it already do the right thing?)

On older BSD systems, it was impossible to modify a file which was
the image of an executing program - you would just get an error return
from the system call (EBUSY?).

--
Doug Rabson, IOC Ltd.	| Email:  dfr@ioc.co.uk
Phone: +44 81 528 9864	|	  drabson@cix.compulink.co.uk
Fax:   +44 81 528 9878	|