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

Bug#578852: prohibit usage of Breaks for file conflicts



Package: debian-policy
Version: 3.8.4.0
Severity: normal

Hi,

to test the actual behaviour of dpkg for this situation I created the
following 5 packages:

Package: foo
Version: 1
Architecture: all
-rw-r--r-- root/root       227 2010-04-23 10:39 ./usr/share/doc/foo/foo-1.control

Package: bar
Version: 1
Architecture: all
<empty>

Package: foo
Version: 2
Architecture: all
<empty>

Package: bar
Version: 2b
Architecture: all
Breaks: foo (<= 1)
Replaces: foo (<= 1)
-rw-r--r-- mrvn/mrvn       180 2010-04-23 09:41 ./usr/share/doc/foo/foo.control

Package: bar
Version: 2c
Architecture: all
Conflicts: foo (<= 1)
Replaces: foo (<= 1)
-rw-r--r-- mrvn/mrvn       180 2010-04-23 09:41 ./usr/share/doc/foo/foo.control

The foo.control file moves from foo to bar between version 1 and 2b/2c.

Test 1
======

I start with version 1 installed and update to version 2/2b/2c without
problems. Then on downgrade:

mrvn@frosties:~/t% dpkg -s bar
Package: bar
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 44
Maintainer: Goswin von Brederlow <goswin-v-b@web.de>
Architecture: all
Version: 2b
Replaces: foo (<= 1)
Breaks: foo (<= 1)
Description: dummy foo
 dummy package to test

mrvn@frosties:~/t% sudo dpkg -i foo_1_all.deb
dpkg: warning: downgrading foo from 2 to 1.
(Reading database ... 176361 files and directories currently installed.)
Preparing to replace foo 2 (using foo_1_all.deb) ...
Unpacking replacement foo ...
dpkg: error processing foo_1_all.deb (--install):
 trying to overwrite '/usr/share/doc/foo/foo.control', which is also in package bar 0:2b
Errors were encountered while processing:
 foo_1_all.deb

SEE http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=20471



mrvn@frosties:~/t% dpkg -s bar
Package: bar
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 44
Maintainer: Goswin von Brederlow <goswin-v-b@web.de>
Architecture: all
Version: 2c
Replaces: foo (<= 1)
Conflicts: foo (<= 1)
Description: dummy foo
 dummy package to test

mrvn@frosties:~/t% sudo dpkg -i foo_1_all.deb               
dpkg: warning: downgrading foo from 2 to 1.
dpkg: regarding foo_1_all.deb containing foo:
 bar conflicts with foo (<= 1)
  foo (version 1) is to be installed.
dpkg: error processing foo_1_all.deb (--install):
 conflicting packages - not installing foo
Errors were encountered while processing:
 foo_1_all.deb

This is as expected.



Test 2
======

Again I start with version 1 installed.

mrvn@frosties:~/t% sudo dpkg --auto-deconfigure --unpack bar_2b_all.deb
dpkg: considering deconfiguration of foo, which would be broken by installation of bar ...
dpkg: yes, will deconfigure foo (broken by bar).
(Reading database ... 176361 files and directories currently installed.)
Preparing to replace bar 1 (using bar_2b_all.deb) ...
De-configuring foo ...
Unpacking replacement bar ...
Replacing files in old package foo ...

mrvn@frosties:~/t% sudo dpkg -i bar_1_all.deb
(Reading database ... 176361 files and directories currently installed.)
Preparing to replace bar 2 (using bar_1_all.deb) ...
Unpacking replacement bar ...
Setting up bar (1) ...

mrvn@frosties:~/t% sudo dpkg --configure -a
Setting up foo (1) ...

mrvn@frosties:~/t% ls -lh /usr/share/doc/foo/foo.control
ls: cannot access /usr/share/doc/foo/foo.control: No such file or directory

This I believe is actualy according to specs. It just isn't a nice outcome.


Test 3
======

Again I start with version 1 installed.

mrvn@frosties:~/t% sudo dpkg --unpack bar_2c_all.deb       
dpkg: considering removing foo in favour of bar ...
dpkg: yes, will remove foo in favour of bar.
(Reading database ... 176361 files and directories currently installed.)
Preparing to replace bar 1 (using bar_2c_all.deb) ...
Unpacking replacement bar ...

mrvn@frosties:~/t% sudo dpkg -i bar_1_all.deb 
(Reading database ... 176358 files and directories currently installed.)
Preparing to replace bar 2 (using bar_1_all.deb) ...
Unpacking replacement bar ...
Setting up bar (1) ...

mrvn@frosties:~/t% sudo dpkg -i foo_1_all.deb
Selecting previously deselected package foo.
(Reading database ... 176356 files and directories currently installed.)
Unpacking foo (from foo_1_all.deb) ...
Setting up foo (1) ...

mrvn@frosties:~/t% ls -lh /usr/share/doc/foo/foo.control 
-rw-r--r-- 1 root root 227 Apr 23 10:39 /usr/share/doc/foo/foo.control

Since foo gets removed completly it must be reinstalled to get foo
back. And then it gets its file back.




In conclusion:
==============

On downgrades using Replaces with Breaks triggers a long standing dpkg
bug or can cause files to disapear. So it might indeed be wise for
policy to prohibit the use of Breaks for file conflicts. Even if the
dpkg bug is fixed it still risks loosing files when reverting a
partial upgrade and downgrading to the old versions.

MfG
	Goswin

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31.6-xen-2010.02.18 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

debian-policy depends on no packages.

debian-policy recommends no packages.

Versions of packages debian-policy suggests:
ii  doc-base                      0.9.5      utilities to manage online documen

-- no debconf information



Reply to: