Bug 1284876 - Rpm ignores a dependency
Rpm ignores a dependency
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-24 06:30 EST by Göran Uddeborg
Modified: 2016-07-21 14:31 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-21 11:39:14 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2015-11-24 06:30:14 EST
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 07:26:49 EST
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 05:35:03 EDT
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 11:39:14 EDT
I think this has been fixed already somewhere in libsolv/dnf/whatever.
Comment 4 Göran Uddeborg 2016-07-21 14:31:12 EDT
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.