Package: dpkg
Version: 1.14.2
Severity: normal

Hi, I have received some bugreports to dictionaries-common, 

#423012: dictionaries-common: impossible to install due to circular dependency
#423124: dictionaries-common_0.80.1 returns error code 1
#423163: preinst fails when update-alternatives --auto sets non-zero exit code

dictionaries-common preinst has some code to remove old policy <= woody
alternatives for ispell dictionaries and wordlists, something like

for i in $WORDS ; do
   /usr/sbin/update-alternatives --remove dictionary $i
done
/usr/sbin/update-alternatives --auto dictionary

The reason why last line is added is that update-alternatives leaves, after
last alternative candidate is removed, the alternative still there, but
empty and in manual mode.

Before dpkg 1.4.1, that call succeeded, with alternative existing or not, but
with 1.4, it will only succeed first time (thus really fully removing
alternative), but will fail in later invocations when the alternative no
longer exists.

I think one (or both things should be done)

a) Really removing alternative when last alternative candidate is removed
b) Making  update-alternatives --auto calls not fail when alternative is no
   longer present.

I have tested current behavior with attached script,

# ./test-update-alternatives install remove
# ls -la
mykk -> /etc/alternatives/mykk
test-update-alternatives

# cat /var/lib/dpkg/alternatives/mykk
manual
mykk

# ./test-update-alternatives auto        
Really removed

really removes the alternative, but further

# ./test-update-alternatives auto
No alternatives for mykk.

calls will return an error code, what will happen every time
dictionaries-common is upgraded.

As a workaround I am true'ing the update-alternatives --auto call, but
update-alternatives should be fixed about this.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18 (PREEMPT)
Locale: LANG=es_ES, LC_CTYPE=es_ES (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages dpkg depends on:
ii  coreutils                     5.97-5.3   The GNU core utilities
ii  libc6                         2.5-7      GNU C Library: Shared libraries

dpkg recommends no packages.

-- no debconf information
#!/bin/sh -e

alternative=mykk
files="kk1 kk2 kk3 kk4"
curdir=`pwd`

while [ $1 ]; do
    case $1 in
        remove)
            echo "Removing alternative $alternative"
            for i in $files; do
                rm -f $i
                echo " Removing $i from $alternative group"
                update-alternatives --remove $alternative $i
            done
            ;;
        auto)
            update-alternatives --auto $alternative
            echo "Really removed"
            ;;
        install)
            echo "(Re)installing alternative $alternative"
            for i in $files; do
                touch $i
                echo " Instaling $i in $alternative group"
                update-alternatives --install $alternative $alternative 
$curdir/$i 50
            done    
    esac
    shift
done

Reply via email to