Re: installing replacement binary of a runnging program?
Olaf Rogalsky writes:
> What happens if I try to update a package, which contains a command,
> which is currently in use and running?
The file on disk gets updated, but the running command does not.
> So if I try to install an update for - let's say - the bash, which of
> course is running, I expect that the /bin/bash file wouldn't be updated,
> because it is locked. Am I wrong, what is the truth?
The binary gets updated by a procedure similar to this:
cp bash.new /bin/bash.dpkg$$
rm /bin/bash
mv /bin/bash.dpkg$$ /usr/bin/bash
rm unlinks the file from the name '/bin/bash' but the file will not be
deleted as long as any process has it open. mv links the name /bin/bash to
the file that was /bin/bash.dpkg$$ and unlinks the name /bin/bash.dpkg$$.
Now any process that opens /bin/bash will get the new version. When all
processes that had /bin/bash open at the time of the upgrade have closed it
the now unreferenced file will be deleted (assuming no hard links).
--
John Hasler
john@dhh.gt.org (John Hasler)
Dancing Horse Hill
Elmwood, WI
Reply to: