Bug 36194 - _upgrade_honor_buildtime doesn't impose a strict order of upgradability
Summary: _upgrade_honor_buildtime doesn't impose a strict order of upgradability
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: rpm (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-26 19:35 MSK by Ivan Zakharyaschev
Modified: 2020-11-17 23:38 MSK (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2019-02-26 19:35:20 MSK
_upgrade_honor_buildtime doesn't impose a strict order of upgradability; in a strict linear order only one thing is true:

a < b
a = b
a > b

(a, b are meant to be packages with the same release). Instead, it allows any upgrades with the same release. (As if a < 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="$(echo {upgradable_dummyFresh{Release,Buildtime}_after_dummy,nonupgradable_dummy_after_dummyFresh{Release,Buildtime}})"
...
TESTING nonupgradable_dummy_after_dummyFreshBuildtime
make[1]: Entering directory `/home/imz/ALT-work/0000-BASETOOLS/rpminstall-tests'
[ $(rpm --dbpath '/tmp/.private/imz/sh.ewALxySb' -qp RPMS/dummy/noarch/dummy-1-alt1.noarch.rpm --qf='%{BUILDTIME}') \
  -lt \
  $(rpm --dbpath '/tmp/.private/imz/sh.ewALxySb' -qp RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm --qf='%{BUILDTIME}') \
]
rpm --dbpath '/tmp/.private/imz/sh.ewALxySb' --justdb --define '_upgrade_honor_buildtime 1' -U RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm
! rpm --dbpath '/tmp/.private/imz/sh.ewALxySb' --justdb --define '_upgrade_honor_buildtime 1' -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'
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='%{BUILDTIME}\n'
error: Macro % has illegal name (%define)
1550757701
[imz@ovicaa rpminstall-tests]$ rpm  -qp RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm --qf='%{BUILDTIME}\n'
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="$(echo {upgradable_dummyFresh{Release,Buildtime}_after_dummy,nonupgradable_dummy_after_dummyFresh{Release,Buildtime}})"
...
TESTING nonupgradable_dummy_after_dummyFreshBuildtime
make[1]: Entering directory `/usr/src/RPM/BUILD/rpminstall-tests-1.0'
rpm --dbpath '/usr/src/tmp/sh.mzeiq4eI' --justdb  --define '_upgrade_honor_buildtime 1' -U RPMS/dummyFreshBuildtime/noarch/dummy-1-alt1.noarch.rpm
! rpm --dbpath '/usr/src/tmp/sh.mzeiq4eI' --justdb  --define '_upgrade_honor_buildtime 1' -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'
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]$
Comment 1 Ivan Zakharyaschev 2019-02-27 01:33:04 MSK
This test also fails in rpm without the disttag-comparison feature:

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