On Saturday 01 March 2008 18:36:33 Thomas Reinke wrote:
> Not sure if that helps much.  These scripts aren't executing necessarily
> on Debian, so we can't rely on the dpkg comparison mechanism. Is
> there anything to be gained by ripping out the logic within dpkg?
>
> And speaking from experience, I can state that the GPLed comparison
> mechanism now in place in revisions-lib.inc works for almost everything
> we've seen.  About the only place we've seen it trip up is comparing
> version strings like "1.2.3" vs "1.2.3 alpha", where 1.2.3 is actually
> the latest version.  This it will not catch, and needs to be coded
> as an exception manually.
>
> But for everything else, revcomp() will give return values like
> strcmp(), but will handle numeric comparisons as true numerics,
> even when imbedded in a string:
>
> revcomp("10", "9")           => Returns 1 (10 > 9)
> revcomp("1.2", "1.2-2")      => Returns -1 (1.2 < 1.2-2)
> revcomp("v23.a3", "v23.a10") => Returns -1 (v23.a3 < v23.a10)
> revcomp("Apache/1.37.3", "Apache/1.37.4") Returns 1
>
> This gets rid of the endless stream of bugs that used to be seen
> in nasl scripts as a result of poor regex handling of version numbers
> that go from single to double digits, and makes it easy on the
> developers, since version numbers don't have to always be parsed
> out, if the prefixes of the strings being compared are the same.
>
> If you know of a circumstance where the existing mechanism doesn't
> do what it is supposed to (and could reasonably be expected to handle
> it), let me know and we'll make the improvements necessary.

That's entirely fair.  I just stumbled on it today and thought it looked 
interesting that's all.  The only immediate bonus I could see is that it uses 
Debian's internal logic so would be be 100% accurate.  I haven't actually 
found any problems with the revcomp function ;).

Tim
-- 
Tim Brown
<mailto:[EMAIL PROTECTED]>
<http://www.nth-dimension.org.uk/>
_______________________________________________
Openvas-devel mailing list
[email protected]
http://lists.wald.intevation.org/mailman/listinfo/openvas-devel

Reply via email to