Newbie Question About System Update

Erik Trulsson ertr1013 at student.uu.se
Tue Apr 19 13:45:25 PDT 2005


On Tue, Apr 19, 2005 at 04:32:37PM -0400, Bill Moran wrote:
> Chuck Swiger <cswiger at mac.com> wrote:
> > Bill Moran wrote:
> > > The system can not replace programs that are in use,
> > 
> > This is generally not the case.  Unix lets you continue to access a file after 
> > it has been deleted, so long as the process hangs on to a file descriptor. 
> > This lets you replace programs in use, without running into the same problems 
> > that platforms like Windows have.
> 
> What you say?:
> 
> bash-2.05b$ su
> Password:
> bolivia# cp /usr/sbin/cron /home/wmoran/.
> bolivia# cp /home/wmoran/cron /usr/sbin/.
> cp: /usr/sbin/./cron: Text file busy
> bolivia# 
> 
> Notice that /usr/sbin/cron is in use (because my system is running
> normally)  I can copy _from_ that file, but I can not overwrite it.
> 
> Apparenlty, nobody who is claiming this has _tried_ it.  Try it yourself
> and see.  You can _not_ replace programs that have their Text section
> in use (i.e. the code) because the demand pager has that area of the
> file locked.


You apparently cannot modify a program that is in use.  What you *can*
do is delete it and create a new file with the same name.

Try using 'cp -f' instead of plain 'cp'.
(Or use the install(1) utility, which is what installworld normally
uses, which also unlinks the old file before creating the new.)


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-stable mailing list