<?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>8361</bug_id>
          
          <creation_ts>2015-09-21 01:26:04 +0000</creation_ts>
          <short_desc>opkg compare_versions is broken (old issue #166)</short_desc>
          <delta_ts>2016-05-02 22:29:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>opkg</product>
          <component>opkg</component>
          <version>0.3.0</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>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>0.3.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alejandro del Castillo">alejandro.delcastillo</reporter>
          <assigned_to name="Alejandro del Castillo">alejandro.delcastillo</assigned_to>
          <cc>michael</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54340</commentid>
    <comment_count>0</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2015-09-21 01:26:04 +0000</bug_when>
    <thetext>What steps will reproduce the problem?
1. in a shell, run `opkg compare_versions` with various versions and relations.

What is the expected output? What do you see instead?
When comparing things in Linux, it is typical for 0 to be returned if a condition is satisfied and a non-zero value otherwise. The compare_versions command in opkg does the opposite. Furthermore, several checks return the incorrect value (e.g. 1.0 &apos;=&apos; 1.0 and 1.0 &apos;&lt;&lt;&apos; 1.0 will return 0, while 1.0 &apos;&gt;&gt;&apos; 1.0 will return 1). For reference, calling `dpkg --compare-versions 1.0 &apos;=&apos; 1.0` will return 0, while `dpkg --compare-versions 1.0 &apos;&lt;&lt;&apos; 1.0` and `dpkg --compare-versions 1.0 &apos;&gt;&gt;&apos; 1.0` return 1.

What version of the product are you using? On what operating system?
0.3.0, Linux Mint 17.1 x64

Please provide any additional information below.
Functionality for checking versions is also provided in opkg-utils in opkg-compare-versions.c . Since the current implementation in opkg_cmd.c is broken and the proper functionality is included in opkg-utils, perhaps we can pull this command out from opkg and encourage the use of the version comparison functionality in opkg-utils instead?

Originally reported by ericaustinyu, Jul 23, 2015
-----------------------------------------------------------------------------</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58018</commentid>
    <comment_count>1</comment_count>
    <who name="Michael (test) Halstead">michael</who>
    <bug_when>2016-01-20 19:56:35 +0000</bug_when>
    <thetext>Testing comments on opkg bugs with an unprivileged user.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60359</commentid>
    <comment_count>2</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-03-23 18:41:13 +0000</bug_when>
    <thetext>opkg compare versions logic should follow dpkg&apos;s:

lt le eq ne ge gt       (treat empty version as earlier than any version)
lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version)

Once the internal opkg compare version logic gets fixed, the 2 utilities for comparing versions on opkg-utils should be removed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61864</commentid>
    <comment_count>3</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-05-02 22:29:57 +0000</bug_when>
    <thetext>fixed on commits by Ross Burton:

3e8521e137f662005edec1e7dd597bdd808624ea
d55020a9eee90b092cc468b458882e84a42be49a
17fe7933fa68d5b208c13ae2f9353cbd5375f253</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>