Fix bytes/string problems.
This commit is contained in:
parent
ebbe4e3e77
commit
0da9aef77a
58
0001-Fix-Bytes-String-for-OCaml-4.06.patch
Normal file
58
0001-Fix-Bytes-String-for-OCaml-4.06.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 5c5eff66dfaccb212b8906e769e40633d8b8f5e4 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 13 Feb 2018 08:20:52 +0000
|
||||
Subject: [PATCH] Fix Bytes/String for OCaml 4.06.
|
||||
|
||||
---
|
||||
src/format_ext2_kernel.ml | 4 ++--
|
||||
src/mode_build.ml | 10 ++++++----
|
||||
2 files changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
|
||||
index d5d529d..98bff3a 100644
|
||||
--- a/src/format_ext2_kernel.ml
|
||||
+++ b/src/format_ext2_kernel.ml
|
||||
@@ -290,9 +290,9 @@ and read_leshort chan offset =
|
||||
|
||||
and read_string chan offset len =
|
||||
seek_in chan offset;
|
||||
- let buf = String.create len in
|
||||
+ let buf = Bytes.create len in
|
||||
really_input chan buf 0 len;
|
||||
- buf
|
||||
+ Bytes.to_string buf
|
||||
|
||||
and copy_or_symlink_file copy_kernel src dest =
|
||||
if not copy_kernel then
|
||||
diff --git a/src/mode_build.ml b/src/mode_build.ml
|
||||
index 95869cb..b5f5fa6 100644
|
||||
--- a/src/mode_build.ml
|
||||
+++ b/src/mode_build.ml
|
||||
@@ -299,9 +299,10 @@ and update_appliance appliance lines = function
|
||||
(* Determine the [file_type] of [file], or exit with an error. *)
|
||||
and get_file_type file =
|
||||
let chan = open_in file in
|
||||
- let buf = String.create 512 in
|
||||
- let len = input chan buf 0 (String.length buf) in
|
||||
+ let buf = Bytes.create 512 in
|
||||
+ let len = input chan buf 0 (Bytes.length buf) in
|
||||
close_in chan;
|
||||
+ let buf = Bytes.to_string buf in
|
||||
|
||||
if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08'
|
||||
then (* gzip-compressed file *)
|
||||
@@ -335,8 +336,9 @@ and get_file_content file buf len =
|
||||
and get_compressed_file_content zcat file =
|
||||
let cmd = sprintf "%s %s" zcat (quote file) in
|
||||
let chan_out, chan_in, chan_err = open_process_full cmd [||] in
|
||||
- let buf = String.create 512 in
|
||||
- let len = input chan_out buf 0 (String.length buf) in
|
||||
+ let buf = Bytes.create 512 in
|
||||
+ let len = input chan_out buf 0 (Bytes.length buf) in
|
||||
+ let buf = Bytes.to_string buf in
|
||||
(* We're expecting the subprocess to fail because we close the pipe
|
||||
* early, so:
|
||||
*)
|
||||
--
|
||||
2.15.1
|
||||
|
@ -31,7 +31,7 @@
|
||||
Summary: Tool for creating supermin appliances
|
||||
Name: supermin
|
||||
Version: 5.1.19
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: GPLv2+
|
||||
|
||||
%if 0%{?rhel} >= 7
|
||||
@ -49,6 +49,9 @@ Source1: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz
|
||||
Source2: libguestfs.keyring
|
||||
%endif
|
||||
|
||||
# Upstream patch which fixes byte/string problems.
|
||||
Patch1: 0001-Fix-Bytes-String-for-OCaml-4.06.patch
|
||||
|
||||
BuildRequires: /usr/bin/pod2man
|
||||
BuildRequires: /usr/bin/pod2html
|
||||
BuildRequires: rpm
|
||||
@ -170,6 +173,9 @@ make check || {
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Feb 13 2018 Richard W.M. Jones <rjones@redhat.com> - 5.1.19-3
|
||||
- Fix bytes/string problems.
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.19-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user