[Libguestfs] [PATCH] v2v: adding input -i ova

Richard W.M. Jones rjones at redhat.com
Sun Aug 24 10:48:09 UTC 2014


On Sun, Aug 24, 2014 at 01:42:11PM +0300, Shahar Havivi wrote:
> On 24.08.14 11:34, Richard W.M. Jones wrote:
> > On Sun, Aug 24, 2014 at 01:20:46PM +0300, Shahar Havivi wrote:
> > > After applying the patch I have a logical error at the check:
> > > if hash <> sha1 then
> > > 
> > > its looks like the sha1 is not a string but a unit
> > > let sha1 = Str.matched_group 2 line in
> > >   (sha1 : string);
> > > 
> > > Do you have an idea why?
> > > (attached the new patch)
> > 
> > The patch you sent me compiles fine here.  What's the error that you
> > see?
> The compilation is fine,
> but the condition in line 88 (input_ova.ml) is true:
> if hash <> sha1 then
> 
> then I added the commandl in line 80:
> (sha1 : string);

Right, sorry, that's because my advice before about finding types was
wrong.

If you write:

  (sha1 : string);

as a statement, then the type is checked, but because we are using
`-warn-error S', the compiler then gives an error because the
expression as a whole does not have type unit.

You can either write:

   let sha1 : string = Str.matched_group 2 line in

or:

   ignore (sha1 : string);

In any case the type is a string.

What's interesting is that hash <> sha1.  It's of course possible that
the hash of the file really is wrong, ie the OVA is corrupt.  But a
more likely possibility is the split_string command is wrong.  Try
adding:

  printf "hash = \"%s\"\n" hash;
  printf "sha1 = \"%s\"\n" sha1;

Rich.

> and I get this error:
> Warning 10: this expression should have type unit.
> > 
> > Rich.
> > 
> > -- 
> > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > Fedora Windows cross-compiler. Compile Windows programs, test, and
> > build Windows installers. Over 100 libraries supported.
> > http://fedoraproject.org/wiki/MinGW

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list