Unexpected results in 'dnf history rollback'
zhangrui182 opened this issue · 5 comments
Version:
dnf-4.14.0-10
libdnf-0.69.0-2
here are the steps to reproduce the issue
1.dnf remove network-scripts
2.dnf install network-scripts
3.dnf history rollback 1
expected result:
reinstall network-scripts
actual results:
remove network-scripts
According to libdnf's processing logic for merge transaction, we should reinstall network-scripts,but dnf remove it.
I believe there is no merge happening, the docs for rollback
say:
Undo all transactions performed after the specified transaction. ...
Since you specified the remove network-scripts
transaction dnf just undoes the install network-scripts
transaction performed after -> so the expected result really is remove.
My description may be a bit ambiguous
here is my 'dnf history list'
[root@localhost ~]# dnf history list
ID | Command line | Date and time | Action(s) | Altered
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | install network-scripts | 2024-01-12 14:24 | Install | 3
2 | remove network-scripts | 2024-01-12 14:24 | Removed | 3
1 | | 2024-01-11 14:24 | Install | 472 EE
In versions using dnf-4.2.23 and libdnf-0.48.0
[root@localhost ~]# dnf history rollback 1
Last metadata expiration check: 2:50:54 ago on Fri 12 Jan 2024 11:33:37 AM CST.
Rollback to transaction 1, from Thu 11 Jan 2024 02:24:30 PM CST
Undoing the following transactions: 2, 3
Reinstall network-scripts-teamd-1.30-1.x86_64 @upstream
Reinstall network-scripts-10.04-1.h7.x86_64 @upstream
Reinstall ppp-2.4.8-1.h4.x86_64 @upstream
Dependencies resolved.
Nothing to do.
Complete!
But in versions using dnf-4.14.0-10 and libdnf-0.69.0-2,‘dnf rollback 1’ will remove network-scripts
I see, you are correct.
It is indeed not working correctly.
Thank you for the reproducer.
First problem version:dnf-4.6.0
related: #1689
I tried to give the code to solve the problem, but I'm not sure if it's correct.
PR:#2042
Please help me review it together. @kontura @zhangrui182 @jan-kolarik
First problem version:dnf-4.6.0 related: #1689 I tried to give the code to solve the problem, but I'm not sure if it's correct. PR:#2042 Please help me review it together. @kontura @zhangrui182 @jan-kolarik
@chenhaixing123 Thanks for looking into that! I will try to review the PR during the next week.