[PATCH] Enable running the daemon under valgrind.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
This commit allows you to run the daemon under valgrind. You have to
enable it at configure time:
./configure --enable-valgrind-daemon
This should *not* be done for production builds.
When this feature is enabled, valgrind is added to the appliance and
the daemon is run under valgrind. Log messages from valgrind are
passed back over a virtio-serial channel into a file called
'valgrind.log.$PID' in the top build directory.
Running 'make check', 'make extra-tests' etc causes many
valgrind.log.* files to be created which must be examined by hand.
---
.gitignore | 1 +
appliance/Makefile.am | 9 +++++++--
appliance/init | 10 +++++++++-
appliance/packagelist.in | 4 ++++
configure.ac | 15 +++++++++++++++
src/guestfs.c | 2 ++
src/launch.c | 10 ++++++++++
7 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index b75cafb..fc732bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -387,3 +387,4 @@ test-tool/libguestfs-test-tool-helper
tools/test.img
tools/virt-*.1
tools/virt-*.pl
+/valgrind.log.*
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
index e2e8b96..99896be 100644
--- a/appliance/Makefile.am
+++ b/appliance/Makefile.am
@@ -42,13 +42,18 @@ make.sh: make.sh.in
chmod +x $@-t
mv $@-t $@
+PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1
+if VALGRIND_DAEMON
+PACKAGELIST_CPP_FLAGS += -DVALGRIND_DAEMON=1
+endif
+
packagelist: packagelist.in
- cpp -undef -D$(DISTRO)=1 < $< | \
+ cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
mv $@-t $@
excludelist: excludelist.in
- cpp -undef -D$(DISTRO)=1 < $< | \
+ cpp -undef $(PACKAGELIST_CPP_FLAGS) < $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
mv $@-t $@
diff --git a/appliance/init b/appliance/init
index 0f32a55..4ec3214 100755
--- a/appliance/init
+++ b/appliance/init
@@ -106,8 +106,16 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then
fi
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
+ # Run the daemon under valgrind if ./configure --enable-valgrind-daemon
+ vg_channel=/dev/virtio-ports/org.libguestfs.valgrind
+ if [ -w $vg_channel ]; then
+ exec 3>$vg_channel
+ vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119"
+ echo "enabling valgrind: $vg"
+ fi
+
# The host will kill qemu abruptly if guestfsd shuts down normally
- guestfsd
+ $vg guestfsd
# Otherwise we try to clean up gracefully. For example, this ensures that a
# core dump generated by the guest daemon will be written to disk.
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 5735a5a..b42c510 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -130,3 +130,7 @@ tar
xfsprogs
#endif
zerofree
+
+#ifdef VALGRIND_DAEMON
+valgrind
+#endif
diff --git a/configure.ac b/configure.ac
index 3e364b1..ebc20aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,8 +264,23 @@ if test "x$enable_daemon" = "xyes"; then
[],
[enable_install_daemon=no])
AC_MSG_RESULT([$enable_install_daemon])
+
+ dnl Enable valgrind in the daemon.
+ AC_MSG_CHECKING([if we should run the daemon under valgrind])
+ AC_ARG_ENABLE([valgrind-daemon],
+ [AS_HELP_STRING([--enable-valgrind-daemon],
+ [run the daemon under valgrind (developers only) @<:@default=no@:>@])],
+ [],
+ [enable_valgrind_daemon=no])
+ AC_MSG_RESULT([$enable_valgrind_daemon])
+
+ if test "x$enable_valgrind_daemon" = "xyes"; then
+ AC_DEFINE([VALGRIND_DAEMON],[1],[Define to 1 to run the daemon under valgrind])
+ AC_DEFINE_UNQUOTED([VALGRIND_LOG_PATH],["$(pwd)"],[Path to save valgrind log files])
+ fi
fi
AM_CONDITIONAL([INSTALL_DAEMON],[test "x$enable_install_daemon" = "xyes"])
+AM_CONDITIONAL([VALGRIND_DAEMON],[test "x$enable_valgrind_daemon" = "xyes"])
dnl Build the appliance?
AC_MSG_CHECKING([if we should build the appliance])
diff --git a/src/guestfs.c b/src/guestfs.c
index 31968e4..5fedf4b 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -190,9 +190,11 @@ guestfs_close (guestfs_h *g)
if (g->autosync && g->state == READY)
guestfs_internal_autosync (g);
+#ifndef VALGRIND_DAEMON
/* Kill the qemu subprocess. */
if (g->state != CONFIG)
guestfs_kill_subprocess (g);
+#endif
/* Run user close callbacks. */
guestfs___call_callbacks_void (g, GUESTFS_EVENT_CLOSE);
diff --git a/src/launch.c b/src/launch.c
index 1af74b9..4e2fba9 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -703,6 +703,16 @@ launch_appliance (guestfs_h *g)
add_cmdline (g, "-device");
add_cmdline (g, "virtserialport,chardev=channel0,name=org.libguestfs.channel.0");
+#ifdef VALGRIND_DAEMON
+ /* Set up virtio-serial channel for valgrind messages. */
+ add_cmdline (g, "-chardev");
+ snprintf (buf, sizeof buf, "file,path=%s/valgrind.log.%d,id=valgrind",
+ VALGRIND_LOG_PATH, getpid ());
+ add_cmdline (g, buf);
+ add_cmdline (g, "-device");
+ add_cmdline (g, "virtserialport,chardev=valgrind,name=org.libguestfs.valgrind");
+#endif
+
/* Enable user networking. */
if (g->enable_network) {
add_cmdline (g, "-netdev");
--
1.7.6
12 years, 11 months
[ANNOUNCE] libguestfs 1.16 released - tools for managing virtual machines and disk images
by Richard W.M. Jones
libguestfs is a library and a set of tools for reading, writing,
managing, inspecting, rescuing, resizing and aligning disk images, and
offline and live virtual machines.
I'm pleased to announce the release of libguestfs 1.16, the next
stable release of libguestfs. See the release notes below for the
full list of changes.
You can get source and binaries from the website:
http://libguestfs.org/
Source: http://libguestfs.org/download/1.14-stable/
Fedora: http://koji.fedoraproject.org/koji/packageinfo?packageID=8391
Debian/Ubuntu: (packages available soon)
Release notes for libguestfs 1.16.0
-----------------------------------
These release notes only cover the differences from the previous
stable/dev branch split (1.14.0). For detailed changelogs, please see
the git repository, or the ChangeLog file distributed in the tarball.
New features
libguestfs:
- allow XFS filesystems to be created over an existing filesystem
(Wanlong Gao)
- the (unspecified) default alignment for part-disk has been
changed to 64K for better support of high-end network-attached
storage
- new guestfs-testing(1) man page
- list-filesystems returns MD devices containing filesystems
(Matthew Booth)
- support for GCC >= 4.7 (Jim Meyering)
- check user does not add the same drive twice (Wanlong Gao).
language bindings:
- Experimental GObject bindings, with support for GObject
Introspection. You can now use libguestfs from Javascript.
Please note these are not stable and final in this release.
(Matthew Booth).
- support for Ruby >= 1.9
- Ruby bindings can be disabled individually (Hilko Bengen)
- support for Python 2.6, 3.x (Richard Jones, Hilko Bengen)
- support for PHP >= 5.4
- new %guestfs_introspection hash is available in Perl bindings so
you can query which optional arguments are available
inspection:
- guests with MD devices can be inspected (Matthew Booth)
- support for GNU/Hurd guests
guestfish:
- libguestfs events (such as progress bar events and log messages) can
be trapped and processed by user-defined shell scripts.
- MD devices are tab-completed (Matthew Booth)
virt tools:
- New tool virt-format for erasing and making blank disks
- virt-sparsify new --compress and -o options to allow for compressed
and different format output
- virt-sparsify can now detect and sparsify .vdi files
- virt-sysprep no longer requires xmlstarlet; a new virt-inspector --xpath
option has been added to replace this functionality
- virt-rescue has a new --suggest option which suggests mount commands
for the guest
- virt-resize no longer requires OCaml pcre library
libguestfs live:
- daemon will no longer try to edit your live /etc/lvm configuration
- fix a potential security problem with predictable /tmp names (Steve Kemp)
Security
CVE-2011-4127, RHBZ#757071
Mitigate possible privilege escalation via SG_IO ioctl
For more information, see: https://github.com/libguestfs/libguestfs/commit/9a5f784d511a8f00a8386f316...
New APIs
blkid: print all attributes of a device known to blkid (Wanlong Gao)
e2fsck: access to more features of e2fsck (Wanlong Gao)
list-md-devices: list of Linux MD devices (Matthew Booth)
md-create: create an MD device
md-detail: returns metadata for an MD device (Matthew Booth)
md-stop: stop an MD device (Wanlong Gao)
tune2fs: allow ext2/3/4 filesystems to be tuned
Internals
Git hosting has moved to http://github.com/libguestfs
The various test directories have been rearranged logically, and now
all appear under 'tests/'.
There is a 'make extra-tests' rule which runs ordinary tests and
additional tests, using valgrind to check for memory problems.
Multiple memory leaks and other problems found by valgrind and fixed.
Support for optional arguments in the generator has been rewritten
to provide more features and safety (Matthew Booth).
With gcc -fvisibility=hidden is used for internal symbols, avoiding
call indirection via the PLT.
RHashtable functions can be tested in the generator.
ADD_ARG macro in daemon allows arg lists to be constructed without
risk of stack smashing.
Fix generation of OCaml functions that have more than 10 arguments.
psmisc has been added to the appliance, allowing use of 'fuser',
'killall' and 'pstree' for debugging.
bindtests now cover RBufferOut and optional arguments (Matthew Booth).
Bugs fixed
- 769680 temporary directories created during appliance builds are not cleaned up on error
- 761460 guestfs_utimens hangs on named pipes
- 761451 guestfs_utimens cannot set times on a directory
- 760775 "guestfish: multi-boot operating systems are not supported by the -i option" should be more explanatory
- 760669 guestfish copy-in and <! (inline execution) don't mix well: pclose: No child processes
- 760000 libguestfs fails to compile with Ruby >= 1.9
- 755729 Error message for resize2fs-M needs tweaking
- 750889 Python code incompatible with Python v3.
- 596761 Ctrl-\ causes guestfish to abort
----------------------------------------------------------------------
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
12 years, 11 months
Packaging GObject for Fedora (was: [rjones@fedoraproject.org: [libguestfs] New upstream version 1.15.19.])
by Richard W.M. Jones
These are the changes I made to the spec file related to gobject
bindings and gobject introspection. TBH I wasn't sure how to properly
package this.
Rich.
diff --git a/libguestfs.spec b/libguestfs.spec
index 095a848..1b6e43d 100644
--- a/libguestfs.spec
+++ b/libguestfs.spec
@@ -29,7 +29,7 @@
Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
-Version: 1.15.18
+Version: 1.15.19
Release: 1%{?dist}
License: LGPLv2+
Group: Development/Libraries
@@ -202,6 +208,9 @@ BuildRequires: java-devel
BuildRequires: php-devel
BuildRequires: erlang-erts
BuildRequires: erlang-erl_interface
+BuildRequires: glib2-devel
+BuildRequires: gobject-introspection-devel
+BuildRequires: gjs
# For libguestfs-tools:
BuildRequires: perl-Sys-Virt
@@ -272,6 +281,9 @@ To mount guest filesystems on the host using FUSE, install
For Erlang bindings, install 'erlang-libguestfs'.
+For GObject bindings and GObject Introspection, install
+'libguestfs-gobject-devel'.
+
For Java bindings, install 'libguestfs-java-devel'.
For OCaml bindings, install 'ocaml-libguestfs-devel'.
@@ -578,6 +590,30 @@ Requires: erlang-erts
erlang-%{name} contains Erlang bindings for %{name}.
+%package gobject
+Summary: GObject bindings for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{epoch}:%{version}-%{release}
+
+%description gobject
+%{name}-gobject contains GObject bindings for %{name}.
+
+To develop software against these bindings, you need to install
+%{name}-gobject-devel.
+
+
+%package gobject-devel
+Summary: GObject bindings for %{name}
+Group: Development/Libraries
+Requires: %{name}-gobject = %{epoch}:%{version}-%{release}
+
+%description gobject-devel
+%{name}-gobject contains GObject bindings for %{name}.
+
+This package is needed if you want to write software using the
+GObject bindings. It also contains GObject Introspection information.
+
+
%package man-pages-uk
Summary: Ukrainian (uk) man pages for %{name}
Group: Development/Libraries
@@ -740,6 +779,8 @@ make DESTDIR=$RPM_BUILD_ROOT install
# Delete static libraries, libtool files.
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.a
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.la
+rm $RPM_BUILD_ROOT%{_libdir}/libguestfs-gobject-1.0.a
+rm $RPM_BUILD_ROOT%{_libdir}/libguestfs-gobject-1.0.la
find $RPM_BUILD_ROOT -name perllocal.pod -delete
find $RPM_BUILD_ROOT -name .packlist -delete
@@ -961,6 +1002,19 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/guestfs-erlang.3*
+%files gobject
+%defattr(-,root,root,-)
+%{_libdir}/libguestfs-gobject-1.0.so.0*
+
+
+%files gobject-devel
+%defattr(-,root,root,-)
+%{_libdir}/libguestfs-gobject-1.0.so
+%{_includedir}/guestfs-gobject.h
+%{_libdir}/girepository-1.0/Guestfs-1.0.typelib
+%{_datadir}/gir-1.0/Guestfs-1.0.gir
+
+
%files man-pages-uk
%defattr(-,root,root,-)
%lang(uk) %{_mandir}/uk/man1/*.1*
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
12 years, 11 months
[PATCH] gobject: Require minimum gobject library version of 2.26.0
by Matthew Booth
The GObject bindings require G_DEFINE_BOXED_TYPE, which was not added until
2.25.15. There are probably other dependencies.
---
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index db4e25c..f3a6f13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,7 +1005,7 @@ AC_ARG_ENABLE([gobject],
AS_IF(
[test "x$enable_gobject" != "xno"],
[
- PKG_CHECK_MODULES([GOBJECT], [gobject-2.0],
+ PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.26.0],
[
AC_SUBST([GOBJECT_CFLAGS])
AC_SUBST([GOBJECT_LIBS])
--
1.7.7.5
12 years, 11 months
[PATCH] maint: use $var notation rather than ${var} when possible
by Jim Meyering
I noticed some uses of ${srcdir} in shell scripts.
That is almost always better written as $srcdir.
The patch below converts most such variable references.
Here are the few remaining candidates:
$ git grep -i -E '\$\{[a-zA-Z_0-9]+\}'|grep -v Makefile.in.in
configure.ac: JAR_INSTALL_DIR=\${prefix}/share/java
configure.ac: JNI_INSTALL_DIR=\${libdir}
debian/rules: for TEST in ${DEBIAN_SKIP_TEST}; do \
debian/rules:# mv $${mod} $$(dirname $${mod})/libguestfsmod.so; \
java/Makefile.am:libguestfs_jar_DATA = libguestfs-${VERSION}.jar
java/Makefile.am:libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
perl/lib/Sys/Guestfs/Lib.pm: "-f", '${Package} ${Version} ${Architecture} ${Status}\n',
perl/typemap: croak (\"${Package}::$func_name(): called on a closed handle\");
perl/typemap: croak (\"${Package}::$func_name(): $var is not a blessed HV reference\");
tests/data/Makefile.am: echo "$${i}abcdefghijklmnopqrstuvwxyz"; \
We could change all of those, too, except the ones in configure.ac
and Makefile.am, since they refer to Make variables. Even those
should be changed, but to use the preferred Makefile notation:
$(prefix), $(libdir), $(VERSION).
>From a86770ecd45666232a94d76c8725c8f9b1c76e3a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 23 Jan 2012 11:15:12 +0100
Subject: [PATCH libguestfs] maint: use $var notation rather than ${var} when
possible
The only case to avoid in a shell script is when the byte after the
"}" is word-constituent, and concatenating it would thus change the
name of the variable.
These changes were induced by running this command:
git grep -l -i -E '\$\{(srcdir|md)' \
|xargs perl -pi -e 's/\$\{(srcdir|md)\}($|\w)/\$$1$2/gi'
The "g" was needed because there was one line with two instances.
The "i" is to handle ${SRCDIR}. The ($|\w) ensures that concatenating
whatever follows the "}" won't change semantics.
* gobject/run-bindtests: Use "$srcdir", not "${srcdir}".
* haskell/run-bindtests: Likewise.
* java/run-bindtests: Likewise.
* ocaml/run-bindtests: Likewise.
* perl/run-bindtests: Likewise.
* python/run-bindtests: Likewise.
* ruby/run-bindtests: Likewise.
* tests/guests/guest-aux/make-debian-img.sh: Likewise, but $SRCDIR.
* tests/guests/guest-aux/make-ubuntu-img.sh: Likewise.
* tests/guests/guest-aux/make-windows-img.sh: Likewise.
* tests/md/test-mdadm.sh: Likewise, but $md.
---
gobject/run-bindtests | 2 +-
haskell/run-bindtests | 2 +-
java/run-bindtests | 2 +-
ocaml/run-bindtests | 2 +-
perl/run-bindtests | 2 +-
python/run-bindtests | 4 ++--
ruby/run-bindtests | 4 ++--
tests/guests/guest-aux/make-debian-img.sh | 4 ++--
tests/guests/guest-aux/make-ubuntu-img.sh | 4 ++--
tests/guests/guest-aux/make-windows-img.sh | 6 +++---
tests/md/test-mdadm.sh | 4 ++--
11 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/gobject/run-bindtests b/gobject/run-bindtests
index 48578cf..7691d6a 100755
--- a/gobject/run-bindtests
+++ b/gobject/run-bindtests
@@ -24,5 +24,5 @@ if [ -z "$GJS" ]; then
fi
../run $GJS bindtests.js > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
../run $GJS bindtests-manual.js 2>/dev/null
diff --git a/haskell/run-bindtests b/haskell/run-bindtests
index 3b17403..170b6d0 100755
--- a/haskell/run-bindtests
+++ b/haskell/run-bindtests
@@ -19,4 +19,4 @@
set -e
./Bindtests > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/java/run-bindtests b/java/run-bindtests
index 4fc147a..9557c9d 100755
--- a/java/run-bindtests
+++ b/java/run-bindtests
@@ -19,4 +19,4 @@
set -e
$JAVA -Djava.library.path=.libs Bindtests > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/ocaml/run-bindtests b/ocaml/run-bindtests
index af6fc14..da10231 100755
--- a/ocaml/run-bindtests
+++ b/ocaml/run-bindtests
@@ -19,4 +19,4 @@
set -e
./bindtests > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/perl/run-bindtests b/perl/run-bindtests
index 5a53ab6..e4621e3 100755
--- a/perl/run-bindtests
+++ b/perl/run-bindtests
@@ -20,4 +20,4 @@ set -e
export PERL5LIB=$(pwd)/blib/lib:$(pwd)/blib/arch
perl bindtests.pl > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/python/run-bindtests b/python/run-bindtests
index 0299ff1..1a8ba76 100755
--- a/python/run-bindtests
+++ b/python/run-bindtests
@@ -18,5 +18,5 @@
set -e
-$PYTHON ${srcdir}/bindtests.py > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+$PYTHON $srcdir/bindtests.py > bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/ruby/run-bindtests b/ruby/run-bindtests
index aafcfba..e9fdc31 100755
--- a/ruby/run-bindtests
+++ b/ruby/run-bindtests
@@ -18,5 +18,5 @@
set -e
-$RUBY -I${srcdir}/lib -Iext/guestfs ${srcdir}/bindtests.rb > bindtests.tmp
-diff -u ${srcdir}/../bindtests bindtests.tmp
+$RUBY -I$srcdir/lib -Iext/guestfs $srcdir/bindtests.rb > bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/tests/guests/guest-aux/make-debian-img.sh b/tests/guests/guest-aux/make-debian-img.sh
index b936f81..9449d0f 100755
--- a/tests/guests/guest-aux/make-debian-img.sh
+++ b/tests/guests/guest-aux/make-debian-img.sh
@@ -80,9 +80,9 @@ upload fstab.tmp /etc/fstab
write /etc/debian_version "5.0.1"
write /etc/hostname "debian.invalid"
-upload ${SRCDIR}/guest-aux/debian-packages /var/lib/dpkg/status
+upload $SRCDIR/guest-aux/debian-packages /var/lib/dpkg/status
-upload ${SRCDIR}/../data/bin-x86_64-dynamic /bin/ls
+upload $SRCDIR/../data/bin-x86_64-dynamic /bin/ls
mkdir /boot/grub
touch /boot/grub/grub.conf
diff --git a/tests/guests/guest-aux/make-ubuntu-img.sh b/tests/guests/guest-aux/make-ubuntu-img.sh
index e55c790..c2831aa 100755
--- a/tests/guests/guest-aux/make-ubuntu-img.sh
+++ b/tests/guests/guest-aux/make-ubuntu-img.sh
@@ -69,9 +69,9 @@ write /etc/debian_version "5.0.1"
upload release.tmp /etc/lsb-release
write /etc/hostname "ubuntu.invalid"
-upload ${SRCDIR}/guest-aux/debian-packages /var/lib/dpkg/status
+upload $SRCDIR/guest-aux/debian-packages /var/lib/dpkg/status
-upload ${SRCDIR}/../data/bin-x86_64-dynamic /bin/ls
+upload $SRCDIR/../data/bin-x86_64-dynamic /bin/ls
mkdir /boot/grub
touch /boot/grub/grub.conf
diff --git a/tests/guests/guest-aux/make-windows-img.sh b/tests/guests/guest-aux/make-windows-img.sh
index 47b8abb..ed94998 100755
--- a/tests/guests/guest-aux/make-windows-img.sh
+++ b/tests/guests/guest-aux/make-windows-img.sh
@@ -58,10 +58,10 @@ mkfs ntfs /dev/sda2
mount-options "" /dev/sda2 /
mkdir-p /Windows/System32/Config
-upload ${SRCDIR}/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
-upload ${SRCDIR}/guest-aux/windows-system /Windows/System32/Config/SYSTEM
+upload $SRCDIR/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
+upload $SRCDIR/guest-aux/windows-system /Windows/System32/Config/SYSTEM
-upload ${SRCDIR}/../data/bin-win32.exe /Windows/System32/cmd.exe
+upload $SRCDIR/../data/bin-win32.exe /Windows/System32/cmd.exe
mkdir "/Program Files"
touch /autoexec.bat
diff --git a/tests/md/test-mdadm.sh b/tests/md/test-mdadm.sh
index e7f5775..620dcfd 100755
--- a/tests/md/test-mdadm.sh
+++ b/tests/md/test-mdadm.sh
@@ -100,7 +100,7 @@ eval `../../fish/guestfish --listen`
../../fish/guestfish --remote run
for md in `../../fish/guestfish --remote list-md-devices`; do
- ../../fish/guestfish --remote md-detail "${md}" > md-detail.out
+ ../../fish/guestfish --remote md-detail "$md" > md-detail.out
sed 's/:\s*/=/' md-detail.out > md-detail.out.sh
. md-detail.out.sh
@@ -158,7 +158,7 @@ eval `../../fish/guestfish --listen`
../../fish/guestfish --remote run
for md in `../../fish/guestfish --remote list-md-devices`; do
- ../../fish/guestfish --remote md-stop "${md}"
+ ../../fish/guestfish --remote md-stop "$md"
done
../../fish/guestfish --remote exit
--
1.7.9.rc2.2.g183d6
12 years, 11 months
[PATCH libguestfs] build: don't use automake-internal variable
by Jim Meyering
Hi Rich,
I realized a day or two late that my suggestion was not quite right.
Here's the fix:
>From 5294c21cf07c4ec2f094182ba9f32696f3de2751 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 23 Jan 2012 10:01:40 +0100
Subject: [PATCH libguestfs] build: don't use automake-internal variable
* ocaml/Makefile.am (mlguestfs.cma): Use the documented variable form,
$(libguestfsocaml_a_OBJECTS), not the $(am_libguestfsocaml_a_OBJECTS)
that I suggested for commit 1.15.16-17-g8b9eaec.
---
ocaml/Makefile.am | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index fbeefc9..eac9b84 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -49,12 +49,12 @@ noinst_LIBRARIES = libguestfsocaml.a
mlguestfs.cma: libguestfsocaml.a guestfs.cmo
$(OCAMLMKLIB) -o mlguestfs \
- $(am_libguestfsocaml_a_OBJECTS) guestfs.cmo \
+ $(libguestfsocaml_a_OBJECTS) guestfs.cmo \
-L$(top_builddir)/src/.libs -lguestfs
mlguestfs.cmxa: libguestfsocaml.a guestfs.cmx
$(OCAMLMKLIB) -o mlguestfs \
- $(am_libguestfsocaml_a_OBJECTS) guestfs.cmx \
+ $(libguestfsocaml_a_OBJECTS) guestfs.cmx \
-L$(top_builddir)/src/.libs -lguestfs
libguestfsocaml_a_CFLAGS = \
--
1.7.9.rc2.2.g183d6
12 years, 11 months
Compile failure
by Wanlong Gao
Hi:
I can't compile upstream now, it seems the gobject ld error, maybe I need install something, but I'm
not familiar with gobject.
Maybe we need to add something more to check if we should enable gobject bindings?
error message is below:
---
GISCAN Guestfs-1.0.gir
./.libs/libguestfs-gobject-1.0.so: undefined reference to `guestfs_test0rbufferouterr'
./.libs/libguestfs-gobject-1.0.so: undefined reference to `guestfs_test0_argv'
./.libs/libguestfs-gobject-1.0.so: undefined reference to `guestfs_test0rbufferout'
collect2: ld returned 1 exit status
linking of temporary binary failed: Command '['bash', '../libtool-kill-dependency_libs.sh', '../libtool', '--mode=link', '--tag=CC', '--silent', 'gcc', '-o', '/work/git/libguestfs/gobject/tmp-introspect_tAaLT/Guestfs-1.0', '-export-dynamic', '-L.', 'libguestfs-gobject-1.0.la', '-pthread', '-lgio-2.0', '-lgobject-2.0', '-lgmodule-2.0', '-lgthread-2.0', '-lrt', '-lglib-2.0', '/work/git/libguestfs/gobject/tmp-introspect_tAaLT/Guestfs-1.0.o']' returned non-zero exit status 1
make[3]: *** [Guestfs-1.0.gir] Error 1
make[3]: Leaving directory `/work/git/libguestfs/gobject'
Thanks
-Wanlong Gao
12 years, 11 months
plug leaks in febootstrap
by Jim Meyering
Hi Rich,
I ran coverity against febootstrap's head and it spotted four leaks.
This fixes them. The first patch plugs three.
The second attempts to make the add_link function do what I'm
guessing it was intended to do. As is, it was a no-op.
>From 7c2ff55613598a1295e213cef36600ad61da7ed6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 10 Jan 2012 16:55:49 +0100
Subject: [PATCH 1/2] helper: plug three small leaks
* helper/ext2initrd.c (read_module_deps): Don't leak filename.
(ext2_make_initrd): Don't leak "outfile".
* helper/utils.c (load_file): Don't leak a file pointer.
---
helper/ext2initrd.c | 4 +++-
helper/utils.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/helper/ext2initrd.c b/helper/ext2initrd.c
index dedc1e8..8b64e0f 100644
--- a/helper/ext2initrd.c
+++ b/helper/ext2initrd.c
@@ -1,5 +1,5 @@
/* febootstrap-supermin-helper reimplementation in C.
- * Copyright (C) 2009-2011 Red Hat Inc.
+ * Copyright (C) 2009-2012 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
@@ -115,6 +115,7 @@ ext2_make_initrd (const char *modpath, const char *initrd)
FILE *f = fopen (outfile, "w");
if (f == NULL)
error (EXIT_FAILURE, errno, "failed to create modules list (%s)", outfile);
+ free (outfile);
FILE *pp = popen (cmd, "w");
if (pp == NULL)
error (EXIT_FAILURE, errno, "failed to create pipe (%s)", cmd);
@@ -175,6 +176,7 @@ read_module_deps (const char *modpath)
char *filename = xasprintf ("%s/modules.dep", modpath);
FILE *fp = fopen (filename, "r");
+ free (filename);
if (fp == NULL)
error (EXIT_FAILURE, errno, "open: %s/modules.dep", modpath);
diff --git a/helper/utils.c b/helper/utils.c
index 81b300a..3308c3c 100644
--- a/helper/utils.c
+++ b/helper/utils.c
@@ -1,5 +1,5 @@
/* febootstrap-supermin-helper reimplementation in C.
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2010, 2012 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
@@ -306,6 +306,7 @@ load_file (const char *filename)
line[len-1] = '\0';
add_string (&lines, &n_used, &n_alloc, line);
}
+ fclose (fp);
add_string (&lines, &n_used, &n_alloc, NULL);
return lines;
--
1.7.9.rc0.13.gbee72
>From f03d46334bb318fad7a7b71900d6a3c11586b68f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 10 Jan 2012 17:04:52 +0100
Subject: [PATCH 2/2] helper: fix no-op add_link function
* helper/ext2cpio.c (add_link): Don't leak just-allocated buffer.
Instead, link it into links_head list.
---
helper/ext2cpio.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/helper/ext2cpio.c b/helper/ext2cpio.c
index 2e8258f..82cc3b4 100644
--- a/helper/ext2cpio.c
+++ b/helper/ext2cpio.c
@@ -1,5 +1,5 @@
/* febootstrap-supermin-helper reimplementation in C.
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2010, 2012 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
@@ -348,6 +348,8 @@ add_link (ext2_ino_t real_ino)
p->minor = dev_minor;
p->major = dev_major;
p->real_ino = real_ino;
+ p->next = links_head;
+ links_head = p;
}
static void
--
1.7.9.rc0.13.gbee72
12 years, 11 months