On Mon, 21 Nov 2016 15:29:19 +0100
Pino Toscano <ptoscano(a)redhat.com> wrote:
On Saturday, 12 November 2016 16:37:50 CET Tomáš Golembiovský wrote:
> +
> + let filename = if compressed then (
> + let new_filename = tmpdir // String.random8 () ^ ".vmdk" in
> + let cmd =
> + sprintf "zcat %s > %s" (quote ovf_folder // filename)
(quote new_filename) in
> + if shell_command cmd <> 0 then
> + error (f_"error uncompressing %s, see earlier error
messages")
> + filename;
> + new_filename
> + )
> + else
> + ovf_folder // filename
> + in
IMHO this code should be where the current code is: Unix.access is
currently done on the original file, while with your code it would be
done only on the uncompressed file (either the uncompressed original,
or the decompressed one). IMHO it is always better to do the existency
check on our side, and assume that the uncompressed file will exist
if zcat didn't fail.
I see. I will move it to the original location.
--
Tomáš Golembiovský <tgolembi(a)redhat.com>