<?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>3976</bug_id>
          
          <creation_ts>2013-03-04 12:15:52 +0000</creation_ts>
          <short_desc>Support ~ in package versions</short_desc>
          <delta_ts>2017-07-31 16:44:47 +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>core</component>
          <version>1.4</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></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>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>n3npq</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</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>30397</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2013-03-04 12:15:52 +0000</bug_when>
    <thetext>We should support the ~ character in package versions. As far as I know the status is:

* Bitbake supports them
* opkg itself supports them since 2008: http://code.google.com/p/opkg/source/detail?spec=svn40&amp;r=40
* opkg-utils doesn&apos;t (e.g. opkg-compare-versions)
* rpm packaging code does not &apos;invalid tag value(&quot;^[A-Za-z0-9+._]+$&quot;) Version: Version: 0.20~rc1+git0+fdb6c0402337d9607c7a39155088eaf033742752&apos; from do_package_write_rpm
* Status of other parts of the system is unknown</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32600</commentid>
    <comment_count>1</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2013-04-24 16:34:17 +0000</bug_when>
    <thetext>Tracked at https://bugs.launchpad.net/rpm/+bug/1172341</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34777</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-07-23 10:36:35 +0000</bug_when>
    <thetext>Also, dpkg supports them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34779</commentid>
    <comment_count>3</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2013-07-23 11:37:45 +0000</bug_when>
    <thetext>The cited &quot;invalid tag value&quot; problem is a regular expression
that can be modified: add &quot;~&quot; to the permitted characters
in this macro
    %pattern_Version        ^[A-Za-z0-9+._~]+$
in the macros file to permit a &apos;~&apos; in Version:.

THe semantic changes to version comparison implied by
twiddle-in-version have been implemented for more than
a year and are present in rpm-5.4.10 (at least).

Whether opkg/opkg-utils/dpkg &quot;support&quot; twiddle in
version is largely irrelevant to rpm: rpm needs
to be self-consistent with its own tool chains.

Very few rpm tools are known to handle twiddle-in-version
correctly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34780</commentid>
    <comment_count>4</comment_count>
    <who name="Jeff Johnson">n3npq</who>
    <bug_when>2013-07-23 12:16:31 +0000</bug_when>
    <thetext>I&apos;m also obligated by full disclosure to point out
the reason (a CVE a few years back) why &apos;~&apos; (and other
characters) were not included in rpm Version: strings.

Many scripts/tools construct shell commands using
values in metadata: rpmbuild is one of those tools,
there are others.

E.g. rpmbuild removes the build tree whose name is constructed
from NVR tags in metadata. Consider this *.spec metadata:
    Name: N
    Version: V~whatever
    Release: R
from which data rpmbuild constructs a command
    rm -rf N-V~whatever
preparing for a build.

All that is needed to trick rpmbuild into removing
one&apos;s home directory is an alternative representation
for a space character in some shell context surrounding
the twiddle so that the command becomes
    rm -rf N-V ~ whatever

A closely related exploit that appended &quot;;rm -rf ~&quot; to
the Name: value (but using alternative representations of
the &apos; &apos; character was reported to vendor-sec like 4 years ago</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73057</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-05-04 16:43:24 +0000</bug_when>
    <thetext>opkg-utils should now be using more shared code so is fixed.

rpm4 supports it.

I think we&apos;re close to closing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75505</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-07-31 16:44:47 +0000</bug_when>
    <thetext>I&apos;ve added a selftest that verifies that rpm, dpkg, and opkg all do the right thing with ~ in version comparisons, and a recipe that uses ~ builds correctly:

$ find . -name test-version[-_]1*
./deb/corei7-64/test-version_1.0~beta-r0_amd64.deb
./ipk/corei7-64/test-version_1.0~beta-r0_corei7-64.ipk
./rpm/corei7_64/test-version-1.0~beta-r0.corei7_64.rpm</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>