[PATCH] inspector: add ReactOS systemroot
by Maros Zatko
After adding /reactos as windows systemroot, virt-inspector identified OS as
windows with product name ReactOS. Fixes RHBZ#709326.
Related bug RHBZ#709327 seems to be already fixed in ReactOS 0.4.
Maros Zatko (1):
inspector: add /reactos as systemroot
src/inspect-fs-windows.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.9.3
9 years, 9 months
[PATCH] python: Call PyErr_Clear() on non-error paths out of the Python bindings.
by Richard W.M. Jones
We also need to be more careful about PyString_FromString and similar
functions returning NULL on failure. Currently we don't check this
every time. This commit adds more checks, but is still not complete.
---
TODO | 6 ------
generator/python.ml | 19 +++++++++++++++----
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/TODO b/TODO
index 075bdc6..666400e 100644
--- a/TODO
+++ b/TODO
@@ -563,12 +563,6 @@ Write an extension for mc that would let people browse into
filesystems. See
http://repo.or.cz/w/midnight-commander.git/tree/HEAD:/misc/ext.d
-Python
-------
-
-It seems as if we should call PyErr_Clear() somewhere in every
-Python binding.
-
Improvements in virt-log
------------------------
diff --git a/generator/python.ml b/generator/python.ml
index 4b823e6..637f22d 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -455,7 +455,8 @@ put_table (char * const * const argv)
pr " py_r = PyString_FromString (r);\n";
pr "#else\n";
pr " py_r = PyUnicode_FromString (r);\n";
- pr "#endif\n"
+ pr "#endif\n";
+ pr " if (py_r == NULL) goto out;\n";
| RConstOptString _ ->
pr " if (r) {\n";
pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
@@ -466,14 +467,16 @@ put_table (char * const * const argv)
pr " } else {\n";
pr " Py_INCREF (Py_None);\n";
pr " py_r = Py_None;\n";
- pr " }\n"
+ pr " }\n";
+ pr " if (py_r == NULL) goto out;\n";
| RString _ ->
pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
pr " py_r = PyString_FromString (r);\n";
pr "#else\n";
pr " py_r = PyUnicode_FromString (r);\n";
pr "#endif\n";
- pr " free (r);\n"
+ pr " free (r);\n";
+ pr " if (py_r == NULL) goto out;\n";
| RStringList _ ->
pr " py_r = put_string_list (r);\n";
pr " guestfs_int_free_string_list (r);\n"
@@ -492,10 +495,18 @@ put_table (char * const * const argv)
pr "#else\n";
pr " py_r = PyBytes_FromStringAndSize (r, size);\n";
pr "#endif\n";
- pr " free (r);\n"
+ pr " free (r);\n";
+ pr " if (py_r == NULL) goto out;\n";
);
+ (* As this is the non-error path, clear the Python error
+ * indicator flag in case it was set accidentally somewhere in
+ * the function. Since we are not returning an error indication
+ * to the caller, having it set would risk the error popping up
+ * at random later in the interpreter.
+ *)
pr "\n";
+ pr " PyErr_Clear ();\n";
pr " out:\n";
List.iter (
--
2.1.0
9 years, 9 months
[PATCH 1/3] gobject: generate deprecation markers
by Pino Toscano
Generate proper deprecation markers for API documentation and
introspection annotations.
---
generator/gobject.ml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 5b07edd..e563610 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -961,7 +961,8 @@ guestfs_session_close (GuestfsSession *session, GError **err)
fun ({ name = name; style = (ret, args, optargs as style);
cancellable = cancellable; c_function = c_function;
c_optarg_prefix = c_optarg_prefix;
- shortdesc = shortdesc; longdesc = longdesc } as f) ->
+ shortdesc = shortdesc; longdesc = longdesc;
+ deprecated_by = deprecated_by } as f) ->
pr "\n";
let longdesc = Str.global_substitute urls (
@@ -1103,6 +1104,11 @@ guestfs_session_close (GuestfsSession *session, GError **err)
pr "(transfer full) (array zero-terminated=1) (element-type Guestfs%s): an array of %s objects, or NULL on error" name name
);
pr "\n";
+ (match deprecated_by with
+ | None -> ()
+ | Some alt ->
+ pr " * Deprecated: In new code, use guestfs_session_%s() instead\n" alt
+ );
pr " */\n";
(* The function body *)
--
1.9.3
9 years, 9 months
[PATCH] fuse: Alternatives for Linux-specific commands
by Margaret Lewicka
* fusermount is Linux-only; on BSD and OS X umount should be used
* fuser has no -v flag on BSD/OSX, and -c is the
POSIX-compatible equivalent of -m
* Does not solve the lack of pretty output of fuser -v, but does make it
work on Mac OS X.
---
fuse/guestunmount.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c
index 3df481b..94c3ec7 100644
--- a/fuse/guestunmount.c
+++ b/fuse/guestunmount.c
@@ -257,7 +257,12 @@ do_fusermount (const char *mountpoint, char **error_rtn)
/* We have to parse error messages from fusermount, so ... */
setenv ("LC_ALL", "C", 1);
+#ifdef __linux__
execlp ("fusermount", "fusermount", "-u", mountpoint, NULL);
+#else
+ /* use umount where fusermount is not available */
+ execlp ("umount", "umount", mountpoint, NULL);
+#endif
perror ("exec");
_exit (EXIT_FAILURE);
}
@@ -334,7 +339,11 @@ do_fuser (const char *mountpoint)
}
if (pid == 0) { /* Child - run /sbin/fuser. */
+#ifdef __linux__
execlp ("/sbin/fuser", "fuser", "-v", "-m", mountpoint, NULL);
+#else
+ execlp ("/sbin/fuser", "fuser", "-c", mountpoint, NULL);
+#endif
_exit (EXIT_FAILURE);
}
--
1.9.3
9 years, 9 months
[PATCH 1/5] macosx: Add required third parameter for xdrproc_t callbacks
by Margaret Lewicka
>From Apple's xdr.h:
"If your code invokes an xdrproc_t callback, it must be modified to pass
a third parameter, which may simply be zero."
---
src/proto.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/proto.c b/src/proto.c
index 92ae84d..57f4882 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -252,7 +252,12 @@ guestfs___send (guestfs_h *g, int proc_nr,
* have no parameters.
*/
if (xdrp) {
+#if !(defined __APPLE__ && defined __MACH__)
if (!(*xdrp) (&xdr, args)) {
+#else
+ /* Mac OS X's implementation of xdrproc_t requires a third parameter */
+ if (!(*xdrp) (&xdr, args, 0)) {
+#endif
error (g, _("dispatch failed to marshal args"));
return -1;
}
@@ -681,7 +686,12 @@ guestfs___recv (guestfs_h *g, const char *fn,
return -1;
}
} else {
+#if !(defined __APPLE__ && defined __MACH__)
if (xdrp && ret && !xdrp (&xdr, ret)) {
+#else
+ /* Mac OS X's implementation of xdrproc_t requires a third parameter */
+ if (xdrp && ret && !xdrp (&xdr, ret, 0)) {
+#endif
error (g, "%s: failed to parse reply", fn);
xdr_destroy (&xdr);
return -1;
--
1.9.3
9 years, 9 months
[PATCH v4 0/2] add btrfs_balance_status and btrfs_scrub_status
by Chen Hanxiao
v4:
- add reply_with_error when nlines < 1
- remove `i == X' tests.
v3:
- rebase on upstream
- fix some comments
v2:
- add check for the length of lines[]
- the code parsing 'btrfs scrub -R status' output is changed into a loop
Hu Tao (2):
New API: btrfs_balance_status
New API: btfs_scrub_status
daemon/btrfs.c | 268 +++++++++++++++++++++++++++++++
generator/actions.ml | 26 +++
generator/structs.ml | 34 ++++
gobject/Makefile.inc | 4 +
java/Makefile.inc | 2 +
java/com/redhat/et/libguestfs/.gitignore | 2 +
po/POTFILES | 2 +
src/MAX_PROC_NR | 2 +-
8 files changed, 339 insertions(+), 1 deletion(-)
--
2.1.0
9 years, 9 months
[PATCH] ./run: Use 'prepend' function to build paths.
by Richard W.M. Jones
Add a bash function 'prepend' for intelligently prepending elements to
paths. eg:
prepend PYTHONPATH "/foo"
would set PYTHONPATH to "/foo" or "/foo:<previous-contents-of-PYTHONPATH>"
Tested by:
(1) Building and testing libguestfs twice: first without libguestfs
installed as a system library, and then with it installed.
(2) Examining the output of './run printenv' by hand and comparing
environment variables to the expected values.
---
run.in | 103 +++++++++++++++++++++++++++++++++++------------------------------
1 file changed, 55 insertions(+), 48 deletions(-)
diff --git a/run.in b/run.in
index bf7ea1b..46b47c3 100755
--- a/run.in
+++ b/run.in
@@ -43,6 +43,13 @@ if [ "$1" = "--test" ]; then
shift
fi
+# Function to intelligently prepend a path to an environment variable.
+# See http://stackoverflow.com/a/9631350
+prepend()
+{
+ eval $1="$2\${$1:+:\$$1}"
+}
+
# Source and build directories (absolute paths so this works from any
# directory).
s="$(cd @abs_srcdir@ && pwd)"
@@ -74,33 +81,55 @@ fi
# Set the PATH to contain all the libguestfs binaries. There are a
# lot of binaries, so a lot of path entries.
-PATH="$b/align:$b/builder:$b/cat:$b/customize:$b/df:$b/diff:$b/edit:$b/erlang:$b/fish:$b/format:$b/fuse:$b/inspector:$b/make-fs:$b/p2v:$b/rescue:$b/resize:$b/sparsify:$b/sysprep:$b/test-tool:$b/tools:$b/v2v:$PATH"
+prepend PATH "$b/align"
+prepend PATH "$b/builder"
+prepend PATH "$b/cat"
+prepend PATH "$b/customize"
+prepend PATH "$b/df"
+prepend PATH "$b/diff"
+prepend PATH "$b/edit"
+prepend PATH "$b/erlang"
+prepend PATH "$b/fish"
+prepend PATH "$b/format"
+prepend PATH "$b/fuse"
+prepend PATH "$b/inspector"
+prepend PATH "$b/make-fs"
+prepend PATH "$b/p2v"
+prepend PATH "$b/rescue"
+prepend PATH "$b/resize"
+prepend PATH "$b/sparsify"
+prepend PATH "$b/sysprep"
+prepend PATH "$b/test-tool"
+prepend PATH "$b/tools"
+prepend PATH "$b/v2v"
export PATH
# Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to contain library.
-build_libs_path="$b/src/.libs:$b/java/.libs:$b/gobject/.libs"
-export LD_LIBRARY_PATH="$build_libs_path${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
-export DYLD_LIBRARY_PATH="$build_libs_path${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
+prepend LD_LIBRARY_PATH "$b/gobject/.libs"
+prepend LD_LIBRARY_PATH "$b/java/.libs"
+prepend LD_LIBRARY_PATH "$b/src/.libs"
+prepend DYLD_LIBRARY_PATH "$b/gobject/.libs"
+prepend DYLD_LIBRARY_PATH "$b/java/.libs"
+prepend DYLD_LIBRARY_PATH "$b/src/.libs"
+export LD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
# Make virt-builder use the local website copy to avoid hitting
# the network all the time.
if [ -z "$XDG_CONFIG_DIRS" ]; then
- XDG_CONFIG_DIRS="$b/builder/test-website"
+ prepend XDG_CONFIG_DIRS "$b/builder/test-website"
export XDG_CONFIG_DIRS
fi
# virt-p2v-make-* data directory.
if [ -z "$VIRT_P2V_DATA_DIR" ]; then
- VIRT_P2V_DATA_DIR="$b/p2v"
+ prepend VIRT_P2V_DATA_DIR "$b/p2v"
export VIRT_P2V_DATA_DIR
fi
# For Perl.
-if [ -z "$PERL5LIB" ]; then
- PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch"
-else
- PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch:$PERL5LIB"
-fi
+prepend PERL5LIB "$b/perl/blib/arch"
+prepend PERL5LIB "$b/perl/blib/lib"
export PERL5LIB
# Enable Perl valgrinding.
@@ -112,52 +141,38 @@ export PERL_DESTRUCT_LEVEL=2
# For Python.
export PYTHON=@PYTHON@
-if [ -z "$PYTHONPATH" ]; then
- PYTHONPATH="$s/python:$b/python:$b/python/.libs"
-else
- PYTHONPATH="$s/python:$b/python:$b/python/.libs:$PYTHONPATH"
-fi
+prepend PYTHONPATH "$b/python/.libs"
+prepend PYTHONPATH "$b/python"
+prepend PYTHONPATH "$s/python"
export PYTHONPATH
# For Ruby.
export RUBY=@RUBY@
export RAKE=@RAKE@
-if [ -z "$RUBYLIB" ]; then
- RUBYLIB="$b/ruby/lib:$b/ruby/ext/guestfs"
-else
- RUBYLIB="$b/ruby/lib:$b/ruby/ext/guestfs:$RUBYLIB"
-fi
+prepend RUBYLIB "$b/ruby/ext/guestfs"
+prepend RUBYLIB "$b/ruby/lib"
export RUBYLIB
-export LD_LIBRARY_PATH="$b/ruby/ext/guestfs${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
-export DYLD_LIBRARY_PATH="$b/ruby/ext/guestfs${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
+prepend LD_LIBRARY_PATH "$b/ruby/ext/guestfs"
+prepend DYLD_LIBRARY_PATH "$b/ruby/ext/guestfs"
# For OCaml.
-if [ -z "$CAML_LD_LIBRARY_PATH" ]; then
- CAML_LD_LIBRARY_PATH="$b/ocaml"
-else
- CAML_LD_LIBRARY_PATH="$b/ocaml:$CAML_LD_LIBRARY_PATH"
-fi
+prepend CAML_LD_LIBRARY_PATH "$b/ocaml"
export CAML_LD_LIBRARY_PATH
# For Java.
export JAVA_EXE=@JAVA_EXE@
-if [ -z "$CLASSPATH" ]; then
- CLASSPATH="$b/java:$b/java/t:$b/java/libguestfs-@VERSION@.jar"
-else
- CLASSPATH="$b/java:$b/java/t:$b/java/libguestfs-@VERSION@.jar:$CLASSPATH"
-fi
+prepend CLASSPATH "$b/java/libguestfs-@VERSION@.jar"
+prepend CLASSPATH "$b/java/t"
+prepend CLASSPATH "$b/java"
export CLASSPATH
# For Erlang (note $PATH is adjusted above to include erl-guestfs).
-if [ -z "$ERL_LIBS" ]; then
- ERL_LIBS="$b/erlang"
-else
- ERL_LIBS="$b/erlang:$ERL_LIBS"
-fi
+prepend ERL_LIBS "$b/erlang"
export ERL_LIBS
# For Lua.
export LUA=@LUA@
+# Can't use 'prepend' here because Lua paths use semicolons.
if [ -z "$LUA_CPATH" ]; then
LUA_CPATH="$b/lua/?.so"
else
@@ -167,11 +182,7 @@ export LUA_CPATH
# For golang.
export GOLANG=@GOLANG@
-if [ -z "$GOPATH" ]; then
- GOPATH="$b/golang"
-else
- GOPATH="$b/golang:$GOPATH"
-fi
+prepend GOPATH "$b/golang"
export GOPATH
if [ -z "$CGO_CFLAGS" ]; then
CGO_CFLAGS="-I$s/src"
@@ -188,11 +199,7 @@ export CGO_LDFLAGS
# For GObject, Javascript and friends.
export GJS=@GJS@
-if [ -z "$GI_TYPELIB_PATH" ]; then
- GI_TYPELIB_PATH="$b/gobject"
-else
- GI_TYPELIB_PATH="$b/gobject:$GI_TYPELIB_PATH"
-fi
+prepend GI_TYPELIB_PATH "$b/gobject"
export GI_TYPELIB_PATH
# Be friendly to valgrind (https://live.gnome.org/Valgrind)
export G_SLICE=always-malloc
--
2.1.0
9 years, 9 months
[PATCH 1/2] run: Set DYLD_LIBRARY_PATH along with LD_LIBRARY_PATH
by Margaret Lewicka
Mac OS X uses DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH.
---
run.in | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/run.in b/run.in
index a8c2904..bf7ea1b 100755
--- a/run.in
+++ b/run.in
@@ -77,13 +77,10 @@ fi
PATH="$b/align:$b/builder:$b/cat:$b/customize:$b/df:$b/diff:$b/edit:$b/erlang:$b/fish:$b/format:$b/fuse:$b/inspector:$b/make-fs:$b/p2v:$b/rescue:$b/resize:$b/sparsify:$b/sysprep:$b/test-tool:$b/tools:$b/v2v:$PATH"
export PATH
-# Set LD_LIBRARY_PATH to contain library.
-if [ -z "$LD_LIBRARY_PATH" ]; then
- LD_LIBRARY_PATH="$b/src/.libs:$b/java/.libs:$b/gobject/.libs"
-else
- LD_LIBRARY_PATH="$b/src/.libs:$b/java/.libs:$b/gobject/.libs:$LD_LIBRARY_PATH"
-fi
-export LD_LIBRARY_PATH
+# Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to contain library.
+build_libs_path="$b/src/.libs:$b/java/.libs:$b/gobject/.libs"
+export LD_LIBRARY_PATH="$build_libs_path${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+export DYLD_LIBRARY_PATH="$build_libs_path${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
# Make virt-builder use the local website copy to avoid hitting
# the network all the time.
@@ -131,7 +128,8 @@ else
RUBYLIB="$b/ruby/lib:$b/ruby/ext/guestfs:$RUBYLIB"
fi
export RUBYLIB
-export LD_LIBRARY_PATH="$b/ruby/ext/guestfs:$LD_LIBRARY_PATH"
+export LD_LIBRARY_PATH="$b/ruby/ext/guestfs${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+export DYLD_LIBRARY_PATH="$b/ruby/ext/guestfs${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
# For OCaml.
if [ -z "$CAML_LD_LIBRARY_PATH" ]; then
--
1.9.3
9 years, 9 months
[PATCH v3 0/2] add btrfs_balance_status and btrfs_scrub_status
by Chen Hanxiao
v3:
- rebase on upstream
- fix some comments
v2:
- add check for the length of lines[]
- the code parsing 'btrfs scrub -R status' output is changed into a loop
Hu Tao (2):
New API: btrfs_balance_status
New API: btfs_scrub_status
daemon/btrfs.c | 263 +++++++++++++++++++++++++++++++
generator/actions.ml | 26 +++
generator/structs.ml | 34 ++++
gobject/Makefile.inc | 4 +
java/Makefile.inc | 2 +
java/com/redhat/et/libguestfs/.gitignore | 2 +
po/POTFILES | 2 +
src/MAX_PROC_NR | 2 +-
8 files changed, 334 insertions(+), 1 deletion(-)
--
2.1.0
9 years, 9 months