Return to BSD News archive
Newsgroups: comp.os.386bsd.development Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!uuneo!sugar!peter From: peter@NeoSoft.com (Peter da Silva) Subject: Re: File Truncation Philosophy Organization: NeoSoft Communications Services -- (713) 684-5900 Date: Fri, 2 Apr 1993 11:29:16 GMT Message-ID: <C4ut8t.87x@sugar.neosoft.com> References: <C4tJ6C.C17@ns1.nodak.edu> Lines: 32 In article <C4tJ6C.C17@ns1.nodak.edu> tinguely@plains.NoDak.edu (Mark Tinguely) writes: > 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 have a suggestion. Now what System V does is mucho annoying: it won't let you write to a running executable. That's good. You get an error trying to open a running executable in write mode. That's good. But you also get an error when you *delete* a running executable. That's bad. It's lazy: for some reason "open for execute" doesn't just count against the open count in keeping the file open, so they refuse to let you close it. So, my suggestion. Opening an executable for write should give a Text File Busy error. Even if you're root. Then the programs where it matters should be changed to recognise when they fail on Text File Busy and do an unlink and creat. They shouldn't do that normally, of course. *Probably* just 'install' should be modified. > I can think of several reasons to not do this: > 1) won't have the same inode. Isn't this necessary to avoid shared text programs from sharing the wrong text? > 2) won't cover all cases -- using open(2) and O_TRUNC will still > cause the same problem. Yeh, open (O_RDWR or O_WRONLY) should just fail. -- Peter da Silva. <peter@sugar.neosoft.com>. `-_-' Oletko halannut suttasi tänään? 'U` Tarjoilija, tämä ateria elää vielä.