[sorry for the late reply; catching up on email] On Fri, Feb 21, 2020 at 04:23:15PM -0500, Anthony DeRobertis wrote: > On 2/21/20 2:00 AM, Wouter Verhelst wrote: > > Even so, if we want to do so, this can be done correctly by a preinst > > script in new libc, by way of a script that does the following: > > > > cp -a /lib/<dynamic linker name> /usr/lib/<dynamic linker name> > > ln -sf /lib/<dynamic linker name> /usr/lib/<dynamic linker name> > > > > The first of the above two creates the new file; the second replaces the > > old file, atomically, by a symlink. > > Errr, pretty sure you meant to have the ln arguments in the opposite order. > The link name is the second argument to ln.
Yes. I keep messing that up in production (ln is one of those commands that I continually need to read the man page of) > Besides that, you need a sync after the cp. Otherwise (in the event of an > ill-timed crash) the data may not be written out, and you might wind up with > /usr/lib/<dynamic linker name> being, e.g., a zero-byte file (with > /lib/<dynamic linker name> a symlink to it). Possibly you even end up with > /usr/lib/<dynamic linker name> missing, and /lib/<dynamic linker name> a > dangling link. Good point, yes. My point was mostly though that it's possible to implement this atomically, not to write a bug free script ;-) -- <Lo-lan-do> Home is where you have to wash the dishes. -- #debian-devel, Freenode, 2004-09-22