Tage Johansson
2023-Sep-01  08:40 UTC
[Libguestfs] [libnbd PATCH 0/2] (Attempt to) fix some Rust CI failures
These are two minor fixes to the Rust bindings to fix some CI failures. -- Best regards, Tage Tage Johansson (2): generator: Add string_starts_with functions to utils.ml rust: Add missing files to EXTRA_DIST generator/utils.ml | 11 +++++++++++ generator/utils.mli | 3 +++ rust/Makefile.am | 1 + 3 files changed, 15 insertions(+) base-commit: 9afb980d05d6144129c899285e44779757a380e8 prerequisite-patch-id: 8d1779610795021ed5a3d0973ddf9ef854cd6a24 prerequisite-patch-id: 1f0f333311f11ac9b1ff0be08f5aa0a9904ba4de prerequisite-patch-id: dc4af7343c57a4f99dc82918c07470030e542747 prerequisite-patch-id: 8e8f7a043c80d6c24e883967f5bd952a64db1228 prerequisite-patch-id: ba7b3482e2e16f76b5f285daeeda30b31a841912 prerequisite-patch-id: 219a9595e550a8caf43d466dcb2b044114e1b7bf prerequisite-patch-id: 3de46c9673221bff1d897970aa983b3f8e6cab74 prerequisite-patch-id: 4235d5e174fce05b9a947b3b838bebf968f0fa6a prerequisite-patch-id: 07773355d5718e0593c4030a8f035fc11fea3715 prerequisite-patch-id: f023deea8b706706e3c2980403064d90a254af3c -- 2.42.0
Tage Johansson
2023-Sep-01  08:40 UTC
[Libguestfs] [libnbd PATCH 1/2] generator: Add string_starts_with functions to utils.ml
Previously, the file Rust.ml used the function String.starts_with. But
this function is not available in older versions of OCaml. So an
identical function (string_starts_with) has been created in utils.ml to
be used instead.
---
 generator/utils.ml  | 11 +++++++++++
 generator/utils.mli |  3 +++
 2 files changed, 14 insertions(+)
diff --git a/generator/utils.ml b/generator/utils.ml
index 96c15ac..9f97aa7 100644
--- a/generator/utils.ml
+++ b/generator/utils.ml
@@ -570,3 +570,14 @@ let camel_case name        a ^ String.uppercase_ascii
(Str.first_chars x 1) ^
           String.lowercase_ascii (Str.string_after x 1)
   ) "" xs
+
+(* Copied from OCaml's stdlib because it was not available in earlier
versions
+   of OCaml. *)
+let string_starts_with ~prefix s +  let len_s = String.length s
+  and len_pre = String.length prefix in
+  let rec aux i +    if i = len_pre then true
+    else if String.unsafe_get s i <> String.unsafe_get prefix i then
false
+    else aux (i + 1)
+  in len_s >= len_pre && aux 0
diff --git a/generator/utils.mli b/generator/utils.mli
index c7681a9..d2def0b 100644
--- a/generator/utils.mli
+++ b/generator/utils.mli
@@ -80,3 +80,6 @@ val pod2text : cache_key -> cache_value
 
 (* Convert C function name to upper-camel-case name. *)
 val camel_case : string -> string
+
+(* Same as [String.starts_with] in later versions of OCaml. *)
+val string_starts_with : prefix:string -> string -> bool
-- 
2.42.0
Tage Johansson
2023-Sep-01  08:40 UTC
[Libguestfs] [libnbd PATCH 2/2] rust: Add missing files to EXTRA_DIST
--- rust/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/Makefile.am b/rust/Makefile.am index 027097a..c5933e5 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -36,6 +36,7 @@ source_files = \ examples/connect-command.rs \ examples/get-size.rs \ examples/fetch-first-sector.rs \ + examples/concurrent-read-write.rs \ libnbd-sys/Cargo.toml \ libnbd-sys/build.rs \ libnbd-sys/src/lib.rs \ -- 2.42.0
Richard W.M. Jones
2023-Sep-01  09:43 UTC
[Libguestfs] [libnbd PATCH 0/2] (Attempt to) fix some Rust CI failures
Thanks - I believe we have equivalent fixes upstream now. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com nbdkit - Flexible, fast NBD server with plugins https://gitlab.com/nbdkit/nbdkit