<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>256</bug_id>
          
          <creation_ts>2010-09-02 02:52:25 +0000</creation_ts>
          <short_desc>Sync up RPM version policy with rest of system (including support &apos;~&apos; in version strings)</short_desc>
          <delta_ts>2017-06-13 10:53:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>deployment</component>
          <version>1.6</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Moved from Laurentiu to Unassigned</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Purdie">richard.purdie</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>julie.n.fleischer</cc>
    
    <cc>kevin.tian</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>n3npq</cc>
    
    <cc>pinto.elia</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>shane.wang</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9543</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2010-09-02 02:52:25 +0000</bug_when>
    <thetext>It would be desirable to support the ~ notation in version strings for prerelease versions, e.g. 2.6.34~rc1 instead of 2.6.33+2.6.34-rc1.

To make this change, bitbake and opkg need to both support the syntax in their verson comparision functions, we need to upgrade the dpkg/apt tools to a version which supports it and check how rpm handles it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10812</commentid>
    <comment_count>1</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2010-10-27 11:59:31 +0000</bug_when>
    <thetext>Tracked at https://bugs.launchpad.net/rpm/+bug/633742</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15209</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-08-04 07:40:18 +0000</bug_when>
    <thetext>To understand how this may or may not workin the scope of RPM.  Can you give some examples on how the comparison logic should work with tilde within the version?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15981</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-09-02 14:36:21 +0000</bug_when>
    <thetext>For Mark&apos;s benefit, the following is an incremental list of versions illustrating what tilde means:

2.6.24~rc1
2.6.24~rc2
2.6.24
2.6.24.1~rc1
2.6.24.1
2.6.25~rc1
2.6.25~rc2
2.6.25
2.6.25.1

Marking as post 1.1 as this isn&apos;t likely to happen in the 1.1 timeframe at this point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15982</commentid>
    <comment_count>4</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 14:45:18 +0000</bug_when>
    <thetext>The sequence you have given is insufficient to determine
what the collation sequence SHOULD be even if tilde-in-version
is included.

rpmvercmp does segmented (i.e. alphas/digits/other are split into classes) comparisons

The comparison issues start to creep-in with (arbitrarily defined) mixed-mode comparisons.
I.e. How should digits be compared to alphas or punctuation when found in
a comparison sequence?

Your sequence is too predictable to capture the problematic mixed-mode
comparison issues. There are historical issues that prevent ASCII
or LC_COLLATE being simply re-used.

The intent of tilde-in-version is very well known: how to implement
mixed-mode comparison in rpm is what isn&apos;t obvious.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15984</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-09-02 14:53:59 +0000</bug_when>
    <thetext>The general rule is that for version comparison, we tend to follow the debian scheme (http://www.debian.org/doc/debian-policy/ch-controlfields.html). I don&apos;t know the rpm version comparison code well enough to know how this will translate there.

What examples would you want to see added to the sequence to 100% clarify the situation?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15986</commentid>
    <comment_count>6</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 15:12:53 +0000</bug_when>
    <thetext>You can plug whatever versioning scheme you
wish, with whatever collate sequence you desire.

But the mixed mode comparison pathologies
need to be pinned down precisely in explicit
test cases before anything can be &quot;supported&quot;.

Saying &quot;Just like Debian!&quot; isn&apos;t sufficient either,
even though the Debian comparison (or at least my
rewrite of dpkgcmp code, none has ever bothered
to confirm correctness) has been in RPM for years.

The hysterical issues in rpmvercmp are largely
    1) comparison between, say, digit &lt;-&gt; punctualtion is surprising
    the actual comparison is with &quot;&quot; (or missing or empty) and
    the (arbitrarily defined) comparison result isn&apos;t what people
    expect (which is ASCII or float based)

    2) digit padding means that 1.0000000002 &gt; 1.1

    3) strcmp (as in glibc) means that case isn&apos;t distinguished.

    4) (mandriva and disttag related) many distros wish a &quot;branding&quot;
    identifier like
            foo-1.2-3mdv2011
    Sadly the distro &quot;branding&quot; bigots also wish the explicitly &quot;branded&quot;
    version to be &quot;newer&quot; than the unbranded version, which breaks
    the natural ASCII (or LC_COLLATE but lets ignore encoding issues) collation

   5) the &apos;-&apos; character is forbidden in version strings. and &apos;:&apos; is almost forbidden
   for similar reasons: rpm MUST be able to split &quot;E:V-R&quot; strings like
        Requires: foo = E:V-R
   into a tuple of {E,V-R} on known boundaries (both &apos;-&apos; and &apos;:&apos; are boundaries)

There&apos;s also the additional twist(s) of twiddle-in-epoch and twiddle-in-release
that twiddle-in-version will surely lead to RFE&apos;s for.

So tests cases to handle missed-class comparisons, and with missing values,
and &apos;~&apos; in other locations, possibly multiple, with regression tests are needed
to be acceptable for inclusion in RPM itself.

Again, all the RPM itself needs is a boolean return from an opaque comparison.
But &quot;RPM sux! because it doesn&apos;t do what Debian does!&quot; (and interoperability
in general) isn&apos;t enhanced by opaque pluggable comparisons.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15987</commentid>
    <comment_count>7</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 15:19:31 +0000</bug_when>
    <thetext>I would point out that RPM already permits a trailing *
character in {V,R} strings which will match the remainder of the string
(by exiting immediately with the current comparison result)
is already implemented.

In some ways the trailing &apos;*&apos; character accomplishes what tilde-in-version
accomplishes with rather simpler semantics. Just not what is in Debian ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15989</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-09-02 15:33:50 +0000</bug_when>
    <thetext>I haven&apos;t said RPM sux. We have the situation that OE started with opkg, added dpkg, then rpm support. opkg has a defined approach to version numbers which is to follow debian unless it doesn&apos;t make sense for embedded use.

We can therefore choose to follow the debian approach, or, if I hear good arguments otherwise, we could patch dpkg and do something different. I&apos;d prefer not to but its possible.

The one thing I want to see is that bitbake, opkg, dpkg and rpm have some kind of similar ideas about how to use the versions, at least in the environment we&apos;re using. I&apos;ve seen what happens when they disagree and we&apos;re not doing it again ;-).

In summary I agree we need a good set of definitions and a good test set and those need to be created as part of this work. I worry if we&apos;re waiting on rpm to write those definitions, we may have a long wait as I see links with discussions back five years ago and little movement :(.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15990</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-09-02 15:36:43 +0000</bug_when>
    <thetext>If * can be made to work and we can come up with some stable translation, that is perfectly fine. We already allow &quot;-&quot; in V but have translations for rpm to deal with that...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15991</commentid>
    <comment_count>10</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 15:43:29 +0000</bug_when>
    <thetext>The lack of &quot;forward&quot;motion isn&apos;t from me.

SHow me test cases or set a goal and you will have
an implementation within a month.

The general implementation is harder because of
rampant &quot;RPM sux because ...&quot; comments (not from you).

Again, you can implement whatever version comparison
you wish to see in RPM by plugging in a (*rpmvercmp)
vector. There&apos;s a similar vector for the higher level triple
of {E,V,R} that can be plugged as well.

And there&apos;s a *RE pattern that is used to split on boundaries
that can be re-written to do whatever you chosse.

Meanwhile RPM is expected to be compatible with itself: that
isn&apos;t your opkg/bitbake/ipkg/dpkg/... usage case.

And its not RPM, but rather tools that don&apos;t use rpm lib interfaces
correctly, that is going to break. I&apos;ve seen 5-6 tool bugs over
the last few months with Mandriva adding Distepoch/Disttag
(which the *RE parser handles perfectly, including ignoring
if/when the additionl info isn&apos;t needed/useful). So tools like
zypper and/or smart and/or yum are what is going to break
because not correctly using rpm lib comparison functions.

Happy to help with whatever you desire in Poky: its just a collation sequence *shrug*.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15992</commentid>
    <comment_count>11</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 15:51:05 +0000</bug_when>
    <thetext>Instead of transforms, there&apos;s already an excluded character
list in version comparison. All excluded characters are treated
equivalently (originally, and still in @rpm.org code, all &quot;other&quot;
punctuation characters are treated equivalently: so
    1.2_3 = 1.2|3

See rpmdb/rpmevr.c (where the comparison routines live)
for two quirks:

/* XXX Force digits to beat alphas. See bugzilla #50977. */
/*@unchecked@*/
#if defined(RPM_VENDOR_MANDRIVA)  || defined(RPMVERCMP_DIGITS_BEAT_ALPHA) /* old-comparision-behaviour */
static int _invert_digits_alphas_comparison = -1;
#else
static int _invert_digits_alphas_comparison = 1;
#endif

/* XXX Punctuation characters that are not treated as alphas */
/*@unchecked@*/ /*@observer@*/
static const char * _rpmnotalpha = &quot;.:-&quot;;


Unless you need to handle &quot;branding&quot; in release with the expectation of &quot;newer&quot;,
don&apos;t do what Mandriva is doing.

And add any characters you wish to the excluded character _rpmnotalpha list.
The far harder issue (which likely necessitates awkward/complex transforms always)
is tools like zipper not using rpmlib API calls for version comparison.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15993</commentid>
    <comment_count>12</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2011-09-02 15:59:17 +0000</bug_when>
    <thetext>One last related note is the EVRD parsing. This is the split
into a N-tuple (currently up to 4) and twiddle-in-version is
adding another element to the tuple with speshul comparison semantics.

The *RE parsing is quite general and can be used to split dependency
strings on newer boundaries, and can drop fields as well as permute
the precedence of the tuple comparisons, each of which is the (*rpmvercmp)
segmented string comparison applied sequentially to strings in the tuple.

Here is the configuration (from /usr/lib/rpm/macros) with the explicit
usage cases that match:


#==============================================================================
# ---- EVRD... dependency tuple comparison macros.
#

# STEP 1: Match the string and capture regex parts
#                      1          2           3             4
#                      X     &quot;:&quot;  X        &quot;-&quot;X          &quot;:&quot;X
%evr_tuple_match  ^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-]+))?$

# STEP 2: Assemble &lt;E,V,R,D&gt; tuple from regex parts
# &lt;E,V,R,D&gt;         case 1:  case 2:  case 3:  case 4:  case 5:  case 6:
#                   X:X-X:X  X:X-X    X:X      X:       X-X      X
# %evr_tuple_select 1234     123_     12__     1___     _23_     _2__
%evr_tuple_select 123_

# STEP 3: Configure the comparison order of the &lt;E,V,R,D&gt; tuple elements
%evr_tuple_order  EVR


SO what is in RPM is quite general even if there isn&apos;t the conventionalized
and tightly administratively controlled narros usage of twiddle-in-version
as in Debian. I&apos;m sure that whatever Poky wishes to do with RPM version
comparison can be accommodated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20933</commentid>
    <comment_count>13</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-05-01 16:19:48 +0000</bug_when>
    <thetext>The rest of the system (bitbake, opkg, opkg-utils, dpkg) is updated to a shared debian version policy including support for &quot;~&quot;. The only missing piece would be having RPM following that policy which this bug now reflects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21190</commentid>
    <comment_count>14</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-05-08 15:39:14 +0000</bug_when>
    <thetext>Discussions on this have occurred with the upstream RPM maintainer.  It&apos;s not completely clear yet how easy it would be to make this change, or what ramifications it may have to compatibility with other RPM releases.

Estimate includes significant testing requirements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21201</commentid>
    <comment_count>15</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2012-05-08 17:21:03 +0000</bug_when>
    <thetext>The implementation cost for adding twiddle in
version for RPM version compare is perhaps
a day.

Devising an adequate test case for twiddle-in-version
is trickier because of the number of unknown
corner cases that need to be identified
to ensure RPM is consistent with itself. There&apos;s
also a huge hidden cost as RPM tool chains adjust
to a new feature (which will likely take years, sigh).

Meanwhile -- for yocto with both dpkg+rpm -- perhaps
your interests are better served by _ALWAYS_ using
Debian version comparison. This is basically replacing
a single vector in RPM with a reimplementation (was
straight recoding from dpkgcmp(1) at the time). There&apos;s
still testing needed (noone has ever verified what I
recoded has anything to do with what Debian does) but
that is a much easier/passive/lazy test paradigm:
     Parallel dpkg/rpm implementations and add an
     assertion that the same result _ALWAYS_ is returned.

I can go either way: its the years of explaining as
the new (and mostly unnecessary) twiddle-in-version
implementation is incorporated that I&apos;m not looking
forward too. The twiddle-in-version proposal was made
like 3 years ago and is just barely starting to get
acceptance ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21301</commentid>
    <comment_count>16</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-05-11 09:13:54 +0000</bug_when>
    <thetext>I have to admit at this point I favour redirecting rpm&apos;s version comparision function to match the rest of the OE system in our usage of rpm. This is likely simpler and also less likely to result in a mismatch between what bitbake does, what another package backend does and what rpm does.

This would still allow people to customise the system and use the normal rpm algorithm if desired and appropriate for their use case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21302</commentid>
    <comment_count>17</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-05-11 09:18:43 +0000</bug_when>
    <thetext>I&apos;d also note that we&apos;ve come at this from a very specific set of directions to end up in this position. We had a number of different version comparision algorithms in different pieces of the system and were hitting bugs due to them doing slightly different things. Opkg was always intended to follow debian so making a code change there for the ~ support and aligning with dpkg/debian made sense and actually fixed a number of other inconsistencies. Bitbake itself had two algorithms (yes, nuts), one heavily used and a rather strange older one, possibly from portage with a ton of hardcoded ~ like modifiers. Again, I&apos;m very pleased to throw most of that away and use one single consistent algorithm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21702</commentid>
    <comment_count>18</comment_count>
    <who name="devzero2000">pinto.elia</who>
    <bug_when>2012-05-29 16:09:42 +0000</bug_when>
    <thetext>Just for info this is the oldest thread on this issue on
the, now, defunct duke rpm-devel mailing list.

https://lists.dulug.duke.edu/pipermail/rpm-devel/2007-April/002360.html

This type of argument makes it seem very animated discussions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41870</commentid>
    <comment_count>19</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2014-03-27 16:29:53 +0000</bug_when>
    <thetext>FWIW, rpm4 supported this in 2012:

http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=db28221a4a48f6ee3c804c92314330637c808638</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41878</commentid>
    <comment_count>20</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2014-03-27 18:27:57 +0000</bug_when>
    <thetext>And twiddle-in-version was implemented the same day @rpm5.org
(with reservations about the usefulness)

    https://www.mail-archive.com/rpm-devel@rpm5.org/msg05282.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41879</commentid>
    <comment_count>21</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2014-03-27 18:33:41 +0000</bug_when>
    <thetext>FYI, this is still open simply because the amount of testing to verify the implementation that is in RPM5 so far hasn&apos;t been worth the effort.

At a point we can verify that the behavior is the same between the three package management systems (or at least document the difference is acceptable for the purpose of OE) then we can reconcile this defect.

I do hope to spend more time when YP 1.7 rolls around on RPM issues, including this one.

--Mark</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43041</commentid>
    <comment_count>22</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2014-04-28 14:45:37 +0000</bug_when>
    <thetext>I propose that we aim to close this in 1.7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43043</commentid>
    <comment_count>23</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2014-04-28 15:37:19 +0000</bug_when>
    <thetext>+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74049</commentid>
    <comment_count>24</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-06-13 10:53:16 +0000</bug_when>
    <thetext>All of the package managers as of pyro/2.3 now support ~ with the same semantics, tested with a selftest.  Closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>