<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>37348</bug_id>
          
          <creation_ts>2019-10-18 03:54:19 +0300</creation_ts>
          <short_desc>does not optimize out self-satisfied Requires: XXX &lt; 0</short_desc>
          <delta_ts>2019-11-12 19:04:56 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>184969</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-10-18 03:54:19 +0300</bug_when>
    <thetext>This dependency could be optimized out, becuase it is satisfied by Provides (according to the real behavior of rpm), but it isn&apos;t:

$ rpm -qp /ALT/Sisyphus/x86_64/RPMS.classic/python3-test-3.7.4-alt1.x86_64.rpm --provides | fgrep _testcapi
python3(_testcapi)
$ rpm -qp /ALT/Sisyphus/x86_64/RPMS.classic/python3-test-3.7.4-alt1.x86_64.rpm --requires | fgrep _testcapi
python3(_testcapi) &lt; 0
$ 

Here is how it appears in the build log:

$ egrep -o &apos;^Processing .*$|^(Requires|Provides): .*\(_testcapi\)&apos; /beehive/logs/Sisyphus-x86_64/latest/success/python3-3.7.4-alt1 
Processing files: python3-3.7.4-alt1
Processing files: python3-base-3.7.4-alt1
Processing files: python3-dev-3.7.4-alt1
Processing files: libpython3-3.7.4-alt1
Processing files: python3-tools-3.7.4-alt1
Processing files: python3-modules-tkinter-3.7.4-alt1
Processing files: python3-modules-sqlite3-3.7.4-alt1
Processing files: python3-modules-curses-3.7.4-alt1
Processing files: python3-modules-nis-3.7.4-alt1
Processing files: python3-test-3.7.4-alt1
Provides: python3(_ctypes_test), python3(_testbuffer), python3(_testcapi)
Requires: python3 = 3.7.4-alt1, python3-modules-tkinter = 3.7.4-alt1, python3-modules-curses = 3.7.4-alt1, python3-modules-sqlite3 = 3.7.4-alt1, python3-tools = 3.7.4-alt1, /usr/bin/env, /usr/lib64/python3.7/Tools, /usr/lib64/python3.7/lib-dynload, libc.so.6(GLIBC_2.14)(64bit), libc.so.6(GLIBC_2.2.5)(64bit), libc.so.6(GLIBC_2.3.4)(64bit), libc.so.6(GLIBC_2.4)(64bit), libm.so.6(GLIBC_2.2.5)(64bit), libpthread.so.0(GLIBC_2.2.5)(64bit), libpython3.7m.so.1.0()(64bit) &gt;= set:ogV8iGVEFBDV239IUOOjtxvEGuwUFBN8azfypkIIncm2iM5D87JM5Z9L2hCjH5xZeSZ8y7JmNZmYmEeShU0bY4sCeNPKwVibbpwNrhi1Zec9m73TZevFNuPsRyJwJLDPGaCCGInVNholZq2d4IBpajl37Bsww6c8lZpxU2Zlnaf7oYnuAqfDt1kCOrFKesZ5zSHqBnQGdMTrb1IZ0tfunnsmNRj1tnIHZh34ZhPuE9rDJB2QJQ29QUdwX8oieuGwOTHIcFzv1XVUiBzVZuchmMUMsQdtF4yPTCLQcBGDC2OgszLNEwQ7oFPWOxW7RZppxCz0OiB0MqO1IGSumpScpUqQhwfZEYkoZIqm861w3HOFZ0ca1x1ZvCqVpLuSx1tmRCgAeMZndQow0ZLUxWTUMUcx0Ix3jsKYhGqPimThR2SZk3teyhVHR1lJZ8jAkNR9CrkP3PkyZgo2oZyiPrhZv2sMUJIodwqD9OzWhYeUzShp4E1s6icfzMMbLDpNT5JTor3x1RGRjDVtZytWgCeQskOsrZ6FMEdSqwfVdBqPafOIp95xmGAEtrzDp4FWgwWYsrgn0RjkasPOVkvO0, python3(__future__) &lt; 0, python3(_compat_pickle) &lt; 0, python3(_compression) &lt; 0, python3(_ctypes) &lt; 0, python3(_ctypes_test) &lt; 0, python3(_dummy_thread) &lt; 0, python3(_multibytecodec) &lt; 0, python3(_osx_support) &lt; 0, python3(_pickle) &lt; 0, python3(_py_abc) &lt; 0, python3(_pyio) &lt; 0, python3(_strptime) &lt; 0, python3(_testcapi)
Processing files: python3-debuginfo-3.7.4-alt1
Processing files: python3-base-debuginfo-3.7.4-alt1
Processing files: python3-dev-debuginfo-3.7.4-alt1
Processing files: libpython3-debuginfo-3.7.4-alt1
Processing files: python3-modules-tkinter-debuginfo-3.7.4-alt1
Processing files: python3-modules-sqlite3-debuginfo-3.7.4-alt1
Processing files: python3-modules-curses-debuginfo-3.7.4-alt1
Processing files: python3-modules-nis-debuginfo-3.7.4-alt1
Processing files: python3-test-debuginfo-3.7.4-alt1
$

Compare it with a similar example with a similar dependency being actually optimized out. However, in this example, the form of Provides is XXX = set:... and the dependency is between two different suppackages (not between the package and itself):

$ egrep -o &apos;^Processing .*$|^(Requires|Provides): .*\(certbot\)&apos; /beehive/logs/Sisyphus-x86_64/latest/success/certbot-0.38.0-alt1 
Processing files: certbot-0.38.0-alt1
Provides: letsencrypt = 0.38.0, python3(certbot)
Processing files: certbot-apache-0.38.0-alt1
Requires: certbot = 0.38.0-alt1, python3-module-augeas, python3(acme) &lt;= set:edzs, python3(acme.magic_typing) &lt;= set:edzs, python3(binascii) &lt;= set:edzs, python3(certbot)
Processing files: certbot-nginx-0.38.0-alt1
Requires: certbot = 0.38.0-alt1, python3(OpenSSL) &lt;= set:edzs, python3(abc) &lt;= set:edzs, python3(acme) &lt;= set:edzs, python3(acme.magic_typing) &lt;= set:edzs, python3(certbot)
Processing files: certbot-dns_rfc2136-0.38.0-alt1
Requires: certbot = 0.38.0-alt1, python3(certbot)
Processing files: certbot-dns_route53-0.38.0-alt1
Requires: certbot = 0.38.0-alt1, python3(acme.magic_typing) &lt;= set:edzs, python3(boto3) &lt;= set:edzs, python3(botocore.exceptions) &lt;= set:edzs, python3(certbot)
$ rpm -qp /ALT/Sisyphus/noarch/RPMS.classic/certbot-apache-0.38.0-alt1.noarch.rpm --requires | fgrep certbot
certbot = 0.38.0-alt1:sisyphus+237698.4.6.1
$ 

I&apos;m not quite sure which of the two factors plays the role of having an effect on the optimization. I suspect that the satisfaction of a Requires: XXX &lt; 0 by versionless Provides is not implemented in the optimizer, because it is a strange behavior of the real rpm, which looks a bit like a dirty hack. (It would be even much more dirty if a versionless Provides could satisfy any versioned Requires like = N or &gt;= N, not only &lt; N -- I haven&apos;t tested that yet.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>184970</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-10-18 03:55:17 +0300</bug_when>
    <thetext>rpm-build-4.0.4-alt133</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>185521</commentid>
    <comment_count>2</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-11-12 19:04:56 +0300</bug_when>
    <thetext>(In reply to comment #0)

&gt; I suspect that the satisfaction of a Requires: XXX &lt; 0 by
&gt; versionless Provides is not implemented in the optimizer, because it is a
&gt; strange behavior of the real rpm, which looks a bit like a dirty hack. (It
&gt; would be even much more dirty if a versionless Provides could satisfy any
&gt; versioned Requires like = N or &gt;= N, not only &lt; N -- I haven&apos;t tested that
&gt; yet.)

BTW, that&apos;s like this even for other Requires, not only &lt; 0:

https://lists.altlinux.org/pipermail/devel/2019-November/208919.html &quot;unversioned provides satisfy versioned requires&quot; (at@):

Мужчины, у вас по-прежнему сабж. Я нахожу это возмутительным. Как говорил
Михаил Корлеоне, это оскорбляет мой разум.

$ rpm -q --provides glibc-core |grep libdl
libdl.so.2()(64bit) = set:hdBjS1I4gQ8BohwImELo8Zh
libdl.so.2(GLIBC_2.2.5)(64bit)
libdl.so.2(GLIBC_2.3.3)(64bit)
libdl.so.2(GLIBC_2.3.4)(64bit)
$ grep ^Requires: foo.spec
Requires: libdl.so.2(GLIBC_2.2.5)(64bit) &gt;= set:hdBjS1I4gQ8BohwImELo8Zh
$ rpm -qpR foo-1.0-alt0.x86_64.rpm
libdl.so.2(GLIBC_2.2.5)(64bit) &gt;= set:hdBjS1I4gQ8BohwImELo8Zh
rpmlib(SetVersions)
rpmlib(PayloadIsLzma)
$ rpm -iv --test foo-1.0-alt0.x86_64.rpm
Preparing packages...</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>