Ticket #56 (closed enhancement: fixed)

Opened 6 years ago

Last modified 3 years ago

RFE: Handle '~' in version/release to lower priority in rpmVersionCompare()


Reported by: ensc Assigned to: pmatilai Priority: major Milestone: rpm-4.10.0 Component: rpm Version: RPM Development Keywords: Cc: stick, stressy


Description

It would be nice when a special handling of '~' would be introduced to mark "negative" version tokens. E.g. so that

| foo-1.0~beta < foo-1.0

holds. This would simplify complicated rulesets which deal with such naming schemes by abusing %release for it.

Attachments

rpm-tilde-support.diff (1.7 kB) - added by jengelh on 11/09/09 14:52:46.
4.7 rpm tilde patch for vercmp
rpmbuild-tilde-support.diff (1.1 kB) - added by jengelh on 11/09/09 14:53:04.
4.7 patch for rpmbuild
0001.diff (1.7 kB) - added by jengelh on 07/27/10 11:28:54.
patch for rpm-4.8
0002.diff (1.1 kB) - added by jengelh on 07/27/10 11:29:10.
patch for rpmbuild-4.8

Change History

09/18/09 12:19:26 changed by stick

  • cc set to stick.

09/25/09 09:21:00 changed by jengelh

Also pullable via

git://dev.medozas.de/rpm master

11/09/09 14:16:03 changed by jengelh

The patch 0001.diff was actually for 4.4.2, because someone had the bright idea of making the master branch 4.4.2 instead of 4.7. Adding new ones.

11/09/09 14:52:46 changed by jengelh

  • attachment rpm-tilde-support.diff added.

4.7 rpm tilde patch for vercmp

11/09/09 14:53:04 changed by jengelh

  • attachment rpmbuild-tilde-support.diff added.

4.7 patch for rpmbuild

07/27/10 11:28:54 changed by jengelh

  • attachment 0001.diff added.

patch for rpm-4.8

07/27/10 11:29:10 changed by jengelh

  • attachment 0002.diff added.

patch for rpmbuild-4.8

07/27/10 11:29:30 changed by jengelh

git location rebased.

09/02/10 19:18:32 changed by stressy

  • cc changed from stick to stick, stressy.

11/22/10 10:47:28 changed by pmatilai

I finally (duh) got around to take a closer look at this, starting with a test-suite for the vercmp() behavior to make it easier to test and spot regressions.

For the simple case of eg 6.0 vs 6.0~rc1 it seems to work as intended, eg

 16: rpmvercmp(6.0~rc1, 6.0) = -1                    ok
 17: rpmvercmp(6.0~rc1, 6.0~rc1) = 0                 ok

but it doesn't handle multiple tildes correctly, these can't both be right:

 18: rpmvercmp(6.0~rc1~git123, 6.0~rc1) = -1         ok
 19: rpmvercmp(6.0~rc1, 6.0~rc1~git123) = -1         ok

Since mirroring dpkg behavior seems the sensible thing to do here, 6.0~rc1 should be considered newer than 6.0~rc1~git123 afaict.

Another thing that needs considering is handling compatibility, this introduces a rather big change in rpm behavior. While recent rpm versions reject tilde in version and release at build-time, there's a huge installed base where that's not the case, and packages built with those versions can have tilde in version/release and expecting a completely different behavior.

It would be possible to add an rpmlib() dependency tracking for new packages using the tilde syntax, that would prevent old rpm versions from installing packages depending on the new semantics. However that still leaves the problem of new rpm installing older packages which can have tilde in version/release without meaning the new semantics. Fully handling it would require rpmvercmp() taking a flag which semantics to use... which starts getting rather ugly.

11/22/10 15:03:44 changed by james

It would be possible to add an rpmlib() dependency tracking for new packages using the tilde syntax, that would prevent old rpm versions from installing packages depending on the new semantics

This kind of solves the problem for rpm, although it seems pretty heavy handed for just a change to the version comparison. But for anything above rpm it doesn't help at all ... yum can't see those rpmlib when it sees a version in primary or updateinfo or etc.

However that still leaves the problem of new rpm installing older packages which can have tilde in version/release without meaning the new semantics. Fully handling it would require rpmvercmp() taking a flag which semantics to use

Well, in theory you'd need two flags (one for each side of the test). But if you did that then _everything_ that produced or consumed an rpmversion would have to also produce/consume a flag. IMNSHO this isn't going to happen.

If you are worried that there are significant rpms out there with ~ in them, a much better fix is to just do the proposed ~ change but wait a few years with the current "~ is invalid" code in rpmbuild still on. Or just don't change it :). No rpmlib and no flags, please.

11/23/10 12:18:01 changed by jengelh

rpmbuild --allow-tilde :-) And later remove it again.

04/23/12 09:39:57 changed by pmatilai

  • status changed from new to closed.
  • resolution set to fixed.

This is now included, finally :) https://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=db28221a4a48f6ee3c804c92314330637c808638

04/23/12 09:40:11 changed by pmatilai

  • milestone set to rpm-4.10.0.