Pino Toscano | 26 Jan 17:04 2015
Picon

[PATCH 1/6] cmd: add a way to run (and wait) asynchronously commands

---
 src/command.c          | 64 +++++++++++++++++++++++++++++++++++++++++++-------
 src/guestfs-internal.h |  3 +++
 2 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/src/command.c b/src/command.c
index 4bb469b..e26573d 100644
--- a/src/command.c
+++ b/src/command.c
 <at>  <at>  -360,7 +360,7  <at>  <at>  debug_command (struct command *cmd)
 }

 static int
-run_command (struct command *cmd)
+run_command (struct command *cmd, bool get_stdout_fd, bool get_stderr_fd)
 {
   struct sigaction sa;
   int i, fd, max_fd, r;
 <at>  <at>  -368,8 +368,11  <at>  <at>  run_command (struct command *cmd)
   int outfd[2] = { -1, -1 };
   char status_string[80];

+  get_stdout_fd = get_stdout_fd || cmd->stdout_callback != NULL;
+  get_stderr_fd = get_stderr_fd || cmd->capture_errors;
+
   /* Set up a pipe to capture command output and send it to the error log. */
-  if (cmd->capture_errors) {
+  if (get_stderr_fd) {
     if (pipe2 (errorfd, O_CLOEXEC) == -1) {
       perrorf (cmd->g, "pipe2");
(Continue reading)

Maros Zatko | 23 Jan 16:18 2015
Picon

[PATCH v2] virt-copy, virt-tar: show help for -h

Shows manpage for virt-copy-in,out and virt-tar-in,out
when user supplies -h as a parameter instead of listing
unrelated commands with descriptions.

Maros Zatko (1):
  virt-copy, virt-tar: show help for -h

 fish/virt-copy-in  | 13 ++++++++++++-
 fish/virt-copy-out | 13 ++++++++++++-
 fish/virt-tar-in   | 13 ++++++++++++-
 fish/virt-tar-out  | 13 ++++++++++++-
 4 files changed, 48 insertions(+), 4 deletions(-)

--

-- 
1.9.3
Maros Zatko | 23 Jan 14:59 2015
Picon

[PATCH] virt-copy, virt-tar: show help for -h

Shows manpage for virt-copy-in,out and virt-tar-in,out
when user supplies -h as a parameter instead of listing
unrelated commands with descriptions.

Maros Zatko (1):
  virt-copy, virt-tar: show help for -h

 fish/virt-copy-in  | 13 ++++++++++++-
 fish/virt-copy-out | 13 ++++++++++++-
 fish/virt-tar-in   | 13 ++++++++++++-
 fish/virt-tar-out  | 13 ++++++++++++-
 4 files changed, 48 insertions(+), 4 deletions(-)

--

-- 
1.9.3
Pino Toscano | 23 Jan 11:23 2015
Picon

[PATCH 1/2] mllib: tests: add tests for string_lines_split

---
 mllib/common_utils_tests.ml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml
index 09d5c51..283e9a1 100644
--- a/mllib/common_utils_tests.ml
+++ b/mllib/common_utils_tests.ml
 <at>  <at>  -27,6 +27,7  <at>  <at>  let prog = "common_utils_tests"
 let assert_equal_string = assert_equal ~printer:(fun x -> x)
 let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x)
 let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x)
+let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat
"," x)) ^ ")")

 (* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *)
 let test_le32 () =
 <at>  <at>  -110,6 +111,22  <at>  <at>  let test_string_find () =
   assert_equal_int (-1) (string_find "" "baz");
   assert_equal_int (-1) (string_find "foobar" "baz")

+(* Test Common_utils.string_lines_split. *)
+let test_string_lines_split () =
+  assert_equal_stringlist [""] (string_lines_split "");
+  assert_equal_stringlist ["A"] (string_lines_split "A");
+  assert_equal_stringlist ["A"; ""] (string_lines_split "A\n");
+  assert_equal_stringlist ["A"; "B"] (string_lines_split "A\nB");
+  assert_equal_stringlist ["A"; "B"; "C"] (string_lines_split "A\nB\nC");
+  assert_equal_stringlist ["A"; "B"; "C"; "D"] (string_lines_split "A\nB\nC\nD");
+  assert_equal_stringlist ["A\n"] (string_lines_split "A\\");
(Continue reading)

Pino Toscano | 22 Jan 18:35 2015
Picon

[PATCH 1/2] configure: look for the oUnit OCaml module

It will be used for the OCaml unit tests.
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index e0fb481..e360bbb 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -1120,6 +1120,7  <at>  <at>  AS_IF([test "x$OCAMLC" != "xno"],[
 ])

 OCAML_PKG_gettext=no
+OCAML_PKG_oUnit=no
 AS_IF([test "x$OCAMLC" != "xno"],[
     # Create mllib/common_gettext.ml, gettext functions or stubs.

 <at>  <at>  -1128,9 +1129,13  <at>  <at>  AS_IF([test "x$OCAMLC" != "xno"],[
     mkdir -p mllib

     GUESTFS_CREATE_COMMON_GETTEXT_ML([mllib/common_gettext.ml])
+
+    AC_CHECK_OCAML_PKG(oUnit)
 ])
 AM_CONDITIONAL([HAVE_OCAML_PKG_GETTEXT],
     [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_gettext" != "xno"])
+AM_CONDITIONAL([HAVE_OCAML_PKG_OUNIT],
+    [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_oUnit" != "xno"])

 AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no])
(Continue reading)

Pino Toscano | 21 Jan 16:32 2015
Picon

[PATCH] customize: add --commands-from-file

Pass to --commands-from-file the name of a file containing customization
commands in each line, as if they were specified as command line
arguments.

This eases the reuse of commands among different
builder/customize/sysprep invocations.
---
 builder/cmdline.ml         |  3 +-
 customize/customize_run.ml |  5 +++
 generator/customize.ml     | 98 ++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 101 insertions(+), 5 deletions(-)

diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index bb7b1d0..1c6ab98 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
 <at>  <at>  -308,7 +308,8  <at>  <at>  read the man page virt-builder(1).
           | `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
           | `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
           | `Password _ | `RootPassword _ | `Scrub _ | `SSHInject _
-          | `Timezone _ | `Upload _ | `Write _ | `Chmod _ -> false
+          | `Timezone _ | `Upload _ | `Write _ | `Chmod _
+          | `CommandsFromFile _ -> false
         ) ops.ops in
         if requires_execute_on_guest then
           error (f_"sorry, cannot run commands on a guest with a different architecture");
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 19b7a7d..fed905b 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
(Continue reading)

Richard W.M. Jones | 21 Jan 14:13 2015
Picon

[PATCH] aarch64: launch: libvirt: As a workaround, pass -cpu parameter to qemu.

From: "Richard W.M. Jones" <rjones <at> redhat.com>

When libguestfs is running using TCG on aarch64, we need to pass the
-cpu cortex-a57 parameter to qemu.  Libvirt doesn't let us do this,
complaining "Unable to find CPU definition".

As a temporary workaround only, use <qemu:commandline> to pass this
argument directly to qemu.  When libvirt is fixed we can remove this
hack.

This is a workaround for libvirt bug RHBZ#1184411.

See:
https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
https://bugzilla.redhat.com/show_bug.cgi?id=1184411
---
 src/launch-libvirt.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index 7a57f30..ca12320 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
 <at>  <at>  -1085,12 +1085,16  <at>  <at>  construct_libvirt_xml_cpu (guestfs_h *g,
         } end_element ();
       }
       else {
-        /* XXX This does not work, see:
+        /* XXX This does not work on aarch64, see:
          * https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
(Continue reading)

Richard W.M. Jones | 21 Jan 14:13 2015
Picon

[PATCH] aarch64: appliance: Use AAVMF (UEFI) if available for running the appliance.

From: "Richard W.M. Jones" <rjones <at> redhat.com>

AAVMF is an open source UEFI implementation for aarch64 based on OVMF.
As aarch64 is heading for requiring UEFI even inside guests, if the
AAVMF firmware is installed on the host, use it as a hint that we
should boot the guest using AAVMF instead of the default "empty
machine".

Note this requires very recent AAVMF, libvirt, qemu.  However that's
OK since it's only applicable to aarch64.  On non-aarch64, this patch
does nothing.

Thanks: Laszlo Ersek for a lot of help getting this right.
---
 src/appliance.c        | 66 +++++++++++++++++++++++++++++++++++++++++++++++++-
 src/guestfs-internal.h |  1 +
 src/launch-direct.c    | 14 +++++++++++
 src/launch-libvirt.c   | 25 +++++++++++++++++++
 4 files changed, 105 insertions(+), 1 deletion(-)

diff --git a/src/appliance.c b/src/appliance.c
index d7aa6b1..5fa47f2 100644
--- a/src/appliance.c
+++ b/src/appliance.c
 <at>  <at>  -1,5 +1,5  <at>  <at> 
 /* libguestfs
- * Copyright (C) 2010-2012 Red Hat Inc.
+ * Copyright (C) 2010-2014 Red Hat Inc.
  *
  * This library is free software; you can redistribute it and/or
(Continue reading)

Pino Toscano | 20 Jan 16:28 2015
Picon

[PATCH] daemon: readdir: fix invalid memory access on error

If "strdup (d->d_name)" fails with "i" > 0, then both "p" and
"ret->guestfs_int_dirent_list_val" are non-null pointers, but the latter
is no more valid (since "p" is the new realloc'ed buffer). Hence, trying
to free both will access to invalid memory.

Make sure to free only one of them, "p" if not null or
"ret->guestfs_int_dirent_list_val" otherwise.
---
 daemon/readdir.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/daemon/readdir.c b/daemon/readdir.c
index f0ddd21..e488f93 100644
--- a/daemon/readdir.c
+++ b/daemon/readdir.c
 <at>  <at>  -27,6 +27,17  <at>  <at> 
 #include "daemon.h"
 #include "actions.h"

+static void
+free_int_dirent_list (guestfs_int_dirent *p, size_t len)
+{
+  size_t i;
+
+  for (i = 0; i < len; ++i) {
+    free (p[i].name);
+  }
+  free (p);
+}
+
(Continue reading)

Pino Toscano | 19 Jan 16:20 2015
Picon

[PATCH] gobject: fix printf conversion specifier

Use PRIu64 to correctly handle uint64_t.
---
 generator/gobject.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/generator/gobject.ml b/generator/gobject.ml
index 5deb87e..5b07edd 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
 <at>  <at>  -722,6 +722,7  <at>  <at>  let generate_gobject_session_source () =
   #include <stdint.h>
   #include <stdio.h>
   #include <string.h>
+  #include <inttypes.h>

 /* Error quark */

 <at>  <at>  -780,7 +781,7  <at>  <at>  guestfs_session_event_from_guestfs_event (uint64_t event)
 pr "
   }

-  g_warning (\"guestfs_session_event_from_guestfs_event: invalid event %%lu\",
+  g_warning (\"guestfs_session_event_from_guestfs_event: invalid event %%\" PRIu64,
             event);
   return UINT32_MAX;
 }
--

-- 
1.9.3
Pino Toscano | 19 Jan 16:00 2015
Picon

[PATCH] build: check for single libsystemd before libsystemd-journal

Since systemd 209, all the functionalities of the former libsystemd-*
(including libsystemd-journal) have been merged into a single
libsystemd, with the former libraries left as compatibility ones.

Thus, first look for libsystemd, and if not found try again with the
libsystemd-journal as used before.
---
 configure.ac | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1784264..7f8743b 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -1015,12 +1015,19  <at>  <at>  PKG_CHECK_MODULES([HIVEX], [hivex],[
 AM_CONDITIONAL([HAVE_HIVEX],[test "x$HIVEX_LIBS" != "x"])

 dnl systemd journal library (optional)
-PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd-journal >= 196],[
+PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd],[
     AC_SUBST([SD_JOURNAL_CFLAGS])
     AC_SUBST([SD_JOURNAL_LIBS])
     AC_DEFINE([HAVE_SD_JOURNAL],[1],[systemd journal library found at compile time.])
-],
-    [AC_MSG_WARN([systemd journal library not found, some features will be disabled])])
+],[
+    PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd-journal >= 196],[
+        AC_SUBST([SD_JOURNAL_CFLAGS])
+        AC_SUBST([SD_JOURNAL_LIBS])
+        AC_DEFINE([HAVE_SD_JOURNAL],[1],[systemd journal library found at compile time.])
(Continue reading)


Gmane