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

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

    <bug>
          <bug_id>36194</bug_id>
          
          <creation_ts>2019-02-26 19:35:20 +0300</creation_ts>
          <short_desc>_upgrade_honor_buildtime doesn&apos;t impose a strict order of upgradability</short_desc>
          <delta_ts>2020-11-17 23:38:40 +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</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>normal</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>at</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>mike</cc>
    
    <cc>placeholder</cc>
    
    <cc>rider</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>179010</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-02-26 19:35:20 +0300</bug_when>
    <thetext>_upgrade_honor_buildtime doesn&apos;t impose a strict order of upgradability; in a strict linear order only one thing is true:

a &lt; b
a = b
a &gt; b

(a, b are meant to be packages with the same release). Instead, it allows any upgrades with the same release. (As if a &lt; b was true for all a, b.)

I have put tests that demonstrate this in rpminstall-tests-1.1-alt1:

$ /usr/share/rpminstall-tests/makeme.sh TESTS=&quot;$(echo {upgradable_dummyFresh{Release,Buildtime}_after_dummy,nonupgradable_dummy_after_dummyFresh{Release,Buildtime}})&quot;
...
TESTING nonupgradable_dummy_after_dummyFreshBuildtime
make[1]: Entering directory `/home/imz/ALT-work/0000-BASETOOLS/rpminstall-tests&apos;
[ $(rpm --dbpath &apos;/tmp/.private/imz/sh.ewALxySb&apos; -qp RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm --qf=&apos;%{BUILDTIME}&apos;) \
  -lt \
  $(rpm --dbpath &apos;/tmp/.private/imz/sh.ewALxySb&apos; -qp RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm --qf=&apos;%{BUILDTIME}&apos;) \
]
rpm --dbpath &apos;/tmp/.private/imz/sh.ewALxySb&apos; --justdb --define &apos;_upgrade_honor_buildtime 1&apos; -U RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm
! rpm --dbpath &apos;/tmp/.private/imz/sh.ewALxySb&apos; --justdb --define &apos;_upgrade_honor_buildtime 1&apos; -U RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm
make[1]: *** [nonupgradable_dummy_after_dummyFreshBuildtime] Error 1
make[1]: Leaving directory `/home/imz/ALT-work/0000-BASETOOLS/rpminstall-tests&apos;
Passed tests:
upgradable_dummyFreshRelease_after_dummy
upgradable_dummyFreshBuildtime_after_dummy
nonupgradable_dummy_after_dummyFreshRelease
XFailed tests:

Failed tests:
nonupgradable_dummy_after_dummyFreshBuildtime
make: *** [all_tests] Error 1
$ rpm -q rpm
error: Macro % has illegal name (%define)
rpm-4.13.0.1-alt5.x86_64
]$ rpm -qp RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm --qf=&apos;%{BUILDTIME}\n&apos;
error: Macro % has illegal name (%define)
1550757701
[imz@ovicaa rpminstall-tests]$ rpm  -qp RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm --qf=&apos;%{BUILDTIME}\n&apos;
error: Macro % has illegal name (%define)
1550757766
$ 

As we can see, dummy package with a more fresh buildtime is upgraded to an older package, although an error is expected.

In p8, rpm behaves as expected:

[builder@localhost rpminstall-tests-1.0]$ ./makeme.sh TESTS=&quot;$(echo {upgradable_dummyFresh{Release,Buildtime}_after_dummy,nonupgradable_dummy_after_dummyFresh{Release,Buildtime}})&quot;
...
TESTING nonupgradable_dummy_after_dummyFreshBuildtime
make[1]: Entering directory `/usr/src/RPM/BUILD/rpminstall-tests-1.0&apos;
rpm --dbpath &apos;/usr/src/tmp/sh.mzeiq4eI&apos; --justdb  --define &apos;_upgrade_honor_buildtime 1&apos; -U RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm
! rpm --dbpath &apos;/usr/src/tmp/sh.mzeiq4eI&apos; --justdb  --define &apos;_upgrade_honor_buildtime 1&apos; -U RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm
package dummy-1-alt1 (which is newer than dummy-1-alt1) is already installed
make[1]: Leaving directory `/usr/src/RPM/BUILD/rpminstall-tests-1.0&apos;
Passed tests:
upgradable_dummyFreshRelease_after_dummy
upgradable_dummyFreshBuildtime_after_dummy
nonupgradable_dummy_after_dummyFreshRelease
nonupgradable_dummy_after_dummyFreshBuildtime
XFailed tests:

[builder@localhost rpminstall-tests-1.0]$ rpm -q rpm
rpm-4.0.4-alt101.M80P.3
[builder@localhost rpminstall-tests-1.0]$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179014</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-02-27 01:33:04 +0300</bug_when>
    <thetext>This test also fails in rpm without the disttag-comparison feature:

$ rpm -q rpm --lastchange
* Пт окт 05 2018 Gleb F-Malinovskiy &lt;glebfm@altlinux.org&gt; 4.13.0.1-alt4
- Add _allow_deps_with_beginning_dot macro to allow dependencies
  beginning with a dot character in spec file (vseleznv@).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>