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

Bug#425272: texlive-base-bin: conffile weirdness with xdvi.cfg



On Son, 20 Mai 2007, Frank Küster wrote:
> After upgrading from etch with tetex it is at its intended place. 

Good.

> After upgrading from etch with texlive it is not:

Damend.

> Preserving removal of /etc/texmf/xdvi/xdvi.cfg.

Ok, now I remember that we discussed this once, but never fixed it.

The problem is:
in texlive-base-bin.preinst the following happens (more or less):

# try to move tetex version
check_move /etc/texmf/xdvi.cfg /etc/texmf/xdvi/xdvi.cfg $version
  -> . file /etc/texmf/xdvi.cfg is not readable
     . we upgrade from a previous version
     . thus we generate /etc/texmf/xdvi/xdvi.cfg.preinst-deleted

# now the texlive version of the file
check_move /etc/texmf/texlive/xdvi.cfg /etc/texmf/xdvi/xdvi.cfg $version
  -> 
    scenario 1: file /etc/texmf/texlive/xdvi.cfg is readable but unchanged
     . remove unchanged config file /etc/texmf/texlive/xdvi.cfg

    scenario 2: file /etc/texmf/texlive/xdvi.cfg is changed
     . mv /etc/texmf/texlive/xdvi.cfg /etc/texmf/xdvi/xdvi.cfg.preinst-copy

then we come to postinst ...
-f /etc/texmf/xdvi/xdvi.cfg.preinst-deleted
 -> Preserving removal of $cfgfile
 
-f /etc/texmf/xdvi/xdvi.cfg.preinst-copy
 scenario 1: NO -> do nothing, file disappeared !!!
 scenario 2: YES -> mv ... , file still present.

So if you changed it in texlive, it is present
If you didn't change it, it is gone.

The solution is problematic because we cannot check whether we upgrade
from a tetex version or a texlive version (both could be installed,
removed (but not purged), reinstalled etc etc).

So I suggest the following code instead of the one currently present

in common-function.preinst:
        # for xdvi.cfg we first want to move tetex files, and later
        # texlives
        /etc/texmf/xdvi/xdvi.cfg)
            # here we have to care for the tetex version
            # we cannot use check_move because if it is not present
            # because tetex was never installed then a -preinst-deleted
            # will be created. So we do the same as check_move but a bit
            # different:
            #
            orig="/etc/texmf/xdvi.cfg"
            new="/etc/texmf/xdvi/xdvi.cfg"
            if [ -r "$orig" ] ; then
                mdorig=$(dpkg_md5sum "$orig")
                if [ $(md5sum "$orig" | cut -f 1 -d ' ') = "$mdorig" ] ; then
                    rm "$orig"
                else
                    mkdir -p $(dirname "$new")
                    mv "$orig" "$new".preinst-copy
                fi
            else
                if [ -n "$version" ]; then
                    # we are upgrading from texlive, so this does mean
                    # that the tetex version was never installed or purged
                    # don't create the preinst-delete, just do nothing
                    :
                fi
            fi
            # now set the conf_oldpath to the texlive version
            conf_oldpath="/etc/texmf/texlive/xdvi.cfg"
            ;;
    esac
    check_move $conf_oldpath $cfgfile $version


Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>                    Università di Siena
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
GOOLE (n.)
The puddle on the bar into which the barman puts your change.
			--- Douglas Adams, The Meaning of Liff



Reply to: