On Thursday, 29 September 2016 14:59:14 CEST Tomáš Golembiovský wrote:
The regular expression for parsing the manifest line was wrong. There
is
a mandatory space between '=' and the hash.
Another problem was that only the first line of the manifest file was
actually processed.
Can you please provide an example of manifest file with more than one
line? A real-life example, I mean.
Also added some debugging info and warning to catch problems with
parsing.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/input_ova.ml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 4f848e2..513fe30 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -133,9 +133,10 @@ object
(* Read any .mf (manifest) files and verify sha1. *)
let mf = find_files exploded ".mf" in
- let rex = Str.regexp "SHA1(\\(.*\\))=\\([0-9a-fA-F]+\\)\r?" in
+ let rex = Str.regexp "SHA1(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in
List.iter (
fun mf ->
+ debug "Processing manifest %s" mf;
let mf_folder = Filename.dirname mf in
let chan = open_in mf in
let rec loop () =
@@ -156,6 +157,11 @@ object
debug "sha1 of %s matches expected checksum %s" disk expected
| _::_ -> error (f_"cannot parse output of sha1sum command")
)
+ else
+ warning (f_"Unable to parse line from manifest file. Line is
\"%s\"")
+ (String.replace line "\r" "")
+ ;
+ loop ()
in
(try loop () with End_of_file -> ());
close_in chan
Thanks,
--
Pino Toscano