Bug 1113080 - dnf --installroot fails silently if a package cannot be installed
Summary: dnf --installroot fails silently if a package cannot be installed
Keywords:
Status: CLOSED DUPLICATE of bug 1107737
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-25 12:09 UTC by Kamil Dudka
Modified: 2023-09-14 02:10 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-04 11:29:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kamil Dudka 2014-06-25 12:09:01 UTC
Version-Release number of selected component (if applicable):
yum-3.4.3-148.fc20.noarch


How reproducible:
easily


Steps to Reproduce:
1. mock -r fedora-20-x86_64 --init
2. sudo yum --installroot /var/lib/mock/fedora-20-x86_64/root/ --releasever 20 install foo xml-common bar
3. echo $?


Actual results:
No error message, exit code equal to zero.


Expected results:
Error message saying that packages "foo" and "bar" cannot be installed, non-zero exit code.


Additional info:
The above command is used by 'mock --install'.  This bug causes problems to csmock.

Comment 1 Kamil Dudka 2014-08-20 11:58:38 UTC
Any progress on this bug?

Comment 2 James Antill 2014-08-20 16:31:16 UTC
 If yum can't get to install anything (Eg. foo and bar conflict, so depsolving fails) then it'll return an error ... but if it depsolves and one/both of foo or bar aren't in the transaction for some reason (Eg. they don't exist in the repos.) then yum won't return an error, because it did a transaction and that transaction succeeded. This is intentional, as people often want to specify packages that don't exist etc.

Comment 3 Kamil Dudka 2014-08-20 17:51:37 UTC
(In reply to James Antill from comment #2)
>  If yum can't get to install anything (Eg. foo and bar conflict, so
> depsolving fails) then it'll return an error ... but if it depsolves and
> one/both of foo or bar aren't in the transaction for some reason (Eg. they
> don't exist in the repos.) then yum won't return an error, because it did a
> transaction and that transaction succeeded.

What is the recommended way to check whether the specified set of packages was actually installed or not?

> This is intentional, as people
> often want to specify packages that don't exist etc.

Why would people specify packages that don't exist (and expect yum to succeed)?
That hardly sounds useful...

Comment 4 James Antill 2014-08-29 04:52:13 UTC
(In reply to Kamil Dudka from comment #3)
> (In reply to James Antill from comment #2)
> >  If yum can't get to install anything (Eg. foo and bar conflict, so
> > depsolving fails) then it'll return an error ... but if it depsolves and
> > one/both of foo or bar aren't in the transaction for some reason (Eg. they
> > don't exist in the repos.) then yum won't return an error, because it did a
> > transaction and that transaction succeeded.
> 
> What is the recommended way to check whether the specified set of packages
> was actually installed or not?

 install packages one at a time? Use something else like a transaction file?
 Use some kind of script to do the transaction, or to check it after?
 Not many people need/want this kind of feature from the cmd line (that I know of).

> > This is intentional, as people
> > often want to specify packages that don't exist etc.
> 
> Why would people specify packages that don't exist (and expect yum to
> succeed)?
> That hardly sounds useful...

 Most people only specify one package at a time too, so it doesn't matter too much and when people specify more than one they tend to want it to do something rather than nothing. Eg. paste a bunch of packages, and then hunt for the paste typo or yum does nothing at all.
 There's also things like pasting "yum install foo bar baz" but bar is already installed, in this case bar is dealt with in the same way as if bar didn't exist (error message goes out and no change to the transaction). This is also true for upgrade.

 Then there are obsoletes, Eg. yum install foo bar ... but foo obsoletes bar. If the logic should be to not do anything on any error, do we now error or not?
 And then stuff like distro-sync.

 It gets a lot easier to be consistent if we can say "command works if a transaction happens" for everything.

Comment 5 Kamil Dudka 2014-08-29 06:31:39 UTC
(In reply to James Antill from comment #4)
>  install packages one at a time?

That is exactly what csmock implements to work around this bug.  Not very efficient in case it needs to install dozens of dependencies of an SRPM.

>  Use something else like a transaction file?

How can I do it using mock --install?

>  Use some kind of script to do the transaction, or to check it after?

The "check it after" strategy is also used by csmock to work around this bug.

>  Not many people need/want this kind of feature from the cmd line (that I
> know of).

I referred to csmock, which has many users (indirectly, at least all maintainers of C/C++ RHEL packages with updates).

>  Most people only specify one package at a time too, so it doesn't matter
> too much and when people specify more than one they tend to want it to do
> something rather than nothing. Eg. paste a bunch of packages, and then hunt
> for the paste typo or yum does nothing at all.

Please re-read what is requested in this bug (comment #0).

I do NOT want yum to do nothing at all if a package cannot be installed.

I want yum to produce a diagnostic message and return a non-zero exit code.

>  There's also things like pasting "yum install foo bar baz" but bar is
> already installed, in this case bar is dealt with in the same way as if bar
> didn't exist (error message goes out and no change to the transaction). This
> is also true for upgrade.
> 
>  Then there are obsoletes, Eg. yum install foo bar ... but foo obsoletes
> bar. If the logic should be to not do anything on any error, do we now error
> or not?

Nope, the logic should be to continue, but provide a diagnostic message and non-zero exit code.

>  And then stuff like distro-sync.
> 
>  It gets a lot easier to be consistent if we can say "command works if a
> transaction happens" for everything.

You mean easier for yum developers?

Comment 6 Kamil Dudka 2015-02-04 09:49:10 UTC
I am switching the component to dnf as yum is in maintenance mode already.

Comment 7 Radek Holy 2015-02-04 11:29:20 UTC
Then this is a duplicate of a bug on which we are already working.

*** This bug has been marked as a duplicate of bug 1107737 ***

Comment 8 Red Hat Bugzilla 2023-09-14 02:10:37 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


Note You need to log in before you can comment on or make changes to this bug.