Bug 882851

Summary: dnf is not informing that package is installed and hence "nothing to do".
Product: [Fedora] Fedora Reporter: Pratyush Sahay <pratyush.a.sahay>
Component: dnfAssignee: Ales Kozumplik <akozumpl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: akozumpl, jzeleny, mls
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-0.2.20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-25 09:48:23 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:
Bug Depends On:    
Bug Blocks: 871892    

Description Pratyush Sahay 2012-12-03 08:49:30 UTC
Description of problem: Comparison (yum vs dnf) of trying to install an existing package:
1) yum :
$ sudo yum install stellarium
Loaded plugins: langpacks, presto, refresh-packagekit
Package stellarium-0.11.4a-1.fc18.i686 already installed and latest version
Nothing to do

2) dnf:
$ sudo dnf install stellarium
Setting up Install Process
Resolving Dependencies
--> Starting dependency resolution
--> Finished dependency resolution
Nothing to do

dnf is not informing that package is installed and hence "nothing to do".


Version-Release number of selected component (if applicable):


How reproducible: always


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results: Similar to yum, dnf should inform the user that a package is already installed, and hence "nothing to do" shows up.


Additional info:

Comment 1 Ales Kozumplik 2012-12-11 14:17:43 UTC
Hello,

thank you for the report. I'll look to see what can be done about this.

Comment 2 Ales Kozumplik 2013-01-15 14:09:24 UTC
Michael,

I'd like to ask you how to best deal with this. When I have a job such as the following one:

queue_push2(&q, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME, p);

where p is a name of an installed package, then running the solver returns '0' and there are no problems: it saw p is installed already and so everything is fine. Is there a way however to learn from the solver that this job item was skipped because the packag is already installed? Or should I, in case of no error and empty resulting transaction, check that the current installed state already satisfies the job?

Thank you, Ales

Comment 3 Michael Schröder 2013-01-15 17:38:11 UTC
There currently is no way to ask the solver about a job. But you don't need a solver run to detect that a job is already fulfilled, you can easily check this with just a couple lines of code.

Things to consider:

- you probably shouldn't check for an empty transaction, consider
  "dnf install stellarium zsh", the user might expect a message about
  stellarium already being installed even if zsh needs to be installed.

- Does "yum install stellarium" update stellarium to the latest version?
  The error message seems to indicate that.

- what about erasures? Does "yum erase some-not-installed-pkg" also print
  such a message?

Comment 4 Pratyush Sahay 2013-01-15 18:10:04 UTC
(In reply to comment #3)
> Things to consider:
> 
> - Does "yum install stellarium" update stellarium to the latest version?
>   The error message seems to indicate that.

It seems to be doing that.. tried for nautilus:
$ sudo yum install nautilus
Loaded plugins: langpacks, presto, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package nautilus.i686 0:3.6.3-3.fc18 will be updated
--> Processing Dependency: nautilus = 3.6.3-3.fc18 for package: nautilus-extensions-3.6.3-3.fc18.i686
---> Package nautilus.i686 0:3.6.3-4.fc18 will be an update
--> Running transaction check
---> Package nautilus-extensions.i686 0:3.6.3-3.fc18 will be updated
---> Package nautilus-extensions.i686 0:3.6.3-4.fc18 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                           Arch               Version                       Repository             Size
================================================================================================================
Updating:
 nautilus                          i686               3.6.3-4.fc18                  updates               2.6 M
Updating for dependencies:
 nautilus-extensions               i686               3.6.3-4.fc18                  updates                63 k

Transaction Summary
================================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total download size: 2.7 M
Is this ok [y/N]:

> 
> - what about erasures? Does "yum erase some-not-installed-pkg" also print
>   such a message?

Example message for some-not-installed package:
$ sudo yum erase emacs
Loaded plugins: langpacks, presto, refresh-packagekit
No Match for argument: emacs
No Packages marked for removal

Comment 5 Ales Kozumplik 2013-01-16 12:19:18 UTC
(In reply to comment #3)
> There currently is no way to ask the solver about a job. But you don't need
> a solver run to detect that a job is already fulfilled, you can easily check
> this with just a couple lines of code.

Yes, I think I'll eventually be doing that.

> 
> Things to consider:
> 
> - you probably shouldn't check for an empty transaction, consider
>   "dnf install stellarium zsh", the user might expect a message about
>   stellarium already being installed even if zsh needs to be installed.

Hm, good point.

> 
> - Does "yum install stellarium" update stellarium to the latest version?
>   The error message seems to indicate that.

It does and so does DNF at the moment. So seeing that package of that name is already installed before the resolving shouldn't by itself cause an error. Tricky.

> - what about erasures? Does "yum erase some-not-installed-pkg" also print
>   such a message?

Yes.

Comment 6 Michael Schröder 2013-01-16 12:42:35 UTC
About 'dnf install stellarium' doing an update: I don't think it does. It doesn't auto-update if you do a:
    queue_push2(&q, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME, p);

It does autoupdate if you add that SOLVER_ORUPDATE flag I added for the mancoosi cudf tests.

Comment 7 Ales Kozumplik 2013-01-16 12:49:41 UTC
(In reply to comment #6)
> About 'dnf install stellarium' doing an update: I don't think it does. It
> doesn't auto-update if you do a:
>     queue_push2(&q, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME, p);
> 
> It does autoupdate if you add that SOLVER_ORUPDATE flag I added for the
> mancoosi cudf tests.

You're right I just tested it, DNF doesn't autoupdate.

Comment 8 Ales Kozumplik 2013-01-18 13:41:57 UTC
I made a first attempt at the fix in c76b9df, reporter, you can try with dnf-0.2.20.

Comment 9 Pratyush Sahay 2013-01-27 06:40:52 UTC
Just updated to dnf-0.2.20.
$ rpm -qa | grep dnf
dnf-0.2.20-1.gitdec970f.fc18.noarch

Seems to be working fine with respect to the bug reported here.
$ sudo dnf install opencv
Setting up Install Process
Package opencv-2.4.3-3.fc18.i686 is already installed, skipping.
Nothing to do

Comparing with yum:

$ sudo yum install opencv
Loaded plugins: langpacks, presto, refresh-packagekit
Package opencv-2.4.3-3.fc18.i686 already installed and latest version
Nothing to do