Bug 1284876 - Rpm ignores a dependency
Summary: Rpm ignores a dependency
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-24 11:30 UTC by Göran Uddeborg
Modified: 2016-07-21 18:31 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-21 15:39:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Göran Uddeborg 2015-11-24 11:30:14 UTC
Description of problem:
On my systems RPM ignores the dependency on perl-macros from perl.  When using dnf, the dependency is recognised.


Version-Release number of selected component (if applicable):
rpm-4.13.0-0.rc1.7.fc23.x86_64


How reproducible:
Every time.


Steps to Reproduce:
1. rpm --test -e perl-macros


Actual results:
No objections.


Expected results:
RPM should say that the perl package depends on perl-macros.


Additional info:
To further illustrate, see the below commands:

[göran@freddi Hämtat]$ sudo rpm --rebuilddb
[sudo] password for root: 
[göran@freddi Hämtat]$ cd
[göran@freddi ~]$ rpm -q perl-macros
perl-macros-5.22.0-349.fc23.x86_64
[göran@freddi ~]$ rpm -q --whatprovides perl-macros
perl-macros-5.22.0-349.fc23.x86_64
[göran@freddi ~]$ rpm -q --whatrequires perl-macros
no package requires perl-macros
[göran@freddi ~]$ rpm -q --requires perl | grep macros
perl-macros
[göran@freddi ~]$ rpm --test -e perl-macros
[göran@freddi ~]$ 

Actually running the last command, without "--test", also succeeds.  But trying to do "dnf remove perl-macros" attempts to remove more than 2000 packages.  And that appears more correct, given that perl depends on perl-macros.

Comment 1 Ľuboš Kardoš 2015-11-30 12:26:49 UTC
This is expected rpm behaviour. Have a look at perl.spec:

   212 Requires(post): perl-macros

From rpm documentation:
Context Marked Dependencies

Recent versions of RPM support context marked dependencies. This is a special type of a dependency that applies only in a specified context. Using this feature, one can specify dependencies for pre- and post(un)install scriptlets, ie. the context of a dependency is the execution time of the specified scriptlet.

The syntax for specifying these dependencies is:

Requires(X): foo
              
Here, X can be one of pre, post, preun, or postun, which tells RPM that the package depends on package foo for running the corresponding %pre, %post, %preun, or %postun script.

In practice, RPM enforces the above dependencies until the specified script has been run, not at that time. In other words, it will allow erasing a dependency that was marked for eg. the %post script for an already installed package, but will not allow erasing one that is required for a %postun script for such a package. This is to reduce confusion; it would be somewhat odd if RPM told one to install a package in order to get another one erased. 


Why does dnf attempt to remove more than 2000 packages is another question. I tried it with yum too and yum also removed only one package.

Comment 2 Fedora Admin XMLRPC Client 2016-07-08 09:35:03 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Igor Gnatenko 2016-07-21 15:39:14 UTC
I think this has been fixed already somewhere in libsolv/dnf/whatever.

Comment 4 Göran Uddeborg 2016-07-21 18:31:12 UTC
It works for me too with the current dnf.  It only removes one package.


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