<div dir="ltr"><div>I&#39;m also bumping into this issue. I simply cannot split an existing package A that contains a displace, into packages A and B (A now recommending B) with B now containing the displace, as it always complains about the diverts clashing. On upgrade A I get this error:</div><div><br></div><div><div>Setting up company-it-profile-pidgin (20171218) ...</div><div>dpkg-divert: error: &#39;diversion of /etc/purple/prefs.xml to /etc/purple/prefs.xml.company-it-profile-pidgin-orig by company-it-profile-pidgin&#39; clashes with &#39;diversion of /etc/purple/prefs.xml to /etc/purple/prefs.xml.company-orig by company-it-profile&#39;</div><div>dpkg: error processing package company-it-profile-pidgin (--configure):</div><div> subprocess installed post-installation script returned error exit status 2</div><div>Setting up company-it-profile-vpn-profiles (20171218) ...</div><div>Setting up company-it-profile (20171218) ...</div><div>Removing &#39;diversion of /etc/purple/prefs.xml to /etc/purple/prefs.xml.company-orig by company-it-profile&#39;</div><div>Errors were encountered while processing:</div><div> company-it-profile-pidgin</div><div>E: Sub-process /usr/bin/dpkg returned an error code (1)</div></div><div><br></div><div>As mentioned it appears that prerm script is not removing the divert on upgrade.</div><div><br></div><div>Thanks,</div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>in my case, a few diverted files have been removed from one package and<br>added to a new package.<br>In the existing packages, the displaced files and the .displace have<br>been removed.<br>The problem seems, the prerm script will only do undisplace_unlink on<br>remove and deconfigure. Not on upgrade. Therefore the dpkg diversions<br>will not be removed and conflict with the new package.<br>Wouldn&#39;t it be better to always do undisplace_unlink in the prerm script<br>and to redo what is necessary in the postinst script? I think that would<br>handle the upgrade case better where displaced files are no longer<br>necessary.<br>Cheers,<br>Patrick<br>Lukas Anzinger:<br>&gt; Hi,<br>&gt; <br>&gt; while I haven&#39;t tried it, I think it would be sufficient to just move<br>&gt; the *.displace file from the old source package to the new one.<br>&gt; Additionally you will need a versioned conflict and replace, see also<br>&gt; <a href="https://wiki.debian.org/Renaming_a_Package" target="_blank">https://wiki.debian.org/<wbr>Renaming_a_Package</a>. The postrm script of the<br>&gt; old package cleans up the symlink during upgrades before the new<br>&gt; packages creates the new one. The conffiles are left alone by<br>&gt; config-package-dev and handled solely by dpkg.<br>&gt; <br>&gt; Regards,<br>&gt; <br>&gt; Lukas<br>&gt; <br>&gt; On Mon, Jan 27, 2014 at 5:44 PM, Patrick Schleizer &lt;adrelanos at <a href="http://riseup.net" target="_blank">riseup.net</a>&gt; wrote:<br>&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt; let&#39;s say you have a few displaced files in package &quot;a&quot;, which is<br>&gt;&gt; already installed. Now you plan to upgrade package &quot;a&quot; and to move the<br>&gt;&gt; displaced files to package &quot;b&quot;. While package &quot;a&quot; depends on/or<br>&gt;&gt; recommends package &quot;b&quot;.<br>&gt;&gt;<br>&gt;&gt; Are such cases supported or could any maintainer scripts have clashing<br>&gt;&gt; dpkg-diversions or issues like that?<br>&gt;&gt;<br>&gt;&gt; Cheers,<br>&gt;&gt; Patrick<br>&gt;&gt; ______________________________<wbr>_________________<br>&gt;&gt; config-package-dev mailing list<br>&gt;&gt; config-package-dev at <a href="http://mit.edu" target="_blank">mit.edu<br></a>&gt;&gt; <a href="http://mailman.mit.edu/mailman/listinfo/config-package-dev" target="_blank">http://mailman.mit.edu/<wbr>mailman/listinfo/config-<wbr>package-dev<br></a>&gt; Hi,<br>in my case, a few diverted files have been removed from one package and<br>added to a new package.<br>In the existing packages, the displaced files and the .displace have<br>been removed.<br>The problem seems, the prerm script will only do undisplace_unlink on<br>remove and deconfigure. Not on upgrade. Therefore the dpkg diversions<br>will not be removed and conflict with the new package.<br>Wouldn&#39;t it be better to always do undisplace_unlink in the prerm script<br>and to redo what is necessary in the postinst script? I think that would<br>handle the upgrade case better where displaced files are no longer<br>necessary.<br>Cheers,<br>Patrick<br>Lukas Anzinger:<br>&gt; Hi,<br>&gt; <br>&gt; while I haven&#39;t tried it, I think it would be sufficient to just move<br>&gt; the *.displace file from the old source package to the new one.<br>&gt; Additionally you will need a versioned conflict and replace, see also<br>&gt; <a href="https://wiki.debian.org/Renaming_a_Package" target="_blank">https://wiki.debian.org/<wbr>Renaming_a_Package</a>. The postrm script of the<br>&gt; old package cleans up the symlink during upgrades before the new<br>&gt; packages creates the new one. The conffiles are left alone by<br>&gt; config-package-dev and handled solely by dpkg.<br>&gt; <br>&gt; Regards,<br>&gt; <br>&gt; Lukas<br>&gt; <br>&gt; On Mon, Jan 27, 2014 at 5:44 PM, Patrick Schleizer &lt;adrelanos at <a href="http://riseup.net" target="_blank">riseup.net</a>&gt; wrote:<br>&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt; let&#39;s say you have a few displaced files in package &quot;a&quot;, which is<br>&gt;&gt; already installed. Now you plan to upgrade package &quot;a&quot; and to move the<br>&gt;&gt; displaced files to package &quot;b&quot;. While package &quot;a&quot; depends on/or<br>&gt;&gt; recommends package &quot;b&quot;.<br>&gt;&gt;<br>&gt;&gt; Are such cases supported or could any maintainer scripts have clashing<br>&gt;&gt; dpkg-diversions or issues like that?<br>&gt;&gt;<br>&gt;&gt; Cheers,<br>&gt;&gt; Patrick<br>&gt;&gt; ______________________________<wbr>_________________<br>&gt;&gt; config-package-dev mailing list<br>&gt;&gt; config-package-dev at <a href="http://mit.edu" target="_blank">mit.edu<br></a>&gt;&gt; <a href="http://mailman.mit.edu/mailman/listinfo/config-package-dev" target="_blank">http://mailman.mit.edu/<wbr>mailman/listinfo/config-<wbr>package-dev<br></a>&gt; </blockquote></div>