Bug 1382121 - [bug] requires(preun) and requires(postun) aren't returned by repoquery --requires
Summary: [bug] requires(preun) and requires(postun) aren't returned by repoquery --req...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 25
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-05 19:20 UTC by Stephen Gallagher
Modified: 2017-05-05 13:34 UTC (History)
6 users (show)

Fixed In Version: dnf-2.4.0-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-05 13:34:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Stephen Gallagher 2016-10-05 19:20:25 UTC
Description of problem:
https://github.com/rpm-software-management/dnf-plugins-core/commit/032c9e971f61ad4e09af98584b39dbbd8122181d added support for a --requires-pre argument to `dnf repoquery`, however there are still three other Requires(foo) types that are unhandled:
 * Requires(preun):
 * Requires(post):
 * Requires(postun):

These dependencies are necessary to use repoquery to determine the full set of packages that would be needed to support the installation and removal of a package.

Version-Release number of selected component (if applicable):
https://github.com/rpm-software-management/dnf-plugins-core/commit/032c9e971f61ad4e09af98584b39dbbd8122181d

How reproducible:
Every time

Steps to Reproduce:
1. Run `dnf repoquery --requires-post sssd-client`

Actual results:
Error: unrecognized arguments: --requires-post


Expected results:
/sbin/ldconfig
/usr/sbin/alternatives


Additional info:
Both RPM and the old yum-based repoquery used to treat all four of these as part of "Requires" and return them all when queried with --requires.

RPM still does:

```
$ rpm -q --requires sssd-client
/bin/sh
/bin/sh
/sbin/ldconfig
/sbin/ldconfig
/sbin/ldconfig
/usr/sbin/alternatives
/usr/sbin/alternatives
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libc.so.6(GLIBC_2.8)(64bit)
libcom_err.so.2()(64bit)
libk5crypto.so.3()(64bit)
libkrb5.so.3()(64bit)
libkrb5.so.3(krb5_3_MIT)(64bit)
libpam.so.0()(64bit)
libpam.so.0(LIBPAM_1.0)(64bit)
libpam.so.0(LIBPAM_EXTENSION_1.0)(64bit)
libpam.so.0(LIBPAM_MODUTIL_1.0)(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.12)(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libsss_idmap.so.0()(64bit)
libsss_idmap.so.0(SSS_IDMAP_0.4)(64bit)
libsss_nss_idmap.so.0()(64bit)
libsss_nss_idmap.so.0(SSS_NSS_IDMAP_0.0.1)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
```

Comment 1 Panu Matilainen 2016-10-06 05:21:39 UTC
Unfortunately the full rpm-level Requires(pre,post,preun,postun) dependencies are not available at the repodata level, it only has a notion of "pre-requires" which includes Requires(pre,post) type dependencies. Requires(preun,postun) are considered just regular dependencies in repodata.

Dnf cannot query data that just is not there, fixing this would require changes to the repodata format and all the tooling sitting on top of it.

Comment 2 Stephen Gallagher 2016-10-06 12:00:26 UTC
(In reply to Panu Matilainen from comment #1)
> Unfortunately the full rpm-level Requires(pre,post,preun,postun)
> dependencies are not available at the repodata level, it only has a notion
> of "pre-requires" which includes Requires(pre,post) type dependencies.
> Requires(preun,postun) are considered just regular dependencies in repodata.
> 
> Dnf cannot query data that just is not there, fixing this would require
> changes to the repodata format and all the tooling sitting on top of it.

OK, just to make sure I parsed that correctly:

When I do a `dnf repoquery --requires-pre`, that actually returns both "Requires(pre):" and "Requires(post):" together, and `dnf repoquery --requires` returns all of "Requires:", "Requires(preun):" and "Requires(postun):"?

If that's the case, then I can work with that. Thanks!

Comment 3 Panu Matilainen 2016-10-06 12:17:26 UTC
(In reply to Stephen Gallagher from comment #2) 
> OK, just to make sure I parsed that correctly:
> 
> When I do a `dnf repoquery --requires-pre`, that actually returns both
> "Requires(pre):" and "Requires(post):" together, and `dnf repoquery
> --requires` returns all of "Requires:", "Requires(preun):" and
> "Requires(postun):"?

Correctly parsed, that's what I meant. 

> If that's the case, then I can work with that. Thanks!

...but whether that fully matches with current reality is another question. Looking at sssd-client on F24:

[root@sopuli ~]# rpm -qv --requires sssd-client|grep /
post,interp: /bin/sh
preun,interp: /bin/sh
post: /sbin/ldconfig
postun: /sbin/ldconfig
postun,interp: /sbin/ldconfig
post: /usr/sbin/alternatives
preun: /usr/sbin/alternatives
[root@sopuli ~]#

This is what repodata says about it:
    <rpm:requires>
      <rpm:entry name="/bin/sh"/>
      <rpm:entry name="/bin/sh" pre="1"/>
      <rpm:entry name="/sbin/ldconfig"/>
      <rpm:entry name="/sbin/ldconfig" pre="1"/>
      <rpm:entry name="/usr/sbin/alternatives"/>
      <rpm:entry name="/usr/sbin/alternatives" pre="1"/>
       ...
    </rpm:requires>

Which does match what I said, half of them are pre-requires and the other half (which would be those preun and postun deps) are not. However dnf-1.1.10-1.fc24.noarch doesn't see *any* of them:

[root@sopuli ~]# dnf repoquery --requires sssd-client|grep /
[root@sopuli ~]#

Comment 4 Stephen Gallagher 2016-10-06 12:27:42 UTC
(In reply to Panu Matilainen from comment #3)
> (In reply to Stephen Gallagher from comment #2) 
> > OK, just to make sure I parsed that correctly:
> > 
> > When I do a `dnf repoquery --requires-pre`, that actually returns both
> > "Requires(pre):" and "Requires(post):" together, and `dnf repoquery
> > --requires` returns all of "Requires:", "Requires(preun):" and
> > "Requires(postun):"?
> 
> Correctly parsed, that's what I meant. 
> 
> > If that's the case, then I can work with that. Thanks!
> 
> ...but whether that fully matches with current reality is another question.
> Looking at sssd-client on F24:
> 
> [root@sopuli ~]# rpm -qv --requires sssd-client|grep /
> post,interp: /bin/sh
> preun,interp: /bin/sh
> post: /sbin/ldconfig
> postun: /sbin/ldconfig
> postun,interp: /sbin/ldconfig
> post: /usr/sbin/alternatives
> preun: /usr/sbin/alternatives
> [root@sopuli ~]#
> 
> This is what repodata says about it:
>     <rpm:requires>
>       <rpm:entry name="/bin/sh"/>
>       <rpm:entry name="/bin/sh" pre="1"/>
>       <rpm:entry name="/sbin/ldconfig"/>
>       <rpm:entry name="/sbin/ldconfig" pre="1"/>
>       <rpm:entry name="/usr/sbin/alternatives"/>
>       <rpm:entry name="/usr/sbin/alternatives" pre="1"/>
>        ...
>     </rpm:requires>
> 
> Which does match what I said, half of them are pre-requires and the other
> half (which would be those preun and postun deps) are not. However
> dnf-1.1.10-1.fc24.noarch doesn't see *any* of them:
> 
> [root@sopuli ~]# dnf repoquery --requires sssd-client|grep /
> [root@sopuli ~]#

Right, DNF 1.1.10 doesn't have the support for requires(pre); that's been added in DNF 2.0:

https://github.com/rpm-software-management/dnf-plugins-core/commit/032c9e971f61ad4e09af98584b39dbbd8122181d

In DNF 2.0, it also requires `dnf repoquery --requires-pre`, not just `--requires`. That's a different behavior from yum, but I haven't got an opinion on whether that's an issue for others; for me, I don't care if I have to add an extra flag.

Comment 5 Panu Matilainen 2016-10-06 12:34:44 UTC
Yes, those pre="1" deps missing is expected. But it *should* see the ones without it, so there's a bug somewhere. Based on the repodata, both these: 

# dnf repoquery --requires sssd-client|grep /
and
# dnf repoquery --requires-pre sssd-client|grep /

...should return:
/bin/sh
/sbin/ldconfig
/usr/sbin/alternatives

If that's the case in dnf 2.0 then good, dnf 1.1.10 is buggy wrt --requires at least.

Comment 6 Stephen Gallagher 2016-10-06 13:08:49 UTC
On Rawhide just now:


# dnf repoquery --requires sssd-client
Last metadata expiration check: 0:21:35 ago on Thu Oct 06 08:43:41 2016 EDT.
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.8)
libcom_err.so.2
libcom_err.so.2()(64bit)
libk5crypto.so.3
libk5crypto.so.3()(64bit)
libkrb5.so.3
libkrb5.so.3()(64bit)
libkrb5.so.3(krb5_3_MIT)
libkrb5.so.3(krb5_3_MIT)(64bit)
libpam.so.0
libpam.so.0()(64bit)
libpam.so.0(LIBPAM_1.0)
libpam.so.0(LIBPAM_1.0)(64bit)
libpam.so.0(LIBPAM_EXTENSION_1.0)
libpam.so.0(LIBPAM_EXTENSION_1.0)(64bit)
libpam.so.0(LIBPAM_MODUTIL_1.0)
libpam.so.0(LIBPAM_MODUTIL_1.0)(64bit)
libpthread.so.0
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.0)
libpthread.so.0(GLIBC_2.12)
libpthread.so.0(GLIBC_2.12)(64bit)
libpthread.so.0(GLIBC_2.2)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libsss_idmap.so.0
libsss_idmap.so.0()(64bit)
libsss_idmap.so.0(SSS_IDMAP_0.4)
libsss_idmap.so.0(SSS_IDMAP_0.4)(64bit)
libsss_nss_idmap.so.0
libsss_nss_idmap.so.0()(64bit)
libsss_nss_idmap.so.0(SSS_NSS_IDMAP_0.0.1)
libsss_nss_idmap.so.0(SSS_NSS_IDMAP_0.0.1)(64bit)
rtld(GNU_HASH)


# dnf repoquery --requires-pre sssd-client
Last metadata expiration check: 0:21:40 ago on Thu Oct 06 08:43:41 2016 EDT.
/bin/sh
/sbin/ldconfig
/usr/sbin/alternatives




So it looks like you're right; the preun and postun stuff isn't showing up in the regular --requires, which is probably a bug. Shall we retitle this BZ?

Comment 7 Panu Matilainen 2016-10-06 13:46:13 UTC
(In reply to Stephen Gallagher from comment #6)
> So it looks like you're right; the preun and postun stuff isn't showing up
> in the regular --requires, which is probably a bug. Shall we retitle this BZ?

Might as well do, at least there's plenty of information here already :)

Comment 8 Igor Gnatenko 2016-10-17 11:23:35 UTC
There are 2 kind of bugs.

1) (most probably in librepo) that it filters out post/postun/etc. from --requires
2) it's not completely compatible with yum-repoquery, so I think we will merge output back to --requires

Comment 9 Jaroslav Mracek 2017-03-24 13:15:43 UTC
Here is the patch that should help https://github.com/rpm-software-management/libdnf/pull/279

Comment 10 Fedora Update System 2017-05-02 15:39:56 UTC
dnf-plugins-core-2.0.0-1.fc26 libdnf-0.8.2-1.fc26 dnf-2.4.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4e95959f0d

Comment 11 Fedora Update System 2017-05-04 09:48:15 UTC
dnf-2.4.0-1.fc26 dnf-plugins-core-2.0.0-1.fc26 dnf-plugins-extras-2.0.0-1.fc26 libdnf-0.8.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4e95959f0d

Comment 12 Fedora Update System 2017-05-04 22:04:38 UTC
dnf-2.4.0-1.fc26, dnf-plugins-core-2.0.0-1.fc26, dnf-plugins-extras-2.0.0-1.fc26, libdnf-0.8.2-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4e95959f0d

Comment 13 Fedora Update System 2017-05-05 13:34:13 UTC
dnf-2.4.0-1.fc26, dnf-plugins-core-2.0.0-1.fc26, dnf-plugins-extras-2.0.0-1.fc26, libdnf-0.8.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


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