Bug 1186947

Summary: duplicating requires of local rpm package
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 22CC: akozumpl, ffesti, ignatenko, jsilhan, jzeleny, lkardos, mls, mluscon, novyjindrich, packaging-team-maint, pknirsch, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-04 08:42:32 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:

Description Igor Gnatenko 2015-01-28 23:11:03 UTC
I think rpmlib() should not be there. Also duplicating requires.
I'm not sure why so many glibc versions only after add_remote_rpm().

import dnf
b = dnf.Base()
b.conf.cachedir = dnf.yum.misc.getCacheDir()
b.fill_sack()
b.add_remote_rpm("/home/brain/bc-1.06.95-13.fc22.x86_64.rpm")
pkgs = b.sack.query().available().run()
[str(x) for x in pkgs[0].requires]

['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)',
 'libncurses.so.5()(64bit)',
 'libreadline.so.6()(64bit)',
 'libtinfo.so.5()(64bit)',
 'rpmlib(CompressedFileNames) <= 3.0.4-1',
 'rpmlib(FileDigests) <= 4.6.0-1',
 'rpmlib(PayloadFilesHavePrefix) <= 4.0-1',
 'rtld(GNU_HASH)',
 'rpmlib(PayloadIsXz) <= 5.2-1',
 'solvable:prereqmarker',
 '/bin/sh',
 '/bin/sh',
 '/sbin/install-info',
 '/sbin/install-info']

import dnf
b = dnf.Base()
b.conf.cachedir = dnf.yum.misc.getCacheDir()
b.read_all_repos()
[x.disable() for x in b.repos.iter_enabled()]
b.repos["rawhide"].enable()
b.fill_sack()
pkgs = b.sack.query().available().filter(name="bc").run()
[str(x) for x in pkgs[0].requires]

['rtld(GNU_HASH)',
 'libc.so.6(GLIBC_2.14)(64bit)',
 'libtinfo.so.5()(64bit)',
 'libncurses.so.5()(64bit)',
 'libreadline.so.6()(64bit)',
 'solvable:prereqmarker',
 '/bin/sh',
 '/sbin/install-info']

Comment 1 Honza Silhan 2015-02-02 11:22:09 UTC
Thanks for the report. The first output should be same as the output of `rpm -qi --requires bc`. Can you test it, please? Does it also duplicate files? Many versions of libc library and rpmlib(*) should be there too.

Comment 2 Igor Gnatenko 2015-02-03 16:02:46 UTC
(In reply to Jan Silhan from comment #1)
> Thanks for the report. The first output should be same as the output of `rpm
> -qi --requires bc`. Can you test it, please? Does it also duplicate files?
> Many versions of libc library and rpmlib(*) should be there too.
rpm -qi --requires bc

/bin/sh
/bin/sh
/sbin/install-info
/sbin/install-info
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)
libncurses.so.5()(64bit)
libreadline.so.6()(64bit)
libtinfo.so.5()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1


But why I don't see it when looking package in repo?

Comment 3 Honza Silhan 2015-02-03 16:25:11 UTC
Hi Florian, why rpm duplicates files? Is "rpmlib(*" require implicit (redundant)?

Comment 4 Jaroslav Reznik 2015-03-03 16:47:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 5 Florian Festi 2015-03-23 11:32:28 UTC
AFAIK the duplicates are scriptlet interpreters. You can check this by looking a the scriptlets (rpm -q --scripts). These deps are created separately and though to not go through the unification process. This might be considered a bug or poor implementation in RPM.

AFAIK createrepo does filter out the rpmlib() requirements as it assumes that the rpm will be able to install the packages from the repository. This is true for the distro's repositories. For 3rd party repos and single rpmfiles this is a questionable decision. So addin the rpmlib() requirements is probably not sucha  bad thing (assuming that dnf is actually able to resolve them).

Comment 6 Honza Silhan 2015-04-16 14:44:44 UTC
Lets keep rpmlib(*) then.

Can we fix duplicate requirements at lower level?
In hawkey we use this libsolv calls:
```
Id p = repo_add_rpm(repo, fn, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE);
sack->provides_ready = 0;    /* triggers internalizing later */
return package_create(sack, p)
```
and AFAIK libsovl doesn't use any RPM API for this and parses directly header blob. Whats the reason of not using RPM API, Michael?

Florian, is this bug in RPM C API as well?

Comment 7 Michael Schröder 2015-04-16 16:10:12 UTC
RPM doesn't filter out duplicate requires, the yum code does. It also does that odd glibc version / rpmlib filtering, see the _dump_requires function in yum/packages.py.

Comment 8 Michael Schröder 2015-04-16 16:15:30 UTC
(OTOH the other libsolv repo_add_ functions do delete duplicates, so maybe repo_add_rpm/repo_add_rpmdb should do this as well...)

Comment 9 Honza Silhan 2015-07-21 09:16:47 UTC
It makes sense to me to have it in RPM if you agree. Assigning to rpm component based on comment 5.

Comment 10 Panu Matilainen 2015-10-08 10:03:45 UTC
Rpm does weed out strictly duplicate dependencies, but the scriptlet dependencies here are not bit-by-bit dupes:

[pmatilai@dhcp195 ~]$ rpm -qv --requires bc|grep /
post,interp: /bin/sh
preun,interp: /bin/sh
post: /sbin/install-info
preun: /sbin/install-info

Of course in a case like this they could technically be merged into:
post,preun,interp: /bin/sh
post,preun: /sbin/install-info

Comment 11 Ľuboš Kardoš 2016-03-04 08:42:32 UTC
As Panu explained, these dependencies are not real duplicates. Yes, they can be merged but I don't see a good reason for that. Yes, there are duplicates in a output of "rpm -q --requires..." but you can turn on a verbose output with "-v" and then it is clear why some requires are more times there.

Because the reason for duplicates is now clear I am closing this as not a bug.