Re: behavior of overwriting running executables?

Bruce Perens (bruce@pixar.com)
Wed, 22 May 96 22:44 PDT


From: "Marty Leisner" <leisner@sdsp.mc.xerox.com>
> This is has always been an issue with linux kernels.

It's a feature of Linux and most Unix kernels. Not really an issue...

> If I write to a running program, I get "text file busy".
> I think sunos seamlessly moves the executable to an unnamed inode,
> leaving a reference to it while its running, then transparently does
> an unlink when its done.

Note that if an OS were to do that, it would also have to copy the file
or implement some sort of copy-on-write behavior.

In the Debian package tool, we extract each file to <filename>.dpkg-new,
and then re-name the file to <filename> once all files have been extracted.
The running executable remains as a nameless file until the last reference
on it goes away - generally when the last process that is using its pages
dies.

Makefiles that replace running executables can use a similar
cp-then-mv strategy.

Thanks

Bruce Perens