[PATCH] v2v: Fix kernel disambiguation by dropping Epoch field (RHBZ#1669395).
by Richard W.M. Jones
When detecting kernels we have to list the files in the package to
find the right /boot/vmlinuz file.
In virt-v2v 1.28 we ran:
rpm -ql kernel
Because multiple kernels can be installed this gave incorrect results,
which was reported in RHBZ#1161250 and initially fixed in
commit 377bc302f11db3da4263f894c76a7d280fb25dbd. This changed the
command to:
rpm -ql [epoch:]kernel-version.release
where the epoch: prefix was only used if the epoch was != 0.
However this in fact failed if epoch was != 0 (which isn't the case
for ordinary RHEL kernels in RHEL >= 5). Since it broke RHEL <= 4
this was reported as bug RHBZ#1170685 and fixed only for RHEL 3/4 in
commit 205a8c7ca1ed1d66bef56d75c3c244e726e3bbbf.
That fix removed the optional epoch: prefix for RHEL 3/4. But the
prefix is wrong on all versions of RPM, even the latest one. eg. on
Fedora 29:
$ rpm -ql 2:qemu-3.1.0-4.fc30.x86_64
package 2:qemu-3.1.0-4.fc30.x86_64 is not installed
(In fact latest RPM does let you use name-epoch:version.release, but
that was not true in RHEL 6 or 7).
The solution here is to remove the epoch entirely. It's rather
unlikely that two kernels will be installed with identical NVR and
different Epoch. Just using NVR is sufficient to fix the original bug
RHBZ#1161250.
Thanks: Germano Veit Michel for bug reporting and analysis.
---
v2v/linux.ml | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/v2v/linux.ml b/v2v/linux.ml
index 43449157b..663db8697 100644
--- a/v2v/linux.ml
+++ b/v2v/linux.ml
@@ -80,29 +80,11 @@ let file_list_of_package (g : Guestfs.guestfs) inspect app =
| "rpm" ->
(* Since RPM allows multiple packages installed with the same
- * name, always check the full ENVR here (RHBZ#1161250).
+ * name, always check the full NVR here (RHBZ#1161250).
*)
let pkg_name =
sprintf "%s-%s-%s" app.G.app2_name
app.G.app2_version app.G.app2_release in
- let pkg_name =
- if app.G.app2_epoch > 0_l then (
- (* RHEL 3/4 'rpm' does not support using the epoch prefix.
- * (RHBZ#1170685).
- *)
- let is_rhel_lt_5 =
- match inspect with
- | { i_type = "linux";
- i_distro = "rhel" | "centos" | "scientificlinux" |
- "oraclelinux" | "redhat-based";
- i_major_version = v } when v < 5 -> true
- | _ -> false in
- if is_rhel_lt_5 then
- pkg_name
- else
- sprintf "%ld:%s" app.G.app2_epoch pkg_name
- ) else
- pkg_name in
let cmd = [| "rpm"; "-ql"; pkg_name |] in
debug "%s" (String.concat " " (Array.to_list cmd));
let files = g#command_lines cmd in
--
2.20.1
5 years, 11 months
[supermin PATCH 1/2] rpm: extend the Multiple_matches exception
by Pino Toscano
Add the package that raised the issue, so it can be used to provide
better diagnostic.
---
src/librpm-c.c | 15 ++++++++++-----
src/librpm.ml | 4 ++--
src/librpm.mli | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/librpm-c.c b/src/librpm-c.c
index 3bd25a2..75ca4d7 100644
--- a/src/librpm-c.c
+++ b/src/librpm-c.c
@@ -66,10 +66,15 @@ librpm_handle_closed (void)
}
static void
-librpm_raise_multiple_matches (int occurrences)
+librpm_raise_multiple_matches (value pkgv, int occurrences)
{
- caml_raise_with_arg (*caml_named_value ("librpm_multiple_matches"),
- Val_int (occurrences));
+ CAMLparam1 (pkgv);
+
+ value args[] = { pkgv, Val_int (occurrences) };
+ caml_raise_with_args (*caml_named_value ("librpm_multiple_matches"),
+ 2, args);
+
+ CAMLnoreturn;
}
#define Librpm_val(v) (*((struct librpm_data *)Data_custom_val(v)))
@@ -296,7 +301,7 @@ supermin_rpm_pkg_requires (value rpmv, value pkgv)
fflush (stdout);
}
if (count != 1)
- librpm_raise_multiple_matches (count);
+ librpm_raise_multiple_matches (pkgv, count);
h = rpmdbNextIterator (iter);
assert (h != NULL);
@@ -413,7 +418,7 @@ supermin_rpm_pkg_filelist (value rpmv, value pkgv)
fflush (stdout);
}
if (count != 1)
- librpm_raise_multiple_matches (count);
+ librpm_raise_multiple_matches (pkgv, count);
h = rpmdbNextIterator (iter);
assert (h != NULL);
diff --git a/src/librpm.ml b/src/librpm.ml
index 4eeba77..b6f9ff8 100644
--- a/src/librpm.ml
+++ b/src/librpm.ml
@@ -23,7 +23,7 @@ external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" "noalloc"
type t
-exception Multiple_matches of int
+exception Multiple_matches of string * int
external rpm_open : ?debug:int -> t = "supermin_rpm_open"
external rpm_close : t -> unit = "supermin_rpm_close"
@@ -49,4 +49,4 @@ external rpm_pkg_whatprovides : t -> string -> string array = "supermin_rpm_pkg_
external rpm_pkg_filelist : t -> string -> rpmfile_t array = "supermin_rpm_pkg_filelist"
let () =
- Callback.register_exception "librpm_multiple_matches" (Multiple_matches 0)
+ Callback.register_exception "librpm_multiple_matches" (Multiple_matches ("", 0))
diff --git a/src/librpm.mli b/src/librpm.mli
index 5229be6..53b4b2c 100644
--- a/src/librpm.mli
+++ b/src/librpm.mli
@@ -31,7 +31,7 @@ val rpm_vercmp : string -> string -> int
type t
(** The librpm handle. *)
-exception Multiple_matches of int
+exception Multiple_matches of string * int
val rpm_open : ?debug:int -> t
(** Open the librpm (transaction set) handle. *)
--
2.20.1
5 years, 11 months
[PATCH v2 nbdkit] tests: Add generic requires.
by Richard W.M. Jones
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-January/thread.html#00198
For v2 I changed most existing prerequisite tests to use the new
mechanism.
I only changed simple tests. There are a few more complex tests that
don't fit the “requires model” and those are not changed.
I normalized qemu-io/qemu-img testing to always use the --version
flag, where previously we used a mix of --version and --help.
The requires tests are generally done above the cleanup function, to
avoid doing cleanup if we're not going to run the test.
Error messages are sometimes changed, but nothing important.
Tested it on Linux, FreeBSD and OpenBSD.
Rich.
5 years, 11 months
Re: [Libguestfs] [PATCH] gobject: Add Vala binding support
by Corentin Noël
Here is the patch with the EXTRA_DIST moved. Note that the .deps file
is useless without the .vapi file (that's why it was inside the if
ENABLE_VAPIGEN )
Regards,
Corentin
---
.gitignore | 1 +
configure.ac | 4 ++
gobject/Makefile.am | 17 +++++
gobject/libguestfs-gobject-1.0.deps | 2 +
m4/vapigen.m4 | 101 ++++++++++++++++++++++++++++
5 files changed, 125 insertions(+)
create mode 100644 gobject/libguestfs-gobject-1.0.deps
create mode 100644 m4/vapigen.m4
diff --git a/.gitignore b/.gitignore
index 637bf7765..29d3e3aae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -339,6 +339,7 @@ Makefile.in
/gobject/Guestfs-1.0.gir
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject.3
+/gobject/libguestfs-gobject-1.0.vapi
/gobject/stamp-guestfs-gobject.pod
/golang/bindtests.go
/golang/examples/guestfs-golang.3
diff --git a/configure.ac b/configure.ac
index e18e099b9..dfc7a1af3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,8 @@ HEADING([Checking for Go])
m4_include([m4/guestfs-golang.m4])
HEADING([Checking for GObject Introspection])
m4_include([m4/guestfs-gobject.m4])
+HEADING([Checking for Vala])
+VAPIGEN_CHECK
dnl virt-v2v, virt-p2v.
HEADING([Checking the virt-v2v and virt-p2v dependencies])
@@ -421,6 +423,8 @@ AS_ECHO_N(["gobject bindings ....................
"])
if test "x$HAVE_GOBJECT_TRUE" = "x"; then echo "yes"; else echo "no";
fi
AS_ECHO_N(["gobject introspection ............... "])
if test "x$HAVE_INTROSPECTION_TRUE" = "x"; then echo "yes"; else echo
"no"; fi
+AS_ECHO_N(["Vala bindings ....................... "])
+if test "x$ENABLE_VAPIGEN" = "x"; then echo "yes"; else echo "no"; fi
AS_ECHO_N(["bash completion ..................... "])
if test "x$HAVE_BASH_COMPLETION_TRUE" = "x"; then echo "yes"; else
echo "no"; fi
echo
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index ddedd5b51..c32cc8ec6 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -105,6 +105,23 @@ $(TESTS): $(typelib_DATA)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
+if ENABLE_VAPIGEN
+-include $(VAPIGEN_MAKEFILE)
+
+libguestfs-gobject-1.0.vapi: Guestfs-1.0.gir libguestfs-gobject-
1.0.deps
+
+VAPIGEN_VAPIS = libguestfs-gobject-1.0.vapi
+
+libguestfs_gobject_1_0_vapi_DEPS = gobject-2.0 gio-2.0
+libguestfs_gobject_1_0_vapi_METADATADIRS = $(srcdir)
+libguestfs_gobject_1_0_vapi_FILES = Guestfs-1.0.gir
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
+endif
+
+EXTRA_DIST += libguestfs-gobject-1.0.deps
+
endif HAVE_INTROSPECTION
# Documentation.
diff --git a/gobject/libguestfs-gobject-1.0.deps b/gobject/libguestfs-
gobject-1.0.deps
new file mode 100644
index 000000000..d4db05933
--- /dev/null
+++ b/gobject/libguestfs-gobject-1.0.deps
@@ -0,0 +1,2 @@
+gobject-2.0
+gio-2.0
diff --git a/m4/vapigen.m4 b/m4/vapigen.m4
new file mode 100644
index 000000000..2c435e74b
--- /dev/null
+++ b/m4/vapigen.m4
@@ -0,0 +1,101 @@
+dnl vapigen.m4
+dnl
+dnl Copyright 2012 Evan Nemerson
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free
Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+
+# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND_INTROSPECTION],
[DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed
documentation
+AC_DEFUN([VAPIGEN_CHECK],
+[
+ AS_IF([test "x$3" != "xyes"], [
+ m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [
+ m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [
+ AC_MSG_ERROR([[You must call GOBJECT_INTROSPECTION_CHECK
or GOBJECT_INTROSPECTION_REQUIRE before using VAPIGEN_CHECK unless
using the FOUND_INTROSPECTION argument is "yes"]])
+ ])
+ ])
+ ])
+
+ AC_ARG_ENABLE([vala],
+ [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala
bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[
+ AS_IF([test "x$4" = "x"], [
+ enable_vala=auto
+ ], [
+ enable_vala=$4
+ ])
+ ])
+
+ AS_CASE([$enable_vala], [no], [enable_vala=no],
+ [yes], [
+ AS_IF([test "x$3" != "xyes" -a "x$found_introspection" !=
"xyes"], [
+ AC_MSG_ERROR([Vala bindings require GObject
Introspection])
+ ])
+ ], [auto], [
+ AS_IF([test "x$3" != "xyes" -a "x$found_introspection" !=
"xyes"], [
+ enable_vala=no
+ ])
+ ], [
+ AC_MSG_ERROR([Invalid argument passed to --enable-vala, should
be one of @<:@no/auto/yes@:>@])
+ ])
+
+ AS_IF([test "x$2" = "x"], [
+ vapigen_pkg_name=vapigen
+ ], [
+ vapigen_pkg_name=vapigen-$2
+ ])
+ AS_IF([test "x$1" = "x"], [
+ vapigen_pkg="$vapigen_pkg_name"
+ ], [
+ vapigen_pkg="$vapigen_pkg_name >= $1"
+ ])
+
+ PKG_PROG_PKG_CONFIG
+
+ PKG_CHECK_EXISTS([$vapigen_pkg], [
+ AS_IF([test "$enable_vala" = "auto"], [
+ enable_vala=yes
+ ])
+ ], [
+ AS_CASE([$enable_vala], [yes], [
+ AC_MSG_ERROR([$vapigen_pkg not found])
+ ], [auto], [
+ enable_vala=no
+ ])
+ ])
+
+ AC_MSG_CHECKING([for vapigen])
+
+ AS_CASE([$enable_vala],
+ [yes], [
+ VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
+ VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir
$vapigen_pkg_name`/vala/Makefile.vapigen
+ AS_IF([test "x$2" = "x"], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir
$vapigen_pkg_name`
+ ], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned
$vapigen_pkg_name`
+ ])
+ ])
+
+ AC_MSG_RESULT([$enable_vala])
+
+ AC_SUBST([VAPIGEN])
+ AC_SUBST([VAPIGEN_VAPIDIR])
+ AC_SUBST([VAPIGEN_MAKEFILE])
+
+ AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
+])
5 years, 11 months
[PATCH] lib: Reset errno to zero to avoid erroneously returning E2BIG
by Michael Meyer
This line was accidentally removed in 77fe74fc, causing
bug #1145056 (Bugzilla) to resurface.
---
lib/utf16.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/utf16.c b/lib/utf16.c
index e099548..67fa996 100644
--- a/lib/utf16.c
+++ b/lib/utf16.c
@@ -58,6 +58,7 @@ _hivex_recode (hive_h *h, recode_type t,
/* Reset errno here because we don't want to accidentally
* return E2BIG to a library caller.
*/
+ errno = 0;
size_t prev = outalloc;
/* Try again with a larger output buffer. */
free (out);
--
2.7.4
5 years, 11 months
[nbdkit PATCH 0/3] Fix %m usage on BSD
by Eric Blake
Our use of "%m" in various error messages is testament to the
project's initial life on Linux - but other than Cygwin, I know
of no other platforms supporting that glibc extension.
We COULD audit the code and manually turn "%m" into
"%s"/strerror(errno), but that's a lot of churn. Instead, let's
fix the few outliers that can't be easily wrapped, then wrap
the remainder.
While I was able to test this on Linux (both that no wrapper is
used by default, and that faking that %m fails causes the wrapper
to do the right thing), I haven't actually tried it on a BSD box,
hence I'll wait for review before pushing.
Eric Blake (3):
main: Avoid fprintf(%m) for BSD builds
log: Ensure %m sees correct errno
log: Guarantee the operation of %m in nbdkit_error()
docs/nbdkit-filter.pod | 13 +++++++++----
docs/nbdkit-plugin.pod | 13 +++++++++----
configure.ac | 27 +++++++++++++++++++++++++++
src/internal.h | 6 ++++++
src/log-stderr.c | 4 ++--
src/log-syslog.c | 6 +++---
src/log.c | 21 +++++++++++++++++++++
src/main.c | 4 ++--
8 files changed, 79 insertions(+), 15 deletions(-)
--
2.17.2
5 years, 11 months