[PATCH] daemon: echo-daemon: do not crash on empty string
by Pino Toscano
When an empty string is passed, then that turns into no elements into
the input array, and thus no return buffer is created, leading to
dereference null to assign the trailing null. In such situation,
create an empty string as return value.
---
daemon/echo-daemon.c | 8 ++++++++
generator/actions.ml | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/daemon/echo-daemon.c b/daemon/echo-daemon.c
index c805819..d8f1028 100644
--- a/daemon/echo-daemon.c
+++ b/daemon/echo-daemon.c
@@ -65,6 +65,14 @@ do_echo_daemon (char *const *argv)
argv++;
}
+ if (NULL == out) {
+ /* No strings, so create a new empty array. */
+ out = malloc (sizeof (char *));
+ if (NULL == out) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+ }
/* NULL terminate the output */
out[out_len] = '\0';
diff --git a/generator/actions.ml b/generator/actions.ml
index 9570d9b..bb95f7a 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -7210,7 +7210,9 @@ was built (see C<appliance/kmod.whitelist.in> in the source)." };
proc_nr = Some 195;
tests = [
InitNone, Always, TestResultString (
- [["echo_daemon"; "This is a test"]], "This is a test"), []
+ [["echo_daemon"; "This is a test"]], "This is a test"), [];
+ InitNone, Always, TestResultString (
+ [["echo_daemon"; ""]], ""), [];
];
shortdesc = "echo arguments back to the client";
longdesc = "\
--
1.9.3
10 years, 4 months
[PATCH] drives: fix deletion of servers on error
by Pino Toscano
Make sure to not skip any of the created server, and to always free
the "server" array.
diff --git a/src/drives.c b/src/drives.c
index 4bd8328..85c1495 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs,
for (i = 0; i < n; ++i) {
if (parse_one_server (g, strs[i], &servers[i]) == -1) {
- if (i > 0)
- free_drive_servers (servers, i-1);
+ free_drive_servers (servers, i);
return -1;
}
}
---
src/drives.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/drives.c b/src/drives.c
index 4bd8328..85c1495 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs,
for (i = 0; i < n; ++i) {
if (parse_one_server (g, strs[i], &servers[i]) == -1) {
- if (i > 0)
- free_drive_servers (servers, i-1);
+ free_drive_servers (servers, i);
return -1;
}
}
--
1.9.3
10 years, 4 months
Re: [Libguestfs] hang after seabios
by Richard W.M. Jones
[Let's keep this on the mailing list]
On Thu, Jul 31, 2014 at 02:48:25PM -0700, Zetan Drableg wrote:
> Hi Richard,
> I created qemu-wrapper:
> #!/bin/bash -x
>
> exec gdbserver :1234 /usr/libexec/qemu-kvm "$@"
gdbserver will end up debugging the qemu process, not the guest
inside. This is not useful.
You need to do something like:
exec /usr/libexec/qemu-kvm -s -S "$@"
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
10 years, 4 months
[hivex] [PATCH 0/6] Python fixes for node_set_value
by Peter Wu
Hi,
This patch series is based on a prior patch[1], splitting off changes as
requested and incorporating feedback from Richard Jones. It introduces type
validation to avoid segmentation faults (instead, it reports an exception) and
fixes handling of the bytes type in Python 3.
Major changes since that series:
- Drop newly introduced support for integer types for DWORD/QWORDS
- Reject Unicode string types for Python 3 (and restore bytes support).
- Adjusted tests due to new requirements.
These changes were tested with the following combinations:
- Arch Linux x86_64 - Python 2.7.8, 3.4.1
- Kubuntu 14.04 x86_64 - Python 2.7.6, 3.4.0
- Ubuntu 10.04 i686 - Python 2.6.5, 3.1.2. Note that Python 3.1.2 does not pass
the tests (syntax error) unless you remove the use of Unicode literals:
`sed 's/u"/"/' -i python/t/*.py`
Support for Unicode literals was removed in 3.0 and restored in 3.3 (PEP-414)
[1]: https://www.redhat.com/archives/libguestfs/2014-August/msg00051.html
Peter Wu (6):
python: use errors more specific than RuntimeError
python: use PyErr_NoMemory
python: check some types for get_value
python: fix crash by validating key and value
python: add heavier tests for setvalue
generator: Fix mixed tabs/spaces
configure.ac | 4 -
generator/generator.ml | 570 +++++++++++++++++++++--------------------
python/t/200-write.py | 4 +-
python/t/210-setvalue.py | 28 +-
python/t/300-setvalue-types.py | 80 ++++++
5 files changed, 386 insertions(+), 300 deletions(-)
create mode 100644 python/t/300-setvalue-types.py
--
2.0.4
10 years, 4 months
[PATCH] daemon: zfile: call pclose instead of fclose
by Pino Toscano
fp was opened with popen, so close it properly.
---
daemon/file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/daemon/file.c b/daemon/file.c
index 856ab5f..f1be51a 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -552,12 +552,12 @@ do_zfile (const char *method, const char *path)
if (fgets (line, sizeof line, fp) == NULL) {
reply_with_perror ("fgets");
- fclose (fp);
+ pclose (fp);
return NULL;
}
- if (fclose (fp) == -1) {
- reply_with_perror ("fclose");
+ if (pclose (fp) == -1) {
+ reply_with_perror ("pclose");
return NULL;
}
--
1.9.3
10 years, 4 months
More notes on virt-v2v 1.27.27
by Richard W.M. Jones
[Shahar: Let's discuss virt-v2v & oVirt integration on the public
mailing list from now on.]
New in 1.27.27:
* What we previously called `-o ovf' -- ie the ability to export just
the OVF metadata -- has been implemented but in a slightly different
way. You can now use:
virt-v2v [...] -o rhev --no-copy -os remote:/esd
^^^^^^^^^
This means do the conversion and produce the metadata, but don't
bother copying the disks. This flag is of course applicable to other
output methods.
* You can use the options --rhev-image-uuid, --rhev-vol-uuid and
--rhev-vm-uuid to control the UUIDs used when exporting to oVirt. As
previously discussed this lets the OVF produced by the --no-copy
option be relatively stable.
* There is now a fairly minimal test suite which is run on every
release (`make check-release'). See `v2v/test-*.sh'.
It tests that the virt-v2v command line flags all work, and that a
handful of real guests don't break virt-v2v.
However it does *not* test that conversion is successful or that the
guest will boot on the target. That will be done by a more
sophisticated test suite which I'm writing which unfortunately cannot
be fully released in public because it contains proprietary guests
eg Windows.
* The `-o libvirt' target has now been implemented.
* A lot of code clean ups, bug fixes etc.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
10 years, 4 months
virt-builder error
by pixelfairy
to the point, maybe your supermin appliance should have its own
kernel? or bug ubuntu devs to make the kernel world readable.
more detail, as requested
Trying to build an image of ubuntu.
exact command
virt-builder ubuntu-14.04
exact output,
$ virt-builder ubuntu-14.04
[ 0.0] Downloading: http://libguestfs.org/download/builder/ubuntu-14.04.xz
[ 1.0] Creating disk image: ubuntu-14.04.img
[ 1.0] Uncompressing: http://libguestfs.org/download/builder/ubuntu-14.04.xz
[ 22.0] Running virt-resize to expand the disk to 4.2G
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: create: flags = 0, handle = 0x2428ec0, program = virt-resize
libguestfs: trace: add_drive "/tmp/vbsrcbe72ee.img" "readonly:true"
"format:raw" "protocol:file"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive "ubuntu-14.04.img" "readonly:false"
"format:raw" "cachemode:unsafe"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version *>
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=virt-resize
libguestfs: launch: version=1.24.5
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsySDyNP
libguestfs: launch: umask=0002
libguestfs: launch: euid=1000
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ -f checksum
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = (none)
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = (none)
supermin helper [00000ms] appliance = (none)
checking modpath /lib/modules/3.13.0-24-generic is a directory
checking modpath /lib/modules/3.13.0-32-generic is a directory
checking modpath /lib/modules/3.13.0-33-generic is a directory
checking modpath /lib/modules/3.13.0-34-generic is a directory
picked kernel vmlinuz-3.13.0-34-generic
supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.img
supermin helper [00000ms] adding kernel modules
supermin helper [00028ms] finished creating appliance
libguestfs: checksum of existing appliance:
91a71afb6469a54392edcc914ff8a641915f545c14683266905f8f7ce855a8fd
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: [00033ms] begin building supermin appliance
libguestfs: [00033ms] run supermin-helper
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
libguestfs: command: run: \ --output-kernel /var/tmp/guestfs.br7JCi/kernel
libguestfs: command: run: \ --output-initrd /var/tmp/guestfs.br7JCi/initrd
libguestfs: command: run: \ --output-appliance /var/tmp/guestfs.br7JCi/root
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = /var/tmp/guestfs.br7JCi/kernel
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = /var/tmp/guestfs.br7JCi/initrd
supermin helper [00000ms] appliance = /var/tmp/guestfs.br7JCi/root
checking modpath /lib/modules/3.13.0-24-generic is a directory
checking modpath /lib/modules/3.13.0-32-generic is a directory
checking modpath /lib/modules/3.13.0-33-generic is a directory
checking modpath /lib/modules/3.13.0-34-generic is a directory
picked kernel vmlinuz-3.13.0-34-generic
/usr/bin/supermin-helper: open: /boot/vmlinuz-3.13.0-34-generic:
Permission denied
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /var/tmp/guestfs.br7JCi
libguestfs: trace: launch = -1 (error)
Fatal error: exception Guestfs.Error("/usr/bin/supermin-helper exited
with error status 1, see debug messages above")
libguestfs: trace: close
libguestfs: closing guestfs handle 0x2428ec0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsySDyNP
virt-builder: error: virt-resize failed
pixel@akaran:~$ exit
guestfstools version 1.24.5-1 installed via apt from ubuntu repo
host ubuntu 14.04
kernel 3.13.0-34-generic x86_64
hardware vmware-fusion 6.04 with vt enabled. (on mavericks)
10 years, 4 months
[PATCH] tests/syslinux: add /usr/lib/syslinux/bios as directory for mbr.bin
by Pino Toscano
On Archlinux that is the location of mbr.bin.
---
tests/syslinux/test-syslinux.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/syslinux/test-syslinux.pl b/tests/syslinux/test-syslinux.pl
index 3950309..ac1e1cb 100755
--- a/tests/syslinux/test-syslinux.pl
+++ b/tests/syslinux/test-syslinux.pl
@@ -33,7 +33,8 @@ my $mbr;
my @mbr_paths = (
"/usr/share/syslinux/mbr.bin",
"/usr/lib/syslinux/mbr.bin",
- "/usr/lib/syslinux/mbr/mbr.bin"
+ "/usr/lib/syslinux/mbr/mbr.bin",
+ "/usr/lib/syslinux/bios/mbr.bin"
);
foreach my $m (@mbr_paths) {
if (-f $m) {
--
1.9.3
10 years, 4 months
[PATCH] appliance: add mtools to Archlinux' packagelist
by Pino Toscano
It is an optional dependency but syslinux uses it, so pull it always in
the appliance.
---
appliance/packagelist.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 41bb8e4..3aeafc6 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -110,6 +110,9 @@ ifelse(ARCHLINUX,1,
libcap
linux
lrzip
+ dnl syslinux has mtools as optional dependency, but in reality it's
+ dnl a hard one:
+ mtools
nilfs-utils
ntfsprogs
ntfs-3g
--
1.9.3
10 years, 4 months