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

Taking over a previously diverted file

Dear mentors,

I wonder what is the best practice to remove a diversion from a package,
when the new version will own the file itself, and no more steals it by a

The situation is that my package (thailatex), has previously diverted
a file from another package (tetex-base). But now tetex-base has
moved the file from /usr/share/texmf to /usr/share/texmf-tetex,
allowing my package to take over that file.

Bug #393519 in my package, which breaks upgrading from sarge,
is caused by an attempt to remove the diversion in preinst:

 case "1" in
     dpkg-divert --package thailatex  --remove --rename \
            --divert /usr/share/texmf/tex/generic/babel/babel.sty.real \

This causes an error like this:

 Preparing to replace thailatex 0.3.2 (using .../thailatex_0.3.7-1_all.deb) ...
 Removing `diversion of /usr/share/texmf/tex/generic/babel/babel.sty
to /usr/share/texmf/tex/generic/babel/babel.sty.real by thailatex'
 dpkg-divert: rename involves overwriting
`/usr/share/texmf/tex/generic/babel/babel.sty' with
   different file
`/usr/share/texmf/tex/generic/babel/babel.sty.real', not allowed
 dpkg: error processing
/var/cache/apt/archives/thailatex_0.3.7-1_all.deb (--unpack):
  subprocess pre-installation script returned error exit status 2

My guess is that at preinst stage, the diverted file is still owned by
the package itself. So it's not allowed to be overwritten.

But if I remove the old version before installing the new one, the
old version's postrm will remove the diversion cleanly. And the new
version just installs correctly.

So, I got an idea to add Conflicts: with the old version of itself, hoping
the sarge version to be removed before the new one being installed.
But it doesn't behave as I thought. Rather, it just upgrades as usual,
and causes the same error.

So, my question is: how to completely take over the previously
diverted file?

Theppitak Karoonboonyanan

Reply to: