Skip to content

Handle undisplace operations in prerm rather than postinst #11

@ArrayBolt3

Description

@ArrayBolt3

At the moment, it looks like config-package-dev inserts code into the postinst script for handling undisplace operations. This presents a very sticky situation if one package that uses config-package-dev needs to move displacing files to another package that also uses config-package-dev. The intuitive way to do this kind of a move operation would be:

  • Move the files from package A to package B
  • Bump package A's and package B's version numbers
  • Add to package B Breaks/Replaces entries against the prior version of package A
  • Remove the displacing files from package A's package.displace file
  • Add the displacing files to package A's package.undisplace file
  • Add the displacing files to package B's package.displace file

Unfortunately this doesn't work at the moment. Because the undisplace code is added to postinst rather than prerm, deconfiguring package A's prior version before configuring package B new version isn't enough; if dpkg deconfigures the prior version of A, then configures the new version of B, the diversions from package A will still be in place when B attempts to create the diversions, which will cause dpkg to abort with a message like dpkg-divert: error: 'diversion of /etc/config/file to /etc/config/file.dist-orig by package-b' clashes with 'diversion of /etc/config/file to /etc/config/file.dist-orig by package-a'. The only good workaround for this (to my awareness) is to add code that manually unravels the diversions, which is a headache for obvious reasons.

If the undisplace code was done in the prerm script, this could be avoided. Deconfiguring package A's prior version would be enough to remove the diversions, allowing package B to put them in place without issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions