Re: Is there still a point in installing libgcrypt to /lib instead of /usr/lib
- To: Anthony DeRobertis <anthony@derobert.net>
- Cc: debian-devel@lists.debian.org
- Subject: Re: Is there still a point in installing libgcrypt to /lib instead of /usr/lib
- From: Wouter Verhelst <wouter@grep.be>
- Date: Tue, 17 Mar 2020 15:48:47 +0100
- Message-id: <[🔎] 20200317144846.GB27056@grep.be>
- In-reply-to: <618a2ade-3aec-05b6-43c1-592667dc6e12@derobert.net>
- References: <20200215173132.GA1433@argenau.bebt.de> <20200215222135.GB265500@thunder.hadrons.org> <20200216115956.GB92929@espresso.pseudorandom.co.uk> <20200218114418.GB221002@bongo.bofh.it> <20200218195639.GA267239@espresso.pseudorandom.co.uk> <20200218211005.GA250183@bongo.bofh.it> <20200218222011.tbcfo2q57fsg7gbf@fatal.se> <20200219101935.GC285065@espresso.pseudorandom.co.uk> <20200221070017.GF28045@grep.be> <618a2ade-3aec-05b6-43c1-592667dc6e12@derobert.net>
[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
Reply to: