adelcast / opkg_old

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

opkg compare_versions is broken #166

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 '=' 1.0 and 1.0 '<<' 1.0 will return 0, while 1.0 
'>>' 1.0 will return 1). For reference, calling `dpkg --compare-versions 1.0 
'=' 1.0` will return 0, while `dpkg --compare-versions 1.0 '<<' 1.0` and `dpkg 
--compare-versions 1.0 '>>' 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?

Original issue reported on code.google.com by ericaust...@gmail.com on 23 Jul 2015 at 8:48

GoogleCodeExporter commented 8 years ago
For clarity, here are some specific examples demonstrating the issue:

# opkg compare_versions 1 '<<' 0; echo $?
0
# opkg compare_versions 1 '=' 0; echo $?
0
# opkg compare_versions 1 '>>' 0; echo $?
1

# opkg compare_versions 1 '<<' 2; echo $?
1
# opkg compare_versions 1 '=' 2; echo $?
0
# opkg compare_versions 1 '>>' 2; echo $?
0

# opkg compare_versions 1 '<<' 1; echo $?
0
# opkg compare_versions 1 '=' 1; echo $?
0
# opkg compare_versions 1 '>>' 1; echo $?
1

Original comment by ericaust...@gmail.com on 23 Jul 2015 at 9:01

GoogleCodeExporter commented 8 years ago
this was suggested a while back:

https://groups.google.com/forum/?fromgroups#!searchin/opkg-devel/compare$20versi
ons/opkg-devel/skJyyKqzr-4/Fcm2-KKES_QJ

Original comment by alejandr...@gmail.com on 23 Jul 2015 at 11:45