Subject: Re: ETEXT (was Re: Panic shutting down)
To: None <current-users@NetBSD.ORG, mouse@Collatz.McRCIM.McGill.EDU>
From: Captech) < (James Graham>
List: current-users
Date: 09/14/1995 12:51:13
der Mouse wrote:
#: [greywolf wrote]:
#: > In regards to overwriting existing binaries which might be in use,
#: > whatever happened to "Text file busy"?  That would catch any renegade
#: > makefiles which might be trying to copy onto an in-use binary.  This
#: > would be handy even in the trivial case of, say, /sbin/init :-)
#: IMO it wouldn't.  That would prevent the installation of that binary;
#: in this circumstance I _want_ to replace init.  I just don't want the
#: kernel to panic over seeing the old inode, kept around by the text
#: segment reference to it, as it's going down.

ETEXT doesn't mean you can't rename() the thing, it just means you can't
re-write it.  Essentially it enforces the approach of "if it's busy,
don't copy onto it, or Bad Things Will Happen (TM)."

[What were the rules for ETEXT again...?  You can have it open for writing
or executing, but you can't have it open for both, and read permission is
immaterial.  Or something like that.]

I know there have been times where I would have preferred my system to
tell me "ld:  Cannot write to progname: Text file busy" than to skrog
the already running copy.  It's not a pretty sight when your window manager
or your X server goes down.

I'd also like a way for the shell to mark a script file busy so that
any attempts to write the script will fail (since sh doesn't read the whole
thing into memory prior to execution, any writes which alter the size of the
file prior to the shell's idea of its current location will, upon the next
instruction, alter the shell's perception of reality, with interesting to
potentially dangerous results).

Anyone for "/bin/sh -L"? :-)


#: 					der Mouse