Commit Graph

2660 Commits

Author SHA1 Message Date
Dan Nicholson 512090785e deltas: Allow processing of empty delta parts
If a static delta is generated between 2 commits with the same content,
then the delta will contain 1 part with no checksums. While useless,
this is a valid delta that shouldn't raise an assertion. If the delta
part has no checksums, then there are no objects to recreate and the
processing can be skipped.

Closes: #420
Approved by: cgwalters
2016-07-31 00:01:52 +00:00
Giuseppe Scrivano edecae06ab libostree, ostree: fix usage of ostree_repo_checkout_tree_at
it was deprecated, use ostree_repo_checkout_at.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #417
Approved by: cgwalters
2016-07-30 11:24:52 +00:00
Giuseppe Scrivano 0bac88e132 libostree: skip introspection for two functions
These two functions are not safe for gobject introspection, so annotate
them to be skipped:

1) ostree_repo_import_archive_to_mtree
2) ostree_repo_export_tree_to_archive

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #417
Approved by: cgwalters
2016-07-30 11:24:52 +00:00
Giuseppe Scrivano 8867693240 libostree: mark ostree_repo_checkout_tree_at as deprecated
and move its definition to a separate file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #417
Approved by: cgwalters
2016-07-30 11:24:52 +00:00
Giuseppe Scrivano 30963766c7 libostree: new function ostree_repo_checkout_at
Provide a gobject introspection safe version for
`ostree_repo_checkout_tree_at'.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #417
Approved by: cgwalters
2016-07-30 11:24:52 +00:00
Colin Walters 6d310db1e7 libglnx porting: Migrate to new tempfile code
In general this is even cleaner now, though it was better after I
extracted a helper function for the "write tempfile with contents"
bits that were shared between metadata and regular file codepaths.

Closes: #369
Approved by: jlebon
2016-07-29 19:02:41 +00:00
Jonathan Lebon 1db0c8dcd6 static-delta: remove unused struct
Closes: #418
Approved by: cgwalters
2016-07-29 16:38:19 +00:00
Jonathan Lebon e9f08d45f7 static-delta: fix command contexts
Closes: #418
Approved by: cgwalters
2016-07-29 16:38:19 +00:00
Colin Walters 6ffcb24d22 deltas: Handle untrusted checksums faster and more robustly
When reworking the ostree core [to use O_TMPFILE](https://github.com/ostreedev/ostree/pull/369),
I hit an issue in the way the untrusted delta codepath ends up trying
to re-open the file to checksum it.  That's not possible with
`O_TMPFILE` since the fd (which we opened `O_WRONLY`) is the only
accessible reference to the content.

Fix this by changing the delta processing code to update a checksum as
we're doing writes, which is also faster, and ends up simplifying the
code as well.

What would be an even larger simplification here is if we e.g. used a
separate thread calling `write_object()` or something like that; the
main issue I see there is somehow bridging the fact that function
wants a `GInputStream*` but the delta code is generating stream of
writes.

Closes: #392
Approved by: jlebon
2016-07-29 16:03:28 +00:00
Colin Walters fb0bf27d10 tests/delta-crosscheck: Add missing --from
Otherwise we generate a static delta from the *previous* and get
confused.  To make doubly sure, add `--require-static-deltas` to pull.

Closes: #416
Approved by: jlebon
2016-07-29 14:30:42 +00:00
Colin Walters fc25fa16e1 lib: Fix compiler warning from previous patch
I had this in a `fixup!` I thought.

Closes: #414
Approved by: giuseppe
2016-07-28 14:46:17 +00:00
Colin Walters a38f2f41b2 lib: Fix leak in bootconfig parser
Pretty simple.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 27559c58a9 deploy: Fix leaks in parsing /etc/os-release
This one is a bit subtle; we're generating a hash that contains
pointers to the strings we parsed, so we need to carefully track
ownership.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 707ef93097 sysroot: Fix a leak in deployment dirpath API
This one is pretty obvious in retrospect.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 402020b4ca glib.supp: Suppress g_task -> thread leaks
There are variants of this, but right now because `GTask` has its
own pool which isn't necessarily cleaned up on exit, we need
to suppress all of this.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters ba21023d6c fetcher: Explicitly join thread if it's not self
This fixes a valgrind leak; see [this StackOverflow thread](http://stackoverflow.com/questions/17642433/why-pthread-causes-a-memory-leak).

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 544365f834 glib.supp: Suppress worker context -> thread bits
The worker context isn't cleaned up now.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 35008ead77 pull-local: Explicitly unref variant rather than relying on floating
This shows up as a leak in valgrind; the callee isn't sinking.  In
general through the power of cleanup attributes we can do explicit
cleanup rather than relying on floating refs.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters d13cf37b3f glib.supp: Suppress some dynamic type registrations too
These mirror the static ones, and we need the dynamic versions for
glib-networking -> gnutls stuff.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters 7f335a8437 trivial-httpd: Fix leak of option context
Right now our valgrind runs also end up valgrinding the
`trivial-httpd` code, so while it doesn't matter, let's fix this leak
anyways.  We need to avoid calling `_exit()` since that won't run the
cleanup functions.

Closes: #410
Approved by: giuseppe
2016-07-28 10:10:17 +00:00
Colin Walters bac1fa1839 pull: Don't execute static deltas when mirroring
We don't presently support this, since the static delta code assumes
it can just `mmap()` file objects.  We could at some point implement
this, but for now just skip executing deltas when doing
`archive -> archive` mirroring.

I noticed this when trying to mirror a repo in Jenkins in
[CAHC](https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel).

Closes: #408
Approved by: giuseppe
2016-07-25 06:50:51 +00:00
Colin Walters a6aeacede6 repo: Fix leak with ostree_repo_commit_traverse_iter_init_commit()
I noticed this using `OT_TEST_VALGRIND=1` on `test-basic.sh`.

Closes: #385
Approved by: jlebon
2016-07-22 14:01:07 +00:00
Jonathan Lebon f3cbe86117 libglnx: bump to latest
OSTree can sometimes print very long lines which lead to many empty
spaces getting printed if the output overflowed the line due to a bug in
libglnx.

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>

Closes: #406
Approved by: cgwalters
2016-07-22 13:44:19 +00:00
Colin Walters d49d42b983 docs/formats: Elaborate a bit on delta from NULL usage
See discussion on ostree-list.

Closes: #402
Approved by: gatispaeglis
2016-07-19 17:44:32 +00:00
Colin Walters 29451a3999 build: Make symlink depend on source
Closes: https://github.com/ostreedev/ostree/issues/389

Closes: #400
Approved by: smcv
2016-07-16 20:38:48 +00:00
Dan Nicholson db974b0596 core: Add allocating b64 checksum functions
The checksum_b64_inplace variants can't be used in bindings. Provide
versions that allocate and return the output rather than working on a
passed in buffer. These can then be used in GI bindings to get the
ostree modified base64 encodings.

Closes: #398
Approved by: cgwalters
2016-07-15 02:18:27 +00:00
Dan Nicholson 2e97e72123 lib: Fix version script node ordering
The order of the VERSION nodes is such that the new node name goes first
and the one it depends on goes after the commands. See
https://sourceware.org/binutils/docs/ld/VERSION.html.

Closes: #398
Approved by: cgwalters
2016-07-15 02:18:27 +00:00
Matthew Leeds 203c0c88db README: Fix broken link
Closes: #397
Approved by: cgwalters
2016-07-14 20:32:41 +00:00
Giuseppe Scrivano 307f4b2957 Makefile-tests.am: make check uses the built binaries
The tests suite was failing locally as it was using the installed
version of rofiles-fuse, instead of the built one.  Create the needed
symlinks in tests/ as we are already doing for the "ostree" binary.

ostree-prepare-root and ostree-remount added for completeness.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #395
Approved by: cgwalters
2016-07-14 13:26:48 +00:00
Colin Walters efa1fa6534 builtins/commit: Switch to using ostree_repo_write_dfd_to_mtree()
Where we're referencing local files.  It's what
ostree_repo_write_directory_to_mtree() is doing internally anyways,
and I consider the `GFile*` based APIs to be generally deprecated for
the most part.

Closes: #394
Approved by: giuseppe
2016-07-14 08:08:53 +00:00
Colin Walters f45eca948c repo: Ensure we set mode for bare-user files before xattrs
When trying to switch ostree to `O_TMPFILE`, I hit the fact that
by default it uses mode `000`.  It still works to write to the
open fd of course, but it *doesn't* work to set xattrs because
that code path for some reason in the kernel checks the mode bits.

This only broke for bare-user repos where we tried to set the xattr
before calling `fchmod()`, so just invert those two operations.

Closes: #391
Approved by: jlebon
2016-07-12 14:09:37 +00:00
Colin Walters 87c9e227cb Revert "tests/libtest.sh: Print non-matching file on failure"
This reverts commit 71301d1824.

I was confused by the fact that the non-matching content was
empty and forgot we already did print it.

Reported-by: smcv

Closes: #390
Approved by: jlebon
2016-07-11 19:30:31 +00:00
Colin Walters 35b4131bd7 tests: Fix karg tests on ostree-booted system
https://github.com/ostreedev/ostree/pull/372 caused these tests to
start failing when the host system is managed using ostree - since the
tests *do* replace the `ostree=` kernel argument.

Closes: #384
Approved by: cgwalters
2016-07-11 16:46:07 +00:00
Dan Nicholson 4ebcd57fec repo: Fix annotation for ostree_repo_add_gpg_signature_summary
GI needs to know this is a NULL terminated array of gchar or you'll
segfault using it from a binding.

Closes: #387
Approved by: cgwalters
2016-07-08 22:22:28 +00:00
Colin Walters c31cf75552 Release 2016.7
Closes: #386
Approved by: jlebon
2016-07-08 19:40:55 +00:00
Colin Walters 972ed3e54e fetcher: Remove unused GTask structure member
Spotted by mbarnes.

Closes: #383
Approved by: mbarnes
2016-07-08 18:38:11 +00:00
Colin Walters 5d21650ea5 fetcher: Clear all data for session in session thread
Conceptually the session thread owns the session, so let's clear out
everything predictably there, rather than sometimes having it happen
on the main thread.

Also, this moves up clearing the pending/outstanding queues *before*
we unreference the session, since conceptually they need to reference
it as well.

Based on a patch from: Matthew Barnes <mbarnes@redhat.com>

Closes: #383
Approved by: mbarnes
2016-07-08 18:38:11 +00:00
Colin Walters b4c15209e8 fetcher: Hold a ref to main context for lifetime of thread
I don't think this fixes the bug I was seeing, but it makes me more
comfortable to know we have a strong ref to the main context across
the thread lifetime, and we only unset the default right before
we go away.

If something in `thread_closure_unref()` used
`g_main_context_get_thread_default()` for example it'd be wrong
before.

Closes: #383
Approved by: mbarnes
2016-07-08 18:38:11 +00:00
Colin Walters d7629d33a4 tests: Add some test coverage of repeated pulls w/HTTP 500s
Systems like pulp may want to keep retrying in a loop if the server
throws a (hopefully transient) 500, and we need test coverage of
handling these errors versus our existing 404 and 206 coverage.

Closes: #383
Approved by: mbarnes
2016-07-08 18:38:11 +00:00
Colin Walters 71301d1824 tests/libtest.sh: Print non-matching file on failure
We clean up the temporary directory on failure, which means it's hard
to know *why* a regex didn't match.  Print it when we hit an error.

Closes: #383
Approved by: mbarnes
2016-07-08 18:38:11 +00:00
Mathnerd314 b0bfb92831 pull: Free fetch_data by default
This should fix the memory leaks in #352

This is a subset of the changes, the other part is in my pull code rewrite

Closes: #382
Approved by: cgwalters
2016-07-06 20:57:40 +00:00
Jonathan Lebon d371aec217 static-delta-core.c: squash unused var warning
Closes: #379
Approved by: cgwalters
2016-07-05 00:34:33 +00:00
Bastien Nocera 9df846559a libostree: Fix build failure with glib 2.42
G_DEFINE_AUTOPTR_CLEANUP_FUNC is a new function in GLib 2.44, but
libglnx contains a backported version of it. A few source files were
however using G_DEFINE_AUTOPTR_CLEANUP_FUNC either without including
libglnx.h, or without including it early enough.

This fix is similar to the one in commit d368624.

Closes #376

Closes: #377
Approved by: smcv
2016-07-04 15:25:20 +00:00
Colin Walters cbca341a77 docs: Add a section on Docker
This could have a lot more obviously, but just laying down my thoughts
as a starting point.

Closes: #374
Approved by: jlebon
2016-07-04 13:38:25 +00:00
Colin Walters 0d07c7ecde delta: Add --if-not-exists option
I often want to have "idempotent" systems that iterate to a known
state.  If after generating a commit, the system is interrupted, I'd
like the next run to still generate a delta.  But we don't want to
regenerate if one exists, hence this option.

Closes: #375
Approved by: jlebon
2016-07-04 13:27:06 +00:00
Dan Nicholson 8933c93a55 build: Override systemd unit directory for distcheck
distcheck tests that all the files are installed under $prefix. That
doesn't work with the systemd unit directory since the path comes from
pkg-config. Override the setting to be under $prefix in that case.

Closes: #372
Approved by: cgwalters
2016-06-27 20:20:21 +00:00
Dan Nicholson a94530111a tests: Improve check for /proc/cmdline kargs
On some systems there may be no root= argument, so the tests for
appending /proc/cmdline arguments will fail. Instead, loop over each of
the arguments in the host's /proc/cmdline and test that they're in the
constructed config file. That will actually test if ostree added all of
the system's /proc/cmdline args correctly. The regex isn't perfect here,
but it's probably good enough for this test.

Closes: #372
Approved by: cgwalters
2016-06-27 20:20:21 +00:00
Dan Nicholson 99a76c9b34 tests: Remove extra $CMD_PREFIX from test-auto-summary.sh
$OSTREE already has $CMD_PREFIX in it, so adding it again causes you to
call env twice with LD_PRELOAD.

Closes: #372
Approved by: cgwalters
2016-06-27 20:20:21 +00:00
Dan Nicholson 6162fde4f1 build: Distribute libglnx and bsdiff Makefile templates
In order to re-run autogen.sh from the tarball, the libglnx and bsdiff
Makefile templates need to be provided.

Closes: #372
Approved by: cgwalters
2016-06-27 20:20:21 +00:00
Dan Nicholson 8b397301c4 tests: Ensure mutable deployments from libostreetest
When creating sysroots with libostreetest, we don't get the benefit of
the OSTREE_SYSROOT_DEBUG setting in libtest.sh. That means we'll get
immutable deployments that can't be easily cleaned up.

Ensure the environment variable is set before creating new sysroots. It
would be nice to set the debug flags directly, but that's private API
that isn't currently pulled into libostreetest.

Closes: #372
Approved by: cgwalters
2016-06-27 20:20:21 +00:00