FreeBSD Bugzilla – Attachment 8655 Details for
Bug 18030
[PATCH] pkg_version thinks 4.04 > 4.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.76 KB, created by
Andrew Stevenson
on 2000-04-16 03:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Andrew Stevenson
Created:
2000-04-16 03:50:01 UTC
Size:
1.76 KB
patch
obsolete
>--- pkg_version.pl.orig Mon Dec 6 13:19:16 1999 >+++ pkg_version.pl Sun Apr 16 12:32:36 2000 >@@ -57,36 +57,39 @@ > # This function returns -1, 0, or 1, in the same manner as <=> or cmp. > # > sub CompareVersions { >- local($v1, $v2); >+ my($v1, $v2); > $v1 = $_[0]; > $v2 = $_[1]; > > # Short-cut in case of equality > if ($v1 eq $v2) { >- return 0; >+ return 0; > } > > # Loop over different components (the parts separated by dots). > # If any component differs, we have the basis for an inequality. > while (1) { >- ($p1, $v1) = split(/\./, $v1, 2); >- ($p2, $v2) = split(/\./, $v2, 2); >+ ($p1, $v1) = split(/\./, $v1, 2); >+ ($p2, $v2) = split(/\./, $v2, 2); > >- # If we\'re out of components, they\'re equal (this probably won\'t >- # happen, since the short-cut case above should get this). >- if (($p1 eq "") && ($p2 eq "")) { >- return 0; >- } >- # Check for numeric inequality. We assume here that (for example) >- # 3.09 < 3.10. >- elsif ($p1 != $p2) { >- return $p1 <=> $p2; >- } >- # Check for string inequality, given numeric equality. This >- # handles version numbers of the form 3.4j < 3.4k. >- elsif ($p1 ne $p2) { >- return $p1 cmp $p2; >- } >+ # If we\'re out of components, they\'re equal (this probably won\'t >+ # happen, since the short-cut case above should get this). >+ if (($p1 eq "") && ($p2 eq "")) { >+ return 0; >+ } >+ # Check for numeric inequality. We assume here that (for example) >+ # 3.09 < 3.10. We force a . on the front of $p1 and $p2 so that >+ # 4.1 > 4.04 >+ elsif ($p1 != $p2) { >+ $p1 = '.' . $p1; >+ $p2 = '.' . $p2; >+ return $p1 <=> $p2; >+ } >+ # Check for string inequality, given numeric equality. This >+ # handles version numbers of the form 3.4j < 3.4k. >+ elsif ($p1 ne $p2) { >+ return $p1 cmp $p2; >+ } > } > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18030
: 8655