Fix -safe-string.
This commit is contained in:
parent
b6d13f909e
commit
b7b940a2e8
76
0001-Use-safe-string-and-fix-the-library.patch
Normal file
76
0001-Use-safe-string-and-fix-the-library.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
From bab7f84ade84ceaddb08b6948792d49b3d04b897 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Wed, 8 Nov 2017 16:52:58 +0000
|
||||||
|
Subject: [PATCH] Use -safe-string and fix the library.
|
||||||
|
|
||||||
|
Note this changes the type of the cpumap from string to bytes,
|
||||||
|
since (by the design of the API) it must be mutated.
|
||||||
|
---
|
||||||
|
libvirt/Makefile.in | 4 ++--
|
||||||
|
libvirt/libvirt.ml | 10 +++++-----
|
||||||
|
libvirt/libvirt.mli | 6 +++---
|
||||||
|
3 files changed, 10 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libvirt/Makefile.in b/libvirt/Makefile.in
|
||||||
|
index cf614fc..1eb846b 100644
|
||||||
|
--- a/libvirt/Makefile.in
|
||||||
|
+++ b/libvirt/Makefile.in
|
||||||
|
@@ -31,11 +31,11 @@ OCAMLMKLIB = @OCAMLMKLIB@
|
||||||
|
|
||||||
|
ifneq ($(OCAMLFIND),)
|
||||||
|
OCAMLCPACKAGES := -package unix
|
||||||
|
-OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3
|
||||||
|
+OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3 -safe-string
|
||||||
|
OCAMLCLIBS := -linkpkg
|
||||||
|
else
|
||||||
|
OCAMLCINCS :=
|
||||||
|
-OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3
|
||||||
|
+OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3 -safe-string
|
||||||
|
OCAMLCLIBS := unix.cma
|
||||||
|
endif
|
||||||
|
|
||||||
|
diff --git a/libvirt/libvirt.ml b/libvirt/libvirt.ml
|
||||||
|
index d03a127..7e1e470 100644
|
||||||
|
--- a/libvirt/libvirt.ml
|
||||||
|
+++ b/libvirt/libvirt.ml
|
||||||
|
@@ -92,13 +92,13 @@ struct
|
||||||
|
|
||||||
|
(* See VIR_USE_CPU, VIR_UNUSE_CPU, VIR_CPU_USABLE macros defined in <libvirt.h>. *)
|
||||||
|
let use_cpu cpumap cpu =
|
||||||
|
- cpumap.[cpu/8] <-
|
||||||
|
- Char.chr (Char.code cpumap.[cpu/8] lor (1 lsl (cpu mod 8)))
|
||||||
|
+ Bytes.set cpumap (cpu/8)
|
||||||
|
+ (Char.chr (Char.code (Bytes.get cpumap (cpu/8)) lor (1 lsl (cpu mod 8))))
|
||||||
|
let unuse_cpu cpumap cpu =
|
||||||
|
- cpumap.[cpu/8] <-
|
||||||
|
- Char.chr (Char.code cpumap.[cpu/8] land (lnot (1 lsl (cpu mod 8))))
|
||||||
|
+ Bytes.set cpumap (cpu/8)
|
||||||
|
+ (Char.chr (Char.code (Bytes.get cpumap (cpu/8)) land (lnot (1 lsl (cpu mod 8)))))
|
||||||
|
let cpu_usable cpumaps maplen vcpu cpu =
|
||||||
|
- Char.code cpumaps.[vcpu*maplen + cpu/8] land (1 lsl (cpu mod 8)) <> 0
|
||||||
|
+ Char.code (Bytes.get cpumaps (vcpu*maplen + cpu/8)) land (1 lsl (cpu mod 8)) <> 0
|
||||||
|
|
||||||
|
external set_keep_alive : [>`R] t -> int -> int -> unit = "ocaml_libvirt_connect_set_keep_alive"
|
||||||
|
|
||||||
|
diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli
|
||||||
|
index dc0033b..87f50f5 100644
|
||||||
|
--- a/libvirt/libvirt.mli
|
||||||
|
+++ b/libvirt/libvirt.mli
|
||||||
|
@@ -376,11 +376,11 @@ sig
|
||||||
|
CPU map between a single virtual and all physical CPUs of a domain.
|
||||||
|
*)
|
||||||
|
|
||||||
|
- val use_cpu : string -> int -> unit
|
||||||
|
+ val use_cpu : bytes -> int -> unit
|
||||||
|
(** [use_cpu cpumap cpu] marks [cpu] as usable in [cpumap]. *)
|
||||||
|
- val unuse_cpu : string -> int -> unit
|
||||||
|
+ val unuse_cpu : bytes -> int -> unit
|
||||||
|
(** [unuse_cpu cpumap cpu] marks [cpu] as not usable in [cpumap]. *)
|
||||||
|
- val cpu_usable : string -> int -> int -> int -> bool
|
||||||
|
+ val cpu_usable : bytes -> int -> int -> int -> bool
|
||||||
|
(** [cpu_usable cpumaps maplen vcpu cpu] checks returns true iff the
|
||||||
|
[cpu] is usable by [vcpu]. *)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.1
|
||||||
|
|
@ -1,8 +1,6 @@
|
|||||||
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
|
|
||||||
|
|
||||||
Name: ocaml-libvirt
|
Name: ocaml-libvirt
|
||||||
Version: 0.6.1.4
|
Version: 0.6.1.4
|
||||||
Release: 24%{?dist}
|
Release: 25%{?dist}
|
||||||
Summary: OCaml binding for libvirt
|
Summary: OCaml binding for libvirt
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
|
|
||||||
@ -31,6 +29,9 @@ Patch8: 0003-Add-a-binding-for-virConnectGetAllDomainStats-RHBZ-1.patch
|
|||||||
Patch9: 0004-examples-Print-more-stats-in-the-get_all_domain_stat.patch
|
Patch9: 0004-examples-Print-more-stats-in-the-get_all_domain_stat.patch
|
||||||
Patch10: 0005-Change-binding-of-virConnectGetAllDomainStats-to-ret.patch
|
Patch10: 0005-Change-binding-of-virConnectGetAllDomainStats-to-ret.patch
|
||||||
|
|
||||||
|
# Upstream patch to use -safe-string.
|
||||||
|
Patch11: 0001-Use-safe-string-and-fix-the-library.patch
|
||||||
|
|
||||||
BuildRequires: ocaml >= 3.10.0
|
BuildRequires: ocaml >= 3.10.0
|
||||||
BuildRequires: ocaml-ocamldoc
|
BuildRequires: ocaml-ocamldoc
|
||||||
BuildRequires: ocaml-findlib-devel
|
BuildRequires: ocaml-findlib-devel
|
||||||
@ -56,23 +57,13 @@ developing applications that use %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%autopatch -p1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
%patch7 -p1
|
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure
|
%configure
|
||||||
make all doc
|
make all doc
|
||||||
%if %opt
|
%ifarch %{ocaml_native_compiler}
|
||||||
make opt
|
make opt
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -83,7 +74,7 @@ export DESTDIR=$RPM_BUILD_ROOT
|
|||||||
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
|
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
|
||||||
mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs
|
mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
||||||
%if %opt
|
%ifarch %{ocaml_native_compiler}
|
||||||
make install-opt
|
make install-opt
|
||||||
%else
|
%else
|
||||||
make install-byte
|
make install-byte
|
||||||
@ -93,7 +84,7 @@ make install-byte
|
|||||||
%files
|
%files
|
||||||
%doc COPYING.LIB README ChangeLog
|
%doc COPYING.LIB README ChangeLog
|
||||||
%{_libdir}/ocaml/libvirt
|
%{_libdir}/ocaml/libvirt
|
||||||
%if %opt
|
%ifarch %{ocaml_native_compiler}
|
||||||
%exclude %{_libdir}/ocaml/libvirt/*.a
|
%exclude %{_libdir}/ocaml/libvirt/*.a
|
||||||
%exclude %{_libdir}/ocaml/libvirt/*.cmxa
|
%exclude %{_libdir}/ocaml/libvirt/*.cmxa
|
||||||
%exclude %{_libdir}/ocaml/libvirt/*.cmx
|
%exclude %{_libdir}/ocaml/libvirt/*.cmx
|
||||||
@ -105,7 +96,7 @@ make install-byte
|
|||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%doc COPYING.LIB README TODO.libvirt ChangeLog html/*
|
%doc COPYING.LIB README TODO.libvirt ChangeLog html/*
|
||||||
%if %opt
|
%ifarch %{ocaml_native_compiler}
|
||||||
%{_libdir}/ocaml/libvirt/*.a
|
%{_libdir}/ocaml/libvirt/*.a
|
||||||
%{_libdir}/ocaml/libvirt/*.cmxa
|
%{_libdir}/ocaml/libvirt/*.cmxa
|
||||||
%{_libdir}/ocaml/libvirt/*.cmx
|
%{_libdir}/ocaml/libvirt/*.cmx
|
||||||
@ -114,11 +105,8 @@ make install-byte
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Nov 08 2017 Richard W.M. Jones <rjones@redhat.com> - 0.6.1.4-24
|
* Wed Nov 08 2017 Richard W.M. Jones <rjones@redhat.com> - 0.6.1.4-25
|
||||||
- Bump release and rebuild.
|
- Fix -safe-string.
|
||||||
|
|
||||||
* Wed Nov 08 2017 Richard W.M. Jones <rjones@redhat.com> - 0.6.1.4-23
|
|
||||||
- Bump release and rebuild.
|
|
||||||
|
|
||||||
* Tue Nov 07 2017 Richard W.M. Jones <rjones@redhat.com> - 0.6.1.4-22
|
* Tue Nov 07 2017 Richard W.M. Jones <rjones@redhat.com> - 0.6.1.4-22
|
||||||
- OCaml 4.06.0 rebuild.
|
- OCaml 4.06.0 rebuild.
|
||||||
|
Loading…
Reference in New Issue
Block a user