[Libguestfs] [PATCH 2/2] v2v: Fix ambiguous and probably incorrect pattern match (warning 57).

Richard W.M. Jones rjones at redhat.com
Thu Dec 8 13:54:04 UTC 2016


See:
http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#ss%3Awarn57

I believe the code as written previously was incorrect.  However we
are lucky because if neither clause matches then it will fall through
to displaying an error message, allowing the user to correct the
problem.
---
 v2v/output_vdsm.ml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
index a78e3e6..fb7dd3c 100644
--- a/v2v/output_vdsm.ml
+++ b/v2v/output_vdsm.ml
@@ -83,6 +83,9 @@ object
       let fields = List.rev fields in      (* "UUID" "data-center" ... *)
       match fields with
       | "" :: uuid :: rest                 (* handles trailing "/" case *)
+          when String.length uuid = 36 ->
+        let mp = String.concat "/" (List.rev rest) in
+        mp, uuid
       | uuid :: rest
           when String.length uuid = 36 ->
         let mp = String.concat "/" (List.rev rest) in
-- 
2.10.2




More information about the Libguestfs mailing list