Skip to content

Commit

Permalink
Don't use --force in gzip decompress
Browse files Browse the repository at this point in the history
Normally gzip stops reading input when it has reached its own end-of
input marker even when that is before the end of input. This is
overridden by --force for decompression and it is creating a problem for
us because suspend images on disk are represented as devices that are
larger than the actual content - so --force kept reading beyond the
actual input and this in turn was not accepted by the code taking the
uncompressed output.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
  • Loading branch information
lindig committed Apr 22, 2022
1 parent 3417a49 commit ab7dd15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ocaml/libs/xapi-compression/xapi_compression.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ module Make (Algorithm : ALGORITHM) = struct
let open Safe_resources in
Unixfd.with_pipe ~loc:__LOC__ () @@ fun zcat_out zcat_in ->
let args =
if mode = Compress then [] else ["--decompress"] @ ["--stdout"; "--force"]
match mode with
| Compress ->
[]
| Decompress ->
["--decompress"; "--stdout"]
in
let stdin, stdout, close_now, close_later =
match input with
Expand Down

0 comments on commit ab7dd15

Please sign in to comment.