[PATCH] daemon: add inspector support for MS-DOS distro
by Daniel P. Berrangé
An installation of MS-DOS has various files in a /DOS directory,
which COMMAND.COM looking like a reasonable signal that its MS-DOS
or a very close relative there-of.
This is validated with an MS-DOS 6.22 install.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
BTW, I'm unclear if we should make any attempt to try to detect and
report Windows 3.x as a separate distro, since it requires an MS-DOS
install underneath it.
daemon/inspect_fs.ml | 14 ++++++++++++++
daemon/inspect_types.ml | 2 ++
daemon/inspect_types.mli | 1 +
3 files changed, 17 insertions(+)
diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml
index 13ed127cd..a20de6761 100644
--- a/daemon/inspect_fs.ml
+++ b/daemon/inspect_fs.ml
@@ -220,6 +220,18 @@ and check_filesystem mountable =
*)
data.arch <- Some "i386"
)
+ (* MS-DOS *)
+ else if is_dir_nocase "/DOS" &&
+ is_file_nocase "/DOS/COMMAND.COM" then (
+ debug_matching "MS-DOS";
+ role := `Root;
+ data.os_type <- Some OS_TYPE_DOS;
+ data.distro <- Some DISTRO_MSDOS;
+ (* MS-DOS is a mix of 16 and 32 bit, but
+ * assume it requires a 32 bit i386 processor.
+ *)
+ data.arch <- Some "i386"
+ )
(* None of the above. *)
else (
debug_matching "no known OS partition"
@@ -282,6 +294,7 @@ and check_package_format { distro } =
| Some DISTRO_FREEBSD
| Some DISTRO_FREEDOS
| Some DISTRO_FRUGALWARE
+ | Some DISTRO_MSDOS
| Some DISTRO_NETBSD
| Some DISTRO_OPENBSD
| Some DISTRO_PLD_LINUX
@@ -365,6 +378,7 @@ and check_package_management { distro; version } =
| Some DISTRO_FREEBSD
| Some DISTRO_FREEDOS
| Some DISTRO_FRUGALWARE
+ | Some DISTRO_MSDOS
| Some DISTRO_NETBSD
| Some DISTRO_OPENBSD
| Some DISTRO_PLD_LINUX
diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml
index 473939a67..464b8c2a6 100644
--- a/daemon/inspect_types.ml
+++ b/daemon/inspect_types.ml
@@ -82,6 +82,7 @@ and distro =
| DISTRO_MAGEIA
| DISTRO_MANDRIVA
| DISTRO_MEEGO
+ | DISTRO_MSDOS
| DISTRO_NEOKYLIN
| DISTRO_NETBSD
| DISTRO_OPENBSD
@@ -211,6 +212,7 @@ and string_of_distro = function
| DISTRO_MAGEIA -> "mageia"
| DISTRO_MANDRIVA -> "mandriva"
| DISTRO_MEEGO -> "meego"
+ | DISTRO_MSDOS -> "msdos"
| DISTRO_NEOKYLIN -> "neokylin"
| DISTRO_NETBSD -> "netbsd"
| DISTRO_OPENBSD -> "openbsd"
diff --git a/daemon/inspect_types.mli b/daemon/inspect_types.mli
index 6d75e5825..78051b510 100644
--- a/daemon/inspect_types.mli
+++ b/daemon/inspect_types.mli
@@ -89,6 +89,7 @@ and distro =
| DISTRO_MAGEIA
| DISTRO_MANDRIVA
| DISTRO_MEEGO
+ | DISTRO_MSDOS
| DISTRO_NEOKYLIN
| DISTRO_NETBSD
| DISTRO_OPENBSD
--
2.14.3
6 years, 10 months
[PATCH] tmpdirs: Make the ‘su broken’ error message actionable.
by Richard W.M. Jones
Revert "tmpdirs: Blame systemd because su is broken."
This reverts commit 9464304d7a6b9b01e9eee32620ef3831e2b10875.
Replace with an actionable error message.
---
lib/tmpdirs.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/tmpdirs.c b/lib/tmpdirs.c
index bda3ee694..804c58be0 100644
--- a/lib/tmpdirs.c
+++ b/lib/tmpdirs.c
@@ -180,18 +180,22 @@ guestfs_impl_get_sockdir (guestfs_h *g)
}
static int
-lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest)
+lazy_make_tmpdir (guestfs_h *g,
+ char *(*getdir) (guestfs_h *g), int is_runtime_dir,
+ char **dest)
{
if (!*dest) {
CLEANUP_FREE char *tmpdir = getdir (g);
char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir);
if (mkdtemp (tmppath) == NULL) {
- int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/");
+ int bad_systemd = is_runtime_dir && errno == EACCES &&
+ STRPREFIX (tmpdir, "/run/user/");
if (!bad_systemd)
perrorf (g, _("%s: cannot create temporary directory"), tmppath);
else
- error (g, _("%s: cannot create temporary directory. You may be hitting systemd bug https://bugzilla.redhat.com/967509"), tmppath);
+ error (g, _("%s: cannot create temporary directory. It may be that $XDG_RUNTIME_DIR is pointing to a directory which we cannot write to, for example if you used ‘su [user]’ to change to this user account (see https://bugzilla.redhat.com/967509). You can correct this by adjusting XDG_RUNTIME_DIR and possibly creating /run/user/%d with the right ownership."),
+ tmppath, (int) geteuid ());
free (tmppath);
return -1;
}
@@ -219,13 +223,13 @@ lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest)
int
guestfs_int_lazy_make_tmpdir (guestfs_h *g)
{
- return lazy_make_tmpdir (g, guestfs_get_tmpdir, &g->tmpdir);
+ return lazy_make_tmpdir (g, guestfs_get_tmpdir, 0, &g->tmpdir);
}
int
guestfs_int_lazy_make_sockdir (guestfs_h *g)
{
- return lazy_make_tmpdir (g, guestfs_get_sockdir, &g->sockdir);
+ return lazy_make_tmpdir (g, guestfs_get_sockdir, 1, &g->sockdir);
}
/**
--
2.13.2
6 years, 10 months
[PATCH] fish: add a small doc note about -- for args (RHBZ#1536603)
by Pino Toscano
This will hint what to do when any argument of a command starts with a
dash.
---
fish/guestfish.pod | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index ad98e975e..bbf43aad5 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -458,6 +458,13 @@ command that gives an error causes the whole shell to exit. In
interactive mode (with a prompt) if a command fails, you can continue
to enter commands.
+Note that arguments of the commands will be considered as guestfish
+options if they start with a dash (C<->): you can always separate the
+guestfish options and the rest of the commands (with their arguments)
+using a double dash (C<-->). For example:
+
+ guestfish -- disk_create overlay.qcow2 qcow2 -1 backingfile:image.img
+
=head1 USING launch (OR run)
As with L<guestfs(3)>, you must first configure your guest by adding
--
2.14.3
6 years, 10 months
[PATCH] v2v: fix -it ssh syntax in example (RHBZ#1540535)
by Pino Toscano
Updates commit 1d38216d20141cef9ce83ca4ddbe9c79f5da4f39.
---
v2v/virt-v2v.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index d39609cf8..b2face339 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -126,7 +126,7 @@ a local file.
virt-v2v \
-i vmx -it ssh \
- "root(a)esxi.example.com/vmfs/volumes/datastore1/guest/guest.vmx" \
+ "ssh://root@esxi.example.com/vmfs/volumes/datastore1/guest/guest.vmx" \
-o local -os /var/tmp
The guest must not be running. Virt-v2v would I<not> need to be run
--
2.14.3
6 years, 10 months
[PATCH] customize: avoid Array.mem for now
by Pino Toscano
Since it is available only in OCaml >= 4.03, which is higher than our
requirement, add a simple reimplementation of it.
Fixes commit 719d68fa247cc3885ecf7ec1c010faf83267d786.
---
customize/SELinux_relabel.ml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/customize/SELinux_relabel.ml b/customize/SELinux_relabel.ml
index e7d440c29..7cc166edb 100644
--- a/customize/SELinux_relabel.ml
+++ b/customize/SELinux_relabel.ml
@@ -24,6 +24,10 @@ open Printf
module G = Guestfs
+(* Simple reimplementation of Array.mem, available only with OCaml >= 40.3. *)
+let array_find a l =
+ List.mem a (Array.to_list l)
+
let relabel (g : G.guestfs) =
(* Is the guest using SELinux? *)
if g#is_file ~followsymlinks:true "/usr/sbin/load_policy" &&
@@ -44,7 +48,7 @@ let relabel (g : G.guestfs) =
let config_path = "/files/etc/selinux/config" in
let selinuxtype_path = config_path ^ "/SELINUXTYPE" in
let keys = g#aug_ls config_path in
- if Array.mem selinuxtype_path keys then
+ if array_find selinuxtype_path keys then
g#aug_get selinuxtype_path
else
"targeted" in
--
2.14.3
6 years, 10 months
[PATCH v2] daemon: build also without Hivex.OPEN_UNSAFE (RHBZ#1493048)
by Pino Toscano
Do a configure check for the OPEN_UNSAFE flag in the OCaml binding of
Hivex, using it only when available. This makes it possible to use
hivex < 1.3.14 to build libguestfs (the daemon, actually).
Amend the building documentation accordingly, bringing the minimum
version of hivex back as it was before
commit 64f49df747c0937d9433eb11d4191d92a4af748c.
---
.gitignore | 1 +
configure.ac | 1 +
daemon/Makefile.am | 2 ++
daemon/daemon_config.ml.in | 20 ++++++++++++++++++++
daemon/daemon_config.mli | 19 +++++++++++++++++++
daemon/inspect_utils.ml | 6 +++++-
docs/guestfs-building.pod | 2 +-
m4/guestfs-ocaml.m4 | 19 +++++++++++++++++++
8 files changed, 68 insertions(+), 2 deletions(-)
create mode 100644 daemon/daemon_config.ml.in
create mode 100644 daemon/daemon_config.mli
diff --git a/.gitignore b/.gitignore
index 8276afb26..233a8c536 100644
--- a/.gitignore
+++ b/.gitignore
@@ -186,6 +186,7 @@ Makefile.in
/daemon/actions.h
/daemon/callbacks.ml
/daemon/caml-stubs.c
+/daemon/daemon_config.ml
/daemon/daemon_utils_tests
/daemon/dispatch.c
/daemon/guestfsd
diff --git a/configure.ac b/configure.ac
index e293ece65..e3df97fce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,6 +247,7 @@ AC_CONFIG_FILES([Makefile
common/windows/Makefile
csharp/Makefile
customize/Makefile
+ daemon/daemon_config.ml
daemon/Makefile
df/Makefile
dib/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 994bcd61a..c534baab0 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -251,6 +251,7 @@ SOURCES_MLI = \
callbacks.mli \
chroot.mli \
daemon.mli \
+ daemon_config.mli \
devsparts.mli \
file.mli \
filearch.mli \
@@ -279,6 +280,7 @@ SOURCES_MLI = \
utils.mli
SOURCES_ML = \
+ daemon_config.ml \
utils.ml \
structs.ml \
optgroups.ml \
diff --git a/daemon/daemon_config.ml.in b/daemon/daemon_config.ml.in
new file mode 100644
index 000000000..bb810a171
--- /dev/null
+++ b/daemon/daemon_config.ml.in
@@ -0,0 +1,20 @@
+(* guestfsd
+ * @configure_input@
+ * Copyright (C) 2018 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+let hivex_flag_unsafe = @HIVEX_OPEN_UNSAFE_FLAG@
diff --git a/daemon/daemon_config.mli b/daemon/daemon_config.mli
new file mode 100644
index 000000000..53024225f
--- /dev/null
+++ b/daemon/daemon_config.mli
@@ -0,0 +1,19 @@
+(* guestfsd
+ * Copyright (C) 2018 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+val hivex_flag_unsafe : Hivex.open_flag option
diff --git a/daemon/inspect_utils.ml b/daemon/inspect_utils.ml
index 5127bf30f..b94c98cd1 100644
--- a/daemon/inspect_utils.ml
+++ b/daemon/inspect_utils.ml
@@ -176,7 +176,11 @@ let parse_version_from_major_minor str data =
)
let with_hive hive_filename f =
- let flags = [ Hivex.OPEN_UNSAFE ] in
+ let flags = [] in
+ let flags =
+ match Daemon_config.hivex_flag_unsafe with
+ | None -> flags
+ | Some f -> f :: flags in
let flags = if verbose () then Hivex.OPEN_VERBOSE :: flags else flags in
let h = Hivex.open_file hive_filename flags in
protect ~f:(fun () -> f h (Hivex.root h)) ~finally:(fun () -> Hivex.close h)
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index e77e47454..e846a9a1d 100644
--- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod
@@ -178,7 +178,7 @@ I<Required>.
I<Required> if compiling from git.
Optional if compiling from tarball.
-=item hivex E<ge> 1.3.14
+=item hivex E<ge> 1.2.7
=item ocaml-hivex
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index e72b5ad39..94c24bc04 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -79,6 +79,7 @@ else
fi
AC_SUBST([OCAMLDEP_ONE_LINE])
+have_Hivex_OPEN_UNSAFE=no
if test "x$enable_daemon" = "xyes"; then
OCAML_PKG_hivex=no
AC_CHECK_OCAML_PKG(hivex)
@@ -86,6 +87,18 @@ if test "x$enable_daemon" = "xyes"; then
AC_MSG_ERROR([the OCaml module 'hivex' is required])
fi
+ # Check if Hivex has 'OPEN_UNSAFE' flag.
+ AC_MSG_CHECKING([for Hivex.OPEN_UNSAFE])
+ rm -f conftest.ml
+ echo 'let s = Hivex.OPEN_UNSAFE' > conftest.ml
+ if $OCAMLFIND ocamlc -package hivex -c conftest.ml >&5 2>&5 ; then
+ AC_MSG_RESULT([yes])
+ have_Hivex_OPEN_UNSAFE=yes
+ else
+ AC_MSG_RESULT([no])
+ have_Hivex_OPEN_UNSAFE=no
+ fi
+
dnl Check which OCaml runtime to link the daemon again.
dnl We can't use AC_CHECK_LIB here unfortunately because
dnl the other symbols are resolved by OCaml itself.
@@ -182,6 +195,12 @@ AC_SUBST([OCAML_BYTES_COMPAT_CMO])
AC_SUBST([OCAML_BYTES_COMPAT_ML])
AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML],
[test "x$OCAML_BYTES_COMPAT_ML" != "x"])
+AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
+ HIVEX_OPEN_UNSAFE_FLAG="None"
+],[
+ HIVEX_OPEN_UNSAFE_FLAG="Some Hivex.OPEN_UNSAFE"
+])
+AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG])
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
--
2.14.3
6 years, 10 months
[nbdkit PATCH v2 0/3] add log, blocksize filters
by Eric Blake
Since v1: add the blocksize filter, add testsuite coverage of the
log filter, several fixes to the log filter based on what adding
tests revealed
I'm still working on FUA flag support patches on top of this;
the patches should all be committed in the same release, as we
want to minimize the number of releases that cause a filter
ABI/API bump
Eric Blake (3):
backend: Rework internal/filter error return semantics
filters: Add log filter
filters: Add blocksize filter
TODO | 7 -
docs/nbdkit-filter.pod | 85 +++++-
docs/nbdkit.pod | 2 +
filters/blocksize/nbdkit-blocksize-filter.pod | 141 ++++++++++
filters/log/nbdkit-log-filter.pod | 115 ++++++++
configure.ac | 4 +-
src/internal.h | 1 -
src/connections.c | 45 +--
src/filters.c | 81 ++++--
src/plugins.c | 66 +++--
filters/blocksize/blocksize.c | 379 ++++++++++++++++++++++++++
filters/cache/cache.c | 49 ++--
filters/cow/cow.c | 28 +-
filters/log/log.c | 362 ++++++++++++++++++++++++
filters/partition/partition.c | 2 +-
filters/Makefile.am | 2 +
filters/blocksize/Makefile.am | 62 +++++
filters/log/Makefile.am | 62 +++++
tests/Makefile.am | 8 +
tests/test-blocksize.sh | 152 +++++++++++
tests/test-log.sh | 88 ++++++
21 files changed, 1599 insertions(+), 142 deletions(-)
create mode 100644 filters/blocksize/nbdkit-blocksize-filter.pod
create mode 100644 filters/log/nbdkit-log-filter.pod
create mode 100644 filters/blocksize/blocksize.c
create mode 100644 filters/log/log.c
create mode 100644 filters/blocksize/Makefile.am
create mode 100644 filters/log/Makefile.am
create mode 100755 tests/test-blocksize.sh
create mode 100755 tests/test-log.sh
--
2.14.3
6 years, 10 months
[PATCH] daemon: build also without Hivex.OPEN_UNSAFE (RHBZ#1493048)
by Pino Toscano
Do a configure check for the OPEN_UNSAFE flag in the OCaml binding of
Hivex, using it only when available. This makes it possible to use
hivex < 1.3.14 to build libguestfs (the daemon, actually).
Amend the building documentation accordingly.
---
.gitignore | 1 +
configure.ac | 1 +
daemon/Makefile.am | 2 ++
daemon/config_daemon.ml.in | 20 ++++++++++++++++++++
daemon/config_daemon.mli | 19 +++++++++++++++++++
daemon/inspect_utils.ml | 2 +-
docs/guestfs-building.pod | 2 +-
m4/guestfs-ocaml.m4 | 19 +++++++++++++++++++
8 files changed, 64 insertions(+), 2 deletions(-)
create mode 100644 daemon/config_daemon.ml.in
create mode 100644 daemon/config_daemon.mli
diff --git a/.gitignore b/.gitignore
index 8276afb26..59d7278be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -186,6 +186,7 @@ Makefile.in
/daemon/actions.h
/daemon/callbacks.ml
/daemon/caml-stubs.c
+/daemon/config_daemon.ml
/daemon/daemon_utils_tests
/daemon/dispatch.c
/daemon/guestfsd
diff --git a/configure.ac b/configure.ac
index daf9abf6f..fbba5ab65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,6 +247,7 @@ AC_CONFIG_FILES([Makefile
common/windows/Makefile
csharp/Makefile
customize/Makefile
+ daemon/config_daemon.ml
daemon/Makefile
df/Makefile
dib/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 994bcd61a..4ac4e38d8 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -250,6 +250,7 @@ SOURCES_MLI = \
btrfs.mli \
callbacks.mli \
chroot.mli \
+ config_daemon.mli \
daemon.mli \
devsparts.mli \
file.mli \
@@ -279,6 +280,7 @@ SOURCES_MLI = \
utils.mli
SOURCES_ML = \
+ config_daemon.ml \
utils.ml \
structs.ml \
optgroups.ml \
diff --git a/daemon/config_daemon.ml.in b/daemon/config_daemon.ml.in
new file mode 100644
index 000000000..e3ee1fd3f
--- /dev/null
+++ b/daemon/config_daemon.ml.in
@@ -0,0 +1,20 @@
+(* guestfsd
+ * @configure_input@
+ * Copyright (C) 2018 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+let hivex_flag_unsafe = [@HIVEX_OPEN_UNSAFE_FLAG@]
diff --git a/daemon/config_daemon.mli b/daemon/config_daemon.mli
new file mode 100644
index 000000000..1d358b7fd
--- /dev/null
+++ b/daemon/config_daemon.mli
@@ -0,0 +1,19 @@
+(* guestfsd
+ * Copyright (C) 2018 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+val hivex_flag_unsafe : Hivex.open_flag list
diff --git a/daemon/inspect_utils.ml b/daemon/inspect_utils.ml
index 5127bf30f..b2ce072d6 100644
--- a/daemon/inspect_utils.ml
+++ b/daemon/inspect_utils.ml
@@ -176,7 +176,7 @@ let parse_version_from_major_minor str data =
)
let with_hive hive_filename f =
- let flags = [ Hivex.OPEN_UNSAFE ] in
+ let flags = Config_daemon.hivex_flag_unsafe in
let flags = if verbose () then Hivex.OPEN_VERBOSE :: flags else flags in
let h = Hivex.open_file hive_filename flags in
protect ~f:(fun () -> f h (Hivex.root h)) ~finally:(fun () -> Hivex.close h)
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index e77e47454..de5d77050 100644
--- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod
@@ -178,7 +178,7 @@ I<Required>.
I<Required> if compiling from git.
Optional if compiling from tarball.
-=item hivex E<ge> 1.3.14
+=item hivex
=item ocaml-hivex
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index e72b5ad39..5ceeaf976 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -79,6 +79,7 @@ else
fi
AC_SUBST([OCAMLDEP_ONE_LINE])
+have_Hivex_OPEN_UNSAFE=no
if test "x$enable_daemon" = "xyes"; then
OCAML_PKG_hivex=no
AC_CHECK_OCAML_PKG(hivex)
@@ -86,6 +87,18 @@ if test "x$enable_daemon" = "xyes"; then
AC_MSG_ERROR([the OCaml module 'hivex' is required])
fi
+ # Check if Hivex has 'OPEN_UNSAFE' flag.
+ AC_MSG_CHECKING([for Hivex.OPEN_UNSAFE])
+ rm -f conftest.ml
+ echo 'let s = Hivex.OPEN_UNSAFE' > conftest.ml
+ if $OCAMLFIND ocamlc -package hivex -c conftest.ml >&5 2>&5 ; then
+ AC_MSG_RESULT([yes])
+ have_Hivex_OPEN_UNSAFE=yes
+ else
+ AC_MSG_RESULT([no])
+ have_Hivex_OPEN_UNSAFE=no
+ fi
+
dnl Check which OCaml runtime to link the daemon again.
dnl We can't use AC_CHECK_LIB here unfortunately because
dnl the other symbols are resolved by OCaml itself.
@@ -182,6 +195,12 @@ AC_SUBST([OCAML_BYTES_COMPAT_CMO])
AC_SUBST([OCAML_BYTES_COMPAT_ML])
AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML],
[test "x$OCAML_BYTES_COMPAT_ML" != "x"])
+AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
+ HIVEX_OPEN_UNSAFE_FLAG=""
+],[
+ HIVEX_OPEN_UNSAFE_FLAG=" Hivex.OPEN_UNSAFE "
+])
+AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG])
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
--
2.14.3
6 years, 10 months
Problems with Fedora 27 image used by virt-builder
by Laine Stump
During this last week I fired up some tests using libvirt-tck that
haven't been run in awhile and ran into a couple problems with the
Fedora 27 image provided by virt-builder (which is used by the
libvirt-tck tests). One of them probably has a simple solution, I'm not
sure about the other.
1) there is an selinux labeling error with the versions of packages in
the Fedora 27 image. There are several (mostly related to iptables and
ebtables), but one in particular prevents dhcp from getting an IP address:
audit[509]: AVC avc: denied { read } for pid=509
comm="dhclient" name="ld.so.cache" dev="vda4" ino=4513574
scontext=system_u:system_r:dhcpc_t:s0
tcontext=system_u:object_r:unlabeled_t:s0
tclass=file permissive=0
I'm guessing that redoing the OS install of the image with updates
enabled will fix this (and most/all of the other AVCs)
2) The virt-builder images are created using
virt-install ..... --nographic
which means that no video device is present during the OS install.
Because of this, the ethernet device is placed at slot 2, so it is named
"ens2" by the kernel, and anaconda creates config for "ens2". But if the
image is later booted with a different config that has a graphics
device, the graphics device will be put at slot 2 and the ethernet will
be put on slot 3, so it will be named ens3.
This ends up providing the expected behavior, since the image has
NetworkManager enabled, and by default NetworkManager will enable all
interfaces it finds with an "in-memory" config for dhcp. But it does
mean that if someone decides to change the config to have a static IP,
they'll be surprised when just modifying the existing ifcfg file doesn't
have any effect. Also, if someone disables NetworkManager.service in the
image and enables network.service instead, the config will be incorrect.
(On the other hand, if they're doing something like this, they're
already messing around with files in the image, so I suppose they could
be expected to correct the inconsistency themselves.
It may be too late to change this, but in hindsight it may have been
good to add "net.ifnames=0 biosdevname=0" to the kickstart file and grub
config so that the network device is always named eth0 regardless of PCI
addressing. (I remember this previously being the case for virtio
devices in Fedora; no idea when it changed).
6 years, 10 months