Bug 375188

Summary: QApt::Backend::removePackages() does not remove dependent packages
Product: [Unmaintained] libqapt Reporter: Alexander Morozov <a.morozov>
Component: generalAssignee: Harald Sitter <sitter>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Test program

Description Alexander Morozov 2017-01-17 17:22:48 UTC
QApt::Backend::installPackages() honors dependencies but QApt::Backend::removePackages() does not.

Let there are a package A and a package B which depends on A.
If I remove A with QApt::Backend::removePackages() B is not removed.

If I use QApt::Package::setRemove and QApt::Backend::commitChanges() B is removed:

QApt::Backend *backend = ...
QApt::Package *pkg = backend->package("A");
pkg->setRemove();
backend->commitChanges();
Comment 1 Justin Zobel 2022-10-30 00:37:45 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 2 Alexander Morozov 2022-11-01 15:54:18 UTC
Created attachment 153380 [details]
Test program

This bug still can be reproduced.
Test program libqapt_remove uninstalls zsh-common.
With libqapt 3.0.5 on Debian Bullseye:

$ sudo LANG=C apt install zsh
............................................
The following additional packages will be installed:
  zsh-common
Suggested packages:
  zsh-doc
The following NEW packages will be installed:
  zsh zsh-common
............................................
$ ./libqapt_remove
started
$ dpkg -l | grep zsh
ii  zsh                                           5.8-6+deb11u1                          amd64        shell with lots of features
rc  zsh-common                                    5.8-6+deb11u1                          all          architecture independent files for Zsh
$ sudo LANG=C apt-get check
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 zsh : Depends: zsh-common (= 5.8-6+deb11u1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

libqapt_remove code is attached.