Ticket #549 (closed enhancement: fixed)

Opened 14 years ago

Last modified 13 years ago

DEB_UN{DIVERT,REMOVE}_FILES always conditionalizes on upgrade version

Reported by: broder Owned by:
Priority: high Milestone: Upstream Utopia
Component: development Keywords:
Cc: tabbott, andersk Fixed in version:
Upstream bug:


The automatically generated maintainer script code generated by both DEB_UNDIVERT_FILES and DEB_UNREMOVE_FILES always checks and conditionalizes the undiversion on the version being upgraded from.

This isn't always desirable, as sometimes our reasons for removing diversions are tied to other factors.

For example, in kerberos-config, we want to remove the krb.conf diversion if you're upgrading to a version of kerberos-config on a krb4-less platform.

A mechanism to remove a diversion iff it exists already would be sufficient for all the cases we've currently run into. I'm thinking something like setting DEB_UNDIVERT_VERSION_file = all for the interface.


allow-undiversion-without-version-check.diff Download (2.1 KB) - added by broder 14 years ago.
dont-check-version-on-undivert-or-unremove.diff Download (4.6 KB) - added by broder 14 years ago.
config-package-dev_trac549.diff Download (5.3 KB) - added by broder 14 years ago.

Change History

Changed 14 years ago by broder

comment:1 Changed 14 years ago by broder

As a jumping-off point, I've attached a patch that I believe will serve our purposes of undoing any pre-existing diversion if DEB_UNDIVERT_VERSION_file=all.

I haven't tested it yet, but wanted to go ahead and post it for others' perusal.

comment:2 Changed 14 years ago by andersk


comment:3 Changed 14 years ago by broder

Eww. Eww. But...that might work.

That being said, two thoughts:

  1. You will still get spew both from the OMINOUS WARNING and from dpkg-divert attempting to remove a diversion that's no longer in place. It'd be nice to suppress that
  2. This won't solve the kerberos-config problem, which is that I specifically want to remove a diversion but not a removal and vice-versa.

comment:4 Changed 14 years ago by broder

Ooh - there's an even more fun screw case with using $(DEB_VERSION)

Say that package-1 undiverts a file with DEB_UNDIVERT_VERSION_file = $(DEB_VERSION), then package-2 starts diverting the file.

The next time package-1 gets upgraded, it'll delete the symlink without undoing the diversion.

comment:5 Changed 14 years ago by broder

Is there actually a particularly compelling reason for having DEB_UN{DIVERT,REMOVE}_VERSION at all, instead of just always testing if the diversion you're removing is in place?

I guess there's a performance argument? Is dpkg --compare-versions actually enough faster than dpkg-divert --list to care? My inclination is no.

Changed 14 years ago by broder

Changed 14 years ago by broder

comment:6 Changed 14 years ago by broder

Ok. I just attached a new version of attachment:config-package-dev_trac549.diff Download that fixes several typos and errors and such.

I've done what I think is sufficient testing. I created a 1.0 package that diverts a file, and a 1.1 of the same package that undiverts it. I also created a 1.1 package that removes a file, and a 1.1 that unremoves it.

For each of those, I tried

  • Installing the 1.0 and uninstalling the 1.0
  • Installing the 1.0, upgrading to 1.1, and uninstalling 1.1
  • Installing the 1.1 and uninstalling the 1.1

I can't come up with any other use cases that might need testing, so I think this is all done.

comment:7 Changed 13 years ago by jdreed

  • Cc andersk added
  • Priority changed from low to high
  • Milestone changed from The Distant Future to Natty Release

Can we get this patch taken soon?

comment:8 Changed 13 years ago by jdreed

  • Status changed from new to committed
  • Milestone changed from Natty Release to Upstream Utopia

Committed in r25060-r25063.

   debathena / cpd / andersk  21:59  (Anders Kaseorg)                           
       Sponsorship request sent to spang.   

comment:9 Changed 13 years ago by geofft

  • Status changed from committed to development

I've built and uploaded config-package-dev 4.12 into the Debathena -development repositories. In other news, it's in Wheezy and Oneiric.

comment:10 Changed 13 years ago by jdreed

  • Status changed from development to closed
  • Resolution set to fixed

This moved a while ago.

Note: See TracTickets for help on using tickets.