[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /bin/sh diversions



On Fri, Aug 03, 2007 at 01:15:38PM +1000, Anthony Towns wrote:
> On Wed, Aug 01, 2007 at 10:13:38PM -0700, Steve Langasek wrote:
> > On Thu, Aug 02, 2007 at 06:54:49AM +0200, Mike Hommey wrote:
> > > diversions are far from being atomic.
> > True, but it is persistent across upgrades and doesn't require any
> > particular support from the package.
> 
> Is it a bug (or a missing feature) that diversions aren't atomic?
> 
> The --rename option to dpkg-divert means it can be done atomically if
> dpkg-divert is clever enough, at least in all the ways that count.

  what is not atomic is that dpkg-divert will rename /bin/sh as
/bin/sh.real or whatever, and then the postinst will recreate the
symlink. Between those operations, you live without /bin/sh.

  dpkg-divert could make that atomicaly if it had an option
--replace-with which would take the name of the file to divert _and_ the
file to replace it with.

  That way, the diversion can be made with always a /bin/sh, if
dpkg-divert does that:

  ln /bin/sh /bin/sh.distrib
  mv /bin/dash.temporary /bin/sh

  having /bin/dash.temporary created before the call to dpkg-divert.
Sadly, afaict, there is no such option in dpkg-divert yet.

  Of course this would impose that all the arguments live in the same
directory (as they must be on the same device).

  OTOH I'm not sure it's worth the hassle.


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpua9Zi3jvR5.pgp
Description: PGP signature


Reply to: