Update the system at the end of the installation, so the generated image
is up-to-date. This also removes the need to manually update dnf on
i686 and x86_64.
GCC has two warnings related to large stack frames. We were already
using the -Wframe-larger-than warning, but this reduces the threshold
from 10000 to 5000 bytes.
However that warning only covers the static part of frames (not
alloca). So this change also enables -Wstack-usage=10000 which covers
both the static and dynamic usage (alloca and variable length arrays).
Multiple changes are made throughout the code to reduce frames to fit
within these new limits.
Note that stack allocation of large strings can be a security issue.
For example, we had code like:
size_t len = strlen (fs->windows_systemroot) + 64;
char software[len];
snprintf (software, len, "%s/system32/config/software",
fs->windows_systemroot);
where fs->windows_systemroot is guest controlled. It's not clear what
the effects might be of allowing the guest to allocate potentially
very large stack frames, but at best it allows the guest to cause
libguestfs to segfault. It turns out we are very lucky that
fs->windows_systemroot cannot be set arbitrarily large (see checks in
is_systemroot).
This commit changes those to large heap allocations instead.
Introduce and use a new inspect_mount_root function to mount all the
mountpoints of a root in the guest, replacing the same code doing that
in different tools.
inspect_mount_root_ro is inspect_mount_root with readonly mount option.
Allow the user to specify a template in --list mode, which will be the
only result in the resulting output (instead of all the available
templates).
This makes it easier to find out the details of a specific template.
Require qemu >= 1.3.0, the first version that supported
`qemu-img --output=json'.
This means we require yajl (for parsing the JSON output of qemu-img),
and that in turn has consequences elsewhere.
If uncompressing a template to a filesystem which is nearly full,
virt-builder displays an error which points to the wrong (source) file:
$ virt-builder fedora-22
[ 1.2] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[ 1.7] Planning how to build this image
[ 1.7] Uncompressing
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
/home/rjones/.cache/virt-builder/fedora-22.x86_64.1: No space left on device
(The error message is usually printed once by each thread, so it is
printed several times.)
Change the error message to point to the output file, which might be a
temporary or the final file depending on the build plan:
$ virt-builder fedora-22
[ 1.1] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[ 1.6] Planning how to build this image
[ 1.6] Uncompressing
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
fedora-22.img: No space left on device
Instead of creating Guestfs handles and manually apply common options
(e.g. debug and trace), use the open_guestfs in Common_utils.
This also applies the common options to handles which didn't set them
before, so we can inspect also their messages if needed.
Various tests cannot be run in parallel just because they happen to
use conflicting names for temporary output files (eg. "test.out").
Change these tests to use unique temporary names, so the tests could
be run in parallel.
Remove man pages and other pages which 'make clean' did not remove
before.
To evaluate which pages could be removed, I did a full build and
check, and then ran 'make clean' followed by 'git clean -xdf'. By
examining the output of the git clean command I could see which files
were being missed.
Files that are _not_ removed by make clean or make distclean:
- generator-built files
- Makefile, Makefile.in, .deps, .depend
- any ./configure output files (maybe they should be?)
Move the random set of HTML files we build from html/ into
the website/ directory.
Also in the website/ directory, put the index.html file from
http://libguestfs.org, which was previously not under version control.
It is generated from index.html.in so we can automatically add the
current version and release date.
Also in the website/ directory, put various CSS file, images, etc.
which are required by the website and were also previously not under
version control.
Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.
There are actually several new subdirectories created:
test-data/binaries: The pre-built binary and library files for random
architectures that we use to test various architecture detection
features (was part of tests/data).
test-data/blank-disks: The blank disks which are used for disk format
detection (was part of tests/data).
test-data/files: Other miscellaneous test files from tests/data that
are not included in the above.
test-data/phony-guests: The phony guests (was tests/guests).
test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
This way, we can make sure that if a template needs to be expanded, the
result will have all the filesystems correctly expanded, fitting into
the new sizes of their partitions.
The error is:
ln -s xdg/virt-builder /tmp/p/etc/virt-builder
ln: failed to create symbolic link '/etc/virt-builder/virt-builder': File exists
There is no 'LN_SF' macro, but according to the documentation at
least, it should be safe to add a '-f' flag since it will work for
both the 'ln' and 'cp' variants of the macro.
This is just a straight refactoring. Various ad hoc string_*
functions that appeared in Common_utils have been renamed and placed
in the String.* namespace. The old vs "new" functions are:
string_prefix -> String.is_prefix
string_suffix -> String.is_suffix
string_find -> String.find
replace_str -> String.replace
string_nsplit -> String.nsplit
string_split -> String.split
string_lines_split -> String.lines_split
string_random8 -> String.random8
Because of previous automated commits, such as changing 'guestfs___'
-> 'guestfs_int_', several function calls no longer lined up with
their parameters, and some lines were too long.
The bulk of this commit was done using emacs batch mode and the
technique described here:
http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html
The changes suggested by emacs were then reviewed by hand.
Add a new "simplestreams" repository type, and a simple parser for
fetching and reading the JSON indexes of the Simple Streams v1.0
format.
Read only datatype=image-downloads contents, and only the latest
versions of each content available as disk image (disk.img or
disk1.img).
Add a simple test, using the "released" images from the CirrOS project.