Bug#578852: prohibit usage of Breaks for file conflicts

2010-04-26 Thread Goswin von Brederlow
Guillem Jover guil...@debian.org writes:

 Hi!

 On Fri, 2010-04-23 at 10:51:56 +0200, Goswin von Brederlow wrote:
 Package: debian-policy
 Version: 3.8.4.0
 Severity: normal

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

 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.

 There's the problem with downgrades and versioned Replaces, and there's
 the other problem with disappearing the wrong replaced/replacing package
 on reverse installation order and losing track of package ownership of
 files, fixed also in 1.15.7 with:

   http://git.debian.org/?p=dpkg/dpkg.git;a=commit;h=0958a9f9

 Neither of these are triggered by Breaks nor Conflicts.

 These test-cases can be found in:

   http://git.debian.org/?p=dpkg/pkg-tests.git;a=tree

 regards,
 guillem

% dpkg --version
Debian `dpkg' package management program version 1.15.7.1 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

% dpkg -S /usr/share/doc/foo/foo.control  
foo: /usr/share/doc/foo/foo.control

% sudo dpkg --auto-deconfigure --unpack bar_2_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 ... 176362 files and directories currently installed.)
Preparing to replace bar 1 (using bar_2_all.deb) ...
De-configuring foo ...
Unpacking replacement bar ...
Replacing files in old package foo ...

% dpkg -S /usr/share/doc/foo/foo.control   
bar: /usr/share/doc/foo/foo.control

% sudo dpkg -i bar_1_all.deb 
(Reading database ... 176362 files and directories currently installed.)
Preparing to replace bar 2 (using bar_1_all.deb) ...
Unpacking replacement bar ...
Setting up bar (1) ...

% sudo dpkg --configure -a
Setting up foo (1) ...

% dpkg -S /usr/share/doc/foo/foo.control   
dpkg: /usr/share/doc/foo/foo.control not found.


With Replaces files disapear on downgrade unless the replaced package is
also reinstalled (after the downgrade). As long as dpkg does not keep a
backup of replaced files and restores them on downgrades that can not be
fixed. This is not really a bug as I think that is just how Replaces is
specified. Replaces just isn't a reversible (downgradable) feature.

MfG
Goswin



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#578852: prohibit usage of Breaks for file conflicts

2010-04-25 Thread Guillem Jover
Hi!

On Fri, 2010-04-23 at 10:51:56 +0200, Goswin von Brederlow wrote:
 Package: debian-policy
 Version: 3.8.4.0
 Severity: normal

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

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

 m...@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

No, this is #568566, and fixed in 1.15.7 with:

  http://git.debian.org/?p=dpkg/dpkg.git;a=commit;h=418e1fc0

I found out this bug some weeks ago by code staring, and only matched
it against an actual bug report recently, initially thought it would
fix some failing test-cases about disappearing packages in the dpkg's
pkg-tests.git functional test suite, but it ended up being something
different.

This was “introduced” in dpkg 1.13.2 (2005-03-18) when fixing #164595
by forgetting to handle the versioned downgrade case, for something
that had not been supported before.

 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.

There's the problem with downgrades and versioned Replaces, and there's
the other problem with disappearing the wrong replaced/replacing package
on reverse installation order and losing track of package ownership of
files, fixed also in 1.15.7 with:

  http://git.debian.org/?p=dpkg/dpkg.git;a=commit;h=0958a9f9

Neither of these are triggered by Breaks nor Conflicts.

These test-cases can be found in:

  http://git.debian.org/?p=dpkg/pkg-tests.git;a=tree

regards,
guillem



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#578852: prohibit usage of Breaks for file conflicts

2010-04-23 Thread Goswin von Brederlow
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:

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

m...@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



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

m...@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.

m...@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 ...

m...@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) ...

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

m...@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.

m...@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 ...

m...@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) ...

m...@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) ...

m...@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