Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libnbd for openSUSE:Factory checked 
in at 2023-11-01 22:11:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libnbd (Old)
 and      /work/SRC/openSUSE:Factory/.libnbd.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libnbd"

Wed Nov  1 22:11:03 2023 rev:13 rq:1121701 version:1.18.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/libnbd/libnbd.changes    2023-10-01 
21:23:22.846978203 +0200
+++ /work/SRC/openSUSE:Factory/.libnbd.new.17445/libnbd.changes 2023-11-01 
22:11:34.607215499 +0100
@@ -1,0 +2,13 @@
+Wed Oct 25 19:29:55 UTC 2023 - jfeh...@suse.com
+
+- Update to version 1.18.1:
+  * Version 1.18.1.
+  * rust: Use string_starts_with instead of String.starts_with
+  * rust: Build the examples
+  * rust: Write a custom translator from POD to rustdoc
+  * rust: Add overview documentation
+  * rust: Annotate 'endif' with corresponding label
+  * utils: Slightly simplify human_size()
+  * docs: Assign CVE-2023-5215 to nbd_get_size negative result issue
+
+-------------------------------------------------------------------

Old:
----
  libnbd-1.18.0.tar.bz2

New:
----
  _servicedata
  libnbd-1.18.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libnbd.spec ++++++
--- /var/tmp/diff_new_pack.RGF2zq/_old  2023-11-01 22:11:35.443246470 +0100
+++ /var/tmp/diff_new_pack.RGF2zq/_new  2023-11-01 22:11:35.443246470 +0100
@@ -19,7 +19,7 @@
 %define sover 0
 
 Name:           libnbd
-Version:        1.18.0
+Version:        1.18.1
 Release:        0
 Summary:        NBD client library in userspace
 License:        LGPL-2.1-or-later

++++++ _service ++++++
--- /var/tmp/diff_new_pack.RGF2zq/_old  2023-11-01 22:11:35.471247507 +0100
+++ /var/tmp/diff_new_pack.RGF2zq/_new  2023-11-01 22:11:35.475247655 +0100
@@ -1,7 +1,7 @@
 <services>
   <service name="tar_scm" mode="disabled">
     <param name="filename">libnbd</param>
-    <param name="revision">v1.18.0</param>
+    <param name="revision">v1.18.1</param>
     <param name="scm">git</param>
     <param name="submodules">disable</param>
     <param name="url">https://gitlab.com/nbdkit/libnbd.git</param>

++++++ _servicedata ++++++
<servicedata>
<service name="tar_scm">
                <param name="url">https://gitlab.com/nbdkit/libnbd.git</param>
              <param 
name="changesrevision">ebadf0df2122edb99361c66f78ac1f90f1500f96</param></service></servicedata>
(No newline at EOF)

++++++ libnbd-1.18.0.tar.bz2 -> libnbd-1.18.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/.gitignore new/libnbd-1.18.1/.gitignore
--- old/libnbd-1.18.0/.gitignore        2023-09-27 12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/.gitignore        2023-10-23 17:02:50.000000000 +0200
@@ -180,6 +180,7 @@
 /python/run-python-tests
 /run
 /rust/Cargo.lock
+/rust/libnbd-rust.3
 /rust/libnbd-sys/Cargo.lock
 /rust/libnbd-sys/libnbd_version
 /rust/libnbd-sys/src/generated.rs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/common/include/human-size.h 
new/libnbd-1.18.1/common/include/human-size.h
--- old/libnbd-1.18.0/common/include/human-size.h       2023-09-27 
12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/common/include/human-size.h       2023-10-23 
17:02:50.000000000 +0200
@@ -159,7 +159,7 @@
 static inline char *
 human_size (char *buf, uint64_t bytes, bool *human)
 {
-  static const char ext[][2] = { "E", "P", "T", "G", "M", "K", "" };
+  static const char ext[] = "EPTGMK";
   size_t i;
 
   if (buf == NULL) {
@@ -170,18 +170,16 @@
 
   /* Work out which extension to use, if any. */
   i = 6;
-  if (bytes != 0) {
-    while ((bytes & 1023) == 0) {
-      bytes >>= 10;
-      i--;
-    }
+  while (bytes && (bytes & 1023) == 0) {
+    bytes >>= 10;
+    i--;
   }
 
   /* Set the flag to true if we're going to add a human-readable extension. */
   if (human)
-    *human = ext[i][0] != '\0';
+    *human = ext[i] != '\0';
 
-  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%s", bytes, ext[i]);
+  snprintf (buf, HUMAN_SIZE_LONGEST, "%" PRIu64 "%.1s", bytes, &ext[i]);
   return buf;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/configure.ac 
new/libnbd-1.18.1/configure.ac
--- old/libnbd-1.18.0/configure.ac      2023-09-27 12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/configure.ac      2023-10-23 17:02:50.000000000 +0200
@@ -15,7 +15,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-AC_INIT([libnbd],[1.18.0])
+AC_INIT([libnbd],[1.18.1])
 
 AC_CONFIG_MACRO_DIR([m4])
 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/docs/libnbd-release-notes-1.18.pod 
new/libnbd-1.18.1/docs/libnbd-release-notes-1.18.pod
--- old/libnbd-1.18.0/docs/libnbd-release-notes-1.18.pod        2023-09-27 
12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/docs/libnbd-release-notes-1.18.pod        2023-10-23 
17:02:50.000000000 +0200
@@ -22,8 +22,8 @@
 C<-1> and so callers may or may not treat it as an error).  While no
 client code in libnbd itself is affected by this, it could affect
 external clients.  libnbd E<ge> 1.16.5 now returns an error (C<-1>)
-and sets nbd_get_errno to C<EOVERFLOW> in this case.  We have applied
-for a decision on a CVE.  See the announcement here:
+and sets nbd_get_errno to C<EOVERFLOW> in this case.  This was
+assigned CVE-2023-5215 (low severity).  See the announcement here:
 L<https://listman.redhat.com/archives/libguestfs/2023-September/032711.html>
 
 During routine fuzzing we found several security problems which had
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/docs/libnbd-security.pod 
new/libnbd-1.18.1/docs/libnbd-security.pod
--- old/libnbd-1.18.0/docs/libnbd-security.pod  2023-09-27 12:22:07.000000000 
+0200
+++ new/libnbd-1.18.1/docs/libnbd-security.pod  2023-10-23 17:02:50.000000000 
+0200
@@ -39,7 +39,8 @@
 See the full announcement here:
 L<https://listman.redhat.com/archives/libguestfs/2023-July/032035.html>
 
-=head2 negative size result from nbd_get_size(3)
+=head2 CVE-2023-5215
+negative size result from nbd_get_size(3)
 
 See the full announcement here:
 L<https://listman.redhat.com/archives/libguestfs/2023-September/032711.html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/docs/libnbd.pod 
new/libnbd-1.18.1/docs/libnbd.pod
--- old/libnbd-1.18.0/docs/libnbd.pod   2023-09-27 12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/docs/libnbd.pod   2023-10-23 17:02:50.000000000 +0200
@@ -51,6 +51,10 @@
 
 Using the API from Go.
 
+=item L<libnbd-rust(3)>
+
+Using the API from Rust.
+
 =item L<nbdsh(1)>
 
 Using the NBD shell (nbdsh) for command line and Python scripting.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/generator/Rust.ml 
new/libnbd-1.18.1/generator/Rust.ml
--- old/libnbd-1.18.0/generator/Rust.ml 2023-09-27 12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/generator/Rust.ml 2023-10-23 17:02:50.000000000 +0200
@@ -476,27 +476,88 @@
   pr "\n"
 
 (* Print the comment for a rust function for a handle call. *)
-let print_rust_handle_call_comment call =
+let rec print_rust_handle_call_comment name call =
   (* Print comments. *)
   if call.shortdesc <> "" then
     pr "/// %s\n"
       (String.concat "\n/// " (String.split_on_char '\n' call.shortdesc));
   if call.longdesc <> "" then (
-    (* If a short comment was printed, print a blank comment line befor the
-       long description. *)
+    (* If a short comment was printed, print a blank comment line before
+       the long description. *)
     if call.shortdesc <> "" then pr "/// \n";
-    (* Print all lines of the long description. Since Rust comments are
-       supposed to be Markdown, all indented lines will be treated as code
-       blocks. Hence we trim all lines. Also brackets ("[" and "]") must be
-       escaped. *)
-    List.iter
-      (fun line ->
-        let unindented = String.trim line in
-        let escaped =
-          Str.global_replace (Str.regexp {|\(\[\|\]\)|}) {|\\\1|} unindented
-        in
-        pr "/// %s\n" escaped)
-      (pod2text call.longdesc))
+    let md = longdesc_to_markdown name call.longdesc in
+    List.iter (pr "/// %s\n") md
+  )
+
+(* Convert POD to rustdoc markdown. *)
+and longdesc_to_markdown name longdesc =
+  (* Replace any POD <> expression *)
+  let content =
+    Str.global_substitute (Str.regexp {|[A-Z]<[^>]+?>|})
+      (fun s ->
+        let expr = Str.matched_string s in
+        let len = String.length expr in
+        let c = expr.[0] and content = String.sub expr 2 (len-3) in
+        match c with
+        | 'C' -> sprintf "`%s`" content (* C<...> becomes `...` *)
+        | 'B' -> sprintf "<b>%s</b>" content
+        | 'I' | 'F' -> sprintf "<i>%s</i>" content
+        | 'E' -> sprintf "&%s;" content
+        | 'L' ->
+           let len = String.length content in
+           if string_starts_with ~prefix:"nbd_" content then (
+             let n = String.sub content 4 (len - 7) in
+             if n <> "get_error" && n <> "get_errno" && n <> "close" then
+               sprintf "[%s](Handle::%s)" n n
+             else
+               sprintf "`%s`" n
+           )
+           else (* external manual page - how to link XXX *)
+             sprintf "<i>%s</i>" content
+        | _ ->
+           failwithf "rust: API documentation for %s contains '%s' which
+                      cannot be converted to Rust markdown" name expr
+      )
+      longdesc in
+
+  (* Split input into lines for rest of the processing. *)
+  let lines = nsplit "\n" content in
+
+  (* Surround any group of lines starting with whitespace with ```text *)
+  let lines =
+    List.map (fun line -> string_starts_with ~prefix:" " line, line) lines in
+  let (lines : (bool * string list) list) = group_by lines in
+  let lines =
+    List.map (function
+      | true (* verbatim *), lines -> [ "```text" ] @ lines @ [ "```" ]
+      | false, lines -> lines
+    ) lines in
+  let lines = List.flatten lines in
+
+  (* Replace any = directives *)
+  filter_map (
+    fun s ->
+      (* This is a very approximate way to translate bullet lists. *)
+      if string_starts_with ~prefix:"=over" s ||
+         string_starts_with ~prefix:"=back" s then
+        None
+      else if string_starts_with ~prefix:"=item" s then (
+        let len = String.length s in
+        let s' = String.sub s 5 (len-5) in
+        Some ("-" ^ s')
+      )
+      else if string_starts_with ~prefix:"=head" s then (
+        let i = int_of_string (String.make 1 s.[5]) in
+        let len = String.length s in
+        let s' = String.sub s 6 (len-6) in
+        Some (String.make i '#' ^ s')
+      )
+      else if string_starts_with ~prefix:"=" s then
+        failwithf "rust: API documentation for %s contains '%s' which
+                   cannot be converted to Rust markdown" name s
+      else
+        Some s
+  ) lines
 
 (* Print a Rust expression which converts Rust like arguments to FFI like
    arguments, makes a call on the raw FFI handle, and converts the return
@@ -533,7 +594,7 @@
     String.concat ", "
       (List.map2 (sprintf "%s: %s") rust_args_names rust_args_types)
   in
-  print_rust_handle_call_comment call;
+  print_rust_handle_call_comment name call;
   (* Print visibility modifier. *)
   if NameSet.mem name hidden_handle_calls then (
     (* If this is hidden to the public API, it might be used only if some 
feature
@@ -653,7 +714,7 @@
 
 (* Print the Rust function for a synchronous handle call. *)
 let print_rust_sync_handle_call name call =
-  print_rust_handle_call_comment call;
+  print_rust_handle_call_comment name call;
   pr "pub fn %s(&self, %s) -> %s\n" name
     (rust_async_handle_call_args call)
     (rust_ret_type call);
@@ -698,7 +759,7 @@
   let optargs_without_completion_cb =
     optargs_before_completion_cb @ optargs_after_completion_cb
   in
-  print_rust_handle_call_comment call;
+  print_rust_handle_call_comment name call;
   pr "pub async fn %s(&self, %s) -> SharedResult<()> {\n" name
     (rust_async_handle_call_args
        { call with optargs = optargs_without_completion_cb });
@@ -747,7 +808,7 @@
 let print_rust_async_handle_call_changing_state name aio_name call
     (predicate, value) =
   let value = if value then "true" else "false" in
-  print_rust_handle_call_comment call;
+  print_rust_handle_call_comment name call;
   pr "pub async fn %s(&self, %s) -> SharedResult<()>\n" name
     (rust_async_handle_call_args call);
   pr "{\n";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/rust/Makefile.am 
new/libnbd-1.18.1/rust/Makefile.am
--- old/libnbd-1.18.0/rust/Makefile.am  2023-09-27 12:22:07.000000000 +0200
+++ new/libnbd-1.18.1/rust/Makefile.am  2023-10-23 17:02:50.000000000 +0200
@@ -84,12 +84,14 @@
 
 EXTRA_DIST = \
        $(source_files) \
+       libnbd-rust.pod \
        $(NULL)
 
 if HAVE_RUST
 
 all-local: libnbd-sys/libnbd_version target/debug/liblibnbd.rlib \
-               target/doc/libnbd/index.html
+               target/doc/libnbd/index.html \
+               target/debug/examples/get-size
 
 libnbd-sys/libnbd_version: Makefile
        rm -f libnbd-sys/libnbd_version.t
@@ -102,6 +104,22 @@
 target/doc/libnbd/index.html: $(source_files)
        $(abs_top_builddir)/run $(CARGO) doc
 
+# This will actually build all the examples:
+target/debug/examples/get-size: $(source_files)
+       $(abs_top_builddir)/run $(CARGO) build --examples
+
+if HAVE_POD
+
+man_MANS = libnbd-rust.3
+CLEANFILES += $(man_MANS)
+
+libnbd-rust.3: libnbd-rust.pod $(top_builddir)/podwrapper.pl
+       $(PODWRAPPER) --section=3 --man $@ \
+           --html $(top_builddir)/html/$@.html \
+           $<
+
+endif HAVE_POD
+
 TESTS_ENVIRONMENT = \
        LIBNBD_DEBUG=1 \
        $(MALLOC_CHECKS) \
@@ -117,6 +135,6 @@
        $(CARGO) clean
        $(CARGO) clean --manifest-path cargo_test/Cargo.toml
 
-endif
+endif HAVE_RUST
 
 CLEANFILES += libnbd-sys/libnbd_version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libnbd-1.18.0/rust/libnbd-rust.pod 
new/libnbd-1.18.1/rust/libnbd-rust.pod
--- old/libnbd-1.18.0/rust/libnbd-rust.pod      1970-01-01 01:00:00.000000000 
+0100
+++ new/libnbd-1.18.1/rust/libnbd-rust.pod      2023-10-23 17:02:50.000000000 
+0200
@@ -0,0 +1,53 @@
+=head1 NAME
+
+libnbd-rust - how to use libnbd from Rust
+
+=head1 SYNOPSIS
+
+ let nbd = libnbd::Handle::new().unwrap();
+ nbd.connect_uri("nbd://localhost").unwrap();
+ let size = nbd.get_size().unwrap();
+ println!("{size} bytes");
+
+In C<Cargo.toml> add:
+
+ [dependencies]
+ libnbd = VERSION | { path = "libnbd/rust" }
+
+=head1 DESCRIPTION
+
+This manual page documents how to use libnbd to access Network Block
+Device (NBD) servers from the Rust programming language.
+
+The Rust bindings work very similarly to the C bindings so you should
+start by reading L<libnbd(3)>.
+
+There is also a higher level asynchronous API using Tokio.
+
+If you build libnbd from source, the main documentation can be found
+in F<libnbd/rust/target/doc/libnbd/index.html>
+
+For the ordinary interface, start by reading the documentation for
+C<Handle>.  For the higher level asynchronous API, start by reading
+C<AsyncHandle>.
+
+C<libnbd-sys> is a very low level wrapper around the libnbd API which
+should not be used directly.
+
+=head1 EXAMPLES
+
+This directory contains examples written in Rust:
+
+L<https://gitlab.com/nbdkit/libnbd/tree/master/rust/examples>
+
+=head1 SEE ALSO
+
+L<libnbd(3)>.
+
+=head1 AUTHORS
+
+Tage Johansson
+
+=head1 COPYRIGHT
+
+Copyright Tage Johansson

Reply via email to