Blame SOURCES/0001-Fix-Bytes-String-for-OCaml-4.06.patch

1c4e8d
From 5c5eff66dfaccb212b8906e769e40633d8b8f5e4 Mon Sep 17 00:00:00 2001
1c4e8d
From: "Richard W.M. Jones" <rjones@redhat.com>
1c4e8d
Date: Tue, 13 Feb 2018 08:20:52 +0000
1c4e8d
Subject: [PATCH 1/2] Fix Bytes/String for OCaml 4.06.
1c4e8d
1c4e8d
---
1c4e8d
 src/format_ext2_kernel.ml |  4 ++--
1c4e8d
 src/mode_build.ml         | 10 ++++++----
1c4e8d
 2 files changed, 8 insertions(+), 6 deletions(-)
1c4e8d
1c4e8d
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
1c4e8d
index d5d529d..98bff3a 100644
1c4e8d
--- a/src/format_ext2_kernel.ml
1c4e8d
+++ b/src/format_ext2_kernel.ml
1c4e8d
@@ -290,9 +290,9 @@ and read_leshort chan offset =
1c4e8d
 
1c4e8d
 and read_string chan offset len =
1c4e8d
   seek_in chan offset;
1c4e8d
-  let buf = String.create len in
1c4e8d
+  let buf = Bytes.create len in
1c4e8d
   really_input chan buf 0 len;
1c4e8d
-  buf
1c4e8d
+  Bytes.to_string buf
1c4e8d
 
1c4e8d
 and copy_or_symlink_file copy_kernel src dest =
1c4e8d
   if not copy_kernel then
1c4e8d
diff --git a/src/mode_build.ml b/src/mode_build.ml
1c4e8d
index 95869cb..b5f5fa6 100644
1c4e8d
--- a/src/mode_build.ml
1c4e8d
+++ b/src/mode_build.ml
1c4e8d
@@ -299,9 +299,10 @@ and update_appliance appliance lines = function
1c4e8d
 (* Determine the [file_type] of [file], or exit with an error. *)
1c4e8d
 and get_file_type file =
1c4e8d
   let chan = open_in file in
1c4e8d
-  let buf = String.create 512 in
1c4e8d
-  let len = input chan buf 0 (String.length buf) in
1c4e8d
+  let buf = Bytes.create 512 in
1c4e8d
+  let len = input chan buf 0 (Bytes.length buf) in
1c4e8d
   close_in chan;
1c4e8d
+  let buf = Bytes.to_string buf in
1c4e8d
 
1c4e8d
   if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08'
1c4e8d
   then                                  (* gzip-compressed file *)
1c4e8d
@@ -335,8 +336,9 @@ and get_file_content file buf len =
1c4e8d
 and get_compressed_file_content zcat file =
1c4e8d
   let cmd = sprintf "%s %s" zcat (quote file) in
1c4e8d
   let chan_out, chan_in, chan_err = open_process_full cmd [||] in
1c4e8d
-  let buf = String.create 512 in
1c4e8d
-  let len = input chan_out buf 0 (String.length buf) in
1c4e8d
+  let buf = Bytes.create 512 in
1c4e8d
+  let len = input chan_out buf 0 (Bytes.length buf) in
1c4e8d
+  let buf = Bytes.to_string buf in
1c4e8d
   (* We're expecting the subprocess to fail because we close the pipe
1c4e8d
    * early, so:
1c4e8d
    *)
1c4e8d
-- 
1c4e8d
2.19.0.rc0
1c4e8d