Package: dpkg
Version: 1.15.8.11
Severity: important
File: /usr/bin/update-alternatives
Tags: sid squeeze
Hi,
update-alternatives happily removes regular files that are in place of
alternative slave links if the currently selected alternative does not
have that particular slave. This is a regression from lenny (which had
the perl implementation of update-alternatives).
The following script demonstrates the problem:
===== alternative-delete-file.sh =====
#!/bin/sh
set -x
master=${1:-master}
touch /tmp/without-slave /tmp/with-slave
echo slave-file > /tmp/slave
echo different-file > /tmp/$master-slave
ls -la /tmp/$master-slave
cat /tmp/$master-slave
update-alternatives --install /tmp/$master $master /tmp/with-slave 10
--slave /tmp/$master-slave $master-slave /tmp/slave
# not replacing ... with a link => OK
update-alternatives --remove $master /tmp/with-slave
# not deleting => OK
ls -la /tmp/$master-slave
cat /tmp/$master-slave
update-alternatives --install /tmp/$master $master /tmp/without-slave 1
update-alternatives --install /tmp/$master $master /tmp/with-slave 10
--slave /tmp/$master-slave $master-slave /tmp/slave
# not replacing ... with a link => OK
ls -la /tmp/$master-slave
cat /tmp/$master-slave
update-alternatives --display $master
update-alternatives --set $master /tmp/without-slave
# OOPS, the file (which was there instead of a link) was removed
ls -la /tmp/$master-slave
cat /tmp/$master-slave
update-alternatives --display $master
===== =====
# ./alternative-delete-file.sh test5
+ master=test5
+ touch /tmp/without-slave /tmp/with-slave
+ echo slave-file
+ echo different-file
+ ls -la /tmp/test5-slave
-rw-r--r-- 1 root root 15 Jul 12 08:09 /tmp/test5-slave
+ cat /tmp/test5-slave
different-file
+ update-alternatives --install /tmp/test5 test5 /tmp/with-slave 10 --slave
/tmp/test5-slave test5-slave /tmp/slave
update-alternatives: using /tmp/with-slave to provide /tmp/test5 (test5) in
auto mode.
update-alternatives: warning: not replacing /tmp/test5-slave with a link.
+ update-alternatives --remove test5 /tmp/with-slave
+ ls -la /tmp/test5-slave
-rw-r--r-- 1 root root 15 Jul 12 08:09 /tmp/test5-slave
+ cat /tmp/test5-slave
different-file
+ update-alternatives --install /tmp/test5 test5 /tmp/without-slave 1
update-alternatives: using /tmp/without-slave to provide /tmp/test5 (test5) in
auto mode.
+ update-alternatives --install /tmp/test5 test5 /tmp/with-slave 10 --slave
/tmp/test5-slave test5-slave /tmp/slave
update-alternatives: using /tmp/with-slave to provide /tmp/test5 (test5) in
auto mode.
update-alternatives: warning: not replacing /tmp/test5-slave with a link.
+ ls -la /tmp/test5-slave
-rw-r--r-- 1 root root 15 Jul 12 08:09 /tmp/test5-slave
+ cat /tmp/test5-slave
different-file
+ update-alternatives --display test5
test5 - auto mode
link currently points to /tmp/with-slave
/tmp/with-slave - priority 10
slave test5-slave: /tmp/slave
/tmp/without-slave - priority 1
Current 'best' version is '/tmp/with-slave'.
+ update-alternatives --set test5 /tmp/without-slave
update-alternatives: using /tmp/without-slave to provide /tmp/test5 (test5) in
manual mode.
+ ls -la /tmp/test5-slave
ls: cannot access /tmp/test5-slave: No such file or directory
+ cat /tmp/test5-slave
cat: /tmp/test5-slave: No such file or directory
+ update-alternatives --display test5
test5 - manual mode
link currently points to /tmp/without-slave
/tmp/with-slave - priority 10
slave test5-slave: /tmp/slave
/tmp/without-slave - priority 1
Current 'best' version is '/tmp/with-slave'.
Andreas
-- System Information:
Debian Release: 6.0.2
APT prefers stable
APT policy: (800, 'stable'), (750, 'oldstable'), (700, 'testing'), (600,
'unstable'), (500, 'stable-updates'), (130, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages dpkg depends on:
ii coreutils 8.5-1 GNU core utilities
ii libbz2-1.0 1.0.5-6 high-quality block-sorting file co
ii libc6 2.13-7 Embedded GNU C Library: Shared lib
ii libselinux1 2.0.96-1 SELinux runtime shared libraries
ii xz-utils 5.0.0-2 XZ-format compression utilities
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
dpkg recommends no packages.
Versions of packages dpkg suggests:
ii apt 0.8.10.3+squeeze1 Advanced front-end for dpkg
-- no debconf information
-- System Information:
Debian Release: 6.0.2
APT prefers stable
APT policy: (800, 'stable'), (750, 'oldstable'), (700, 'testing'), (600,
'unstable'), (500, 'stable-updates'), (130, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages dpkg depends on:
ii coreutils 8.5-1 GNU core utilities
ii libbz2-1.0 1.0.5-6 high-quality block-sorting file co
ii libc6 2.13-7 Embedded GNU C Library: Shared lib
ii libselinux1 2.0.96-1 SELinux runtime shared libraries
ii xz-utils 5.0.0-2 XZ-format compression utilities
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
dpkg recommends no packages.
Versions of packages dpkg suggests:
ii apt 0.8.10.3+squeeze1 Advanced front-end for dpkg
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]