Bug 375188 - QApt::Backend::removePackages() does not remove dependent packages
Summary: QApt::Backend::removePackages() does not remove dependent packages
Status: REPORTED
Alias: None
Product: libqapt
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-17 17:22 UTC by Alexander Morozov
Modified: 2022-11-01 15:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Test program (596 bytes, application/x-xz)
2022-11-01 15:54 UTC, Alexander Morozov
Details

Note You need to log in before you can comment on or make changes to this bug.
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.