Bug 2066638

Summary: "dnf group remove" removes packages that belong to another installed group
Product: [Fedora] Fedora Reporter: Marek Blaha <mblaha>
Component: dnfAssignee: Jan Kolarik <jkolarik>
Status: CLOSED COMPLETED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: daniel.mach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.18.0-2.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-20 15:03:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
testing repository none

Description Marek Blaha 2022-03-22 08:55:00 UTC
Created attachment 1867404 [details]
testing repository

Description of problem:
According to dnf(8) should only "remove those packages in the group  from  the system  which  do not belong to another installed group and were not installed explicitly by the user."
But currently dnf removes also packages that are part of another installed group.

How reproducible:
Always.


Steps to Reproduce:
1. create testing repo with two groups sharing packages. You can use the one from the attachment with following layout:
@first-group: with packages GrpTestA, GrpTestB
@second-group: with package GrpTestA

2. dnf group install first-group
Installing group/module packages:
 GrpTestA           x86_64           1.0.1-0           group-remove-test           5.9 k
 GrpTestB           x86_64           1.0.1-0           group-remove-test           5.9 k
Installing Groups:
 First test group

3. dnf group install second-group
Installing Groups:
 Second test group

4. dnf group remove first-group

Actual results:

Package GrpTestA is removed even though it is also part of installed second-group

Removing:
 GrpTestA          x86_64          1.0.1-0             @group-remove-test            0  
 GrpTestB          x86_64          1.0.1-0             @group-remove-test            0  
Removing Groups:
 First test group


Expected results:
Package GrpTestA stays on the system:

Removing:
 GrpTestB          x86_64          1.0.1-0             @group-remove-test            0  
Removing Groups:
 First test group


Additional info:
If both groups are installed in the same transaction everything works correctly:
# dnf group install first-group second-group
# dnf group remove first-group
Removing:
 GrpTestB          x86_64          1.0.1-0             @group-remove-test            0  
Removing Groups:
 First test group

Comment 1 Ben Cotton 2022-08-09 13:14:07 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 2 Jan Kolarik 2023-09-21 11:01:22 UTC
Following PR was queued to fix this issue: https://github.com/rpm-software-management/dnf/pull/1995.