Package: linux-perf
Version: 5.16.3-1~exp1
Severity: serious

Hi!

This package has code in its postrm maintscript, which unconditionally
removes the diversion, which breaks as the rename cannot be performed
due to linux-base owning the file, and dpkg-divert refusing to
overwrite it. This is the error shown:

  ,---
  # dpkg -i linux-perf_5.16.7-1_amd64.deb
  (Reading database ... 280997 files and directories currently installed.)
  Preparing to unpack linux-perf_5.16.7-1_amd64.deb ...
  Leaving 'diversion of /usr/bin/perf to /usr/bin/perf.wrapper by linux-perf'
  Leaving 'diversion of /usr/share/bash-completion/completions/perf to 
/usr/share/bash-completion/completions/perf.wrapper by linux-perf'
  Leaving 'diversion of /usr/share/man/man1/perf.1.gz to 
/usr/share/man/man1/perf.wrapper.1.gz by linux-perf'
  Unpacking linux-perf (5.16.7-1) over (5.16.7-1) ...
  Removing 'diversion of /usr/bin/perf to /usr/bin/perf.wrapper by linux-perf'
  dpkg-divert: error: rename involves overwriting '/usr/bin/perf' with
    different file '/usr/bin/perf.wrapper', not allowed
  dpkg: warning: old linux-perf package post-removal script subprocess returned 
error exit status 2
  dpkg: trying script from the new package instead ...
  Removing 'diversion of /usr/bin/perf to /usr/bin/perf.wrapper by linux-perf'
  dpkg-divert: error: rename involves overwriting '/usr/bin/perf' with
    different file '/usr/bin/perf.wrapper', not allowed
  dpkg: error processing archive linux-perf_5.16.7-1_amd64.deb (--install):
   new linux-perf package post-removal script subprocess returned error exit 
status 2
  Leaving 'diversion of /usr/bin/perf to /usr/bin/perf.wrapper by linux-perf'
  Leaving 'diversion of /usr/share/bash-completion/completions/perf to 
/usr/share/bash-completion/completions/perf.wrapper by linux-perf'
  Leaving 'diversion of /usr/share/man/man1/perf.1.gz to 
/usr/share/man/man1/perf.wrapper.1.gz by linux-perf'
  Removing 'diversion of /usr/bin/perf to /usr/bin/perf.wrapper by linux-perf'
  dpkg-divert: error: rename involves overwriting '/usr/bin/perf' with
    different file '/usr/bin/perf.wrapper', not allowed
  dpkg: error while cleaning up:
   new linux-perf package post-removal script subprocess returned error exit 
status 2
  Processing triggers for man-db (2.10.0-2) ...
  [main a8458e04] Commit dpkg db updates
   1 file changed, 2 insertions(+), 1 deletion(-)
  Errors were encountered while processing:
   linux-perf_5.16.7-1_amd64.deb
  `---

The dpkg-divert calls should be protected to run only on the relevant
actions on all maintscripts.

Thanks,
Guillem

Reply via email to