Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 1996 13:23:35 -0800
From:      John Polstra <jdp@polstra.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        uh@NU.cs.fsu.edu, freebsd-current@FreeBSD.org, j@uriah.heep.sax.de, nate@FreeBSD.org
Subject:   Re: make world 
Message-ID:  <199601112123.NAA13258@austin.polstra.com>
In-Reply-To: Your message of "Thu, 11 Jan 1996 18:51:10 %2B1100." <199601110751.SAA32761@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce wrote:

> >I took a quick look at the sources of "install".  It looks like, with the
> >options above, that install does this:
> 
> >    * unlinks the old version of /usr/libexec/ld.so
> >    * copies the new version into /usr/libexec/ld.so
> >    * runs /usr/bin/strip (itself dynamically-linked) on /usr/libexec/ld.so
> 
> >Now, looking at the sources to "strip", it seems that it opens its file
> >read/write, and modifies it in place.
> 
> This shouldn't matter if ld.so is not run while it is being installed,

But since "strip" is dynamically-linked, "ld.so" is _guaranteed_ to be
running during the strip.

> and the strip step is probably safe at all times since it doesn't
> move the text or data blocks.

I agree, in principle.  But I have personally seen anomalies a couple of
times on my system, right after replacing ld.so or a shared library, and
they have looked very much like the problem that the original poster
reported.  I suspect that there are bugs in the VM system that can
cause problems if you alter a file that is currently mapped and being
executed.

> >Here's the safest way I've found to install a new version of ld.so on a
> >running system (taken from a shell script that I use):
> >...
> >I'm going to modify the Makefile for ld.so to do something like this,
> >right away.

Which I did.  A few hours later, phk repaired a problem in it :-(.
Well, it took him 2 tries, so I guess I don't feel too bad.

> Erm, in -current, just use `install -C'.  It does everything (except the
> fschg :-() atomically as a side effect of avoiding clobbering the file
> metadata if the file data hasn't changed.

You're right, that looks like it should work fine.  (I even ran a
ktrace on it, just to be sure.)

What is your advice?  Do you think I should go ahead and change
the Makefile to use "install -C" now?  Would this lead to another
hiccup similar to what happened when the new "rpcgen" came along?
I _think_ that "install" is rebuilt and installed _before_ "ld.so",
when you do a "make world".  Is that right?  If so, then changing to
"install -C" should cause no problems for anybody.
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601112123.NAA13258>