# HG changeset patch # User David Scott # Date 1259253843 0 # Node ID c512a7857329c62e8ba44bc76e70f1068a0d1abb # Parent 6fd77ef2569ead1d2cbc5ca6a6d496519e966fc0 CA-35383: if the tools filename build number has a non-digit suffix, disregard it. XCP hosts currently have tools isos in /opt/xensource/packages/iso/xs-tools--.iso where is an integer and is a string. Signed-off-by: David Scott diff -r 6fd77ef2569e -r c512a7857329 ocaml/xapi/xapi_pv_driver_version.ml --- a/ocaml/xapi/xapi_pv_driver_version.ml Tue Nov 24 15:17:56 2009 +0000 +++ b/ocaml/xapi/xapi_pv_driver_version.ml Thu Nov 26 16:44:03 2009 +0000 @@ -43,7 +43,12 @@ match String.split '.' mid with | [ maj; min; mic_plus_build ] -> begin match String.split '-' mic_plus_build with - | [ mic; build ] -> int_of_string maj, int_of_string min, int_of_string mic, int_of_string build + | [ mic; build ] -> + (* Build numbers often have a non-digit suffix: remove this *) + let isdigit c = Char.code c >= (Char.code '0') && (Char.code c <= (Char.code '9')) in + let build = String.strip (fun c -> not (isdigit c)) build in + + int_of_string maj, int_of_string min, int_of_string mic, int_of_string build | [ mic ] -> int_of_string maj, int_of_string min, int_of_string mic, -1 | _ -> none (* never happens *) end