5477 Commits

Author SHA1 Message Date
Jonathan Lebon
a588295d3a
Merge pull request #2534 from jlebon/pr/copr 2022-02-03 15:36:50 -05:00
Jonathan Lebon
1e663baad7 Add COPR integration Makefile
I'd like to enable auto-builds of this repo to
https://copr.fedorainfracloud.org/coprs/g/CoreOS/continuous/ so it could
eventually feed into
https://github.com/coreos/fedora-coreos-tracker/issues/910.
2022-02-03 13:34:20 -05:00
Jonathan Lebon
a51ae1ed73 ci/make-git-snapshot.sh: xz the archive
This matches `make dist` and what the spec file expects.
2022-02-03 13:23:43 -05:00
Jonathan Lebon
92c396c82b ci/make-git-snapshot.sh: auto-initialize submodules
Matches `autogen.sh`.
2022-02-03 13:22:47 -05:00
Jonathan Lebon
8d45298a2d ci/make-git-snapshot.sh: fix archive name
The archive name is libostree even though the project name is ostree, so
we can't rely on the directory name.

Just hardcode it.
2022-02-03 13:21:54 -05:00
Jonathan Lebon
8e445cb957 ci/libbuild.sh: drop yum/CentOS support
`dnf` is present in all the platforms we care about now, and the CentOS
bit is out of date. We can re-add it if we add e.g. C[89]S support with
the updated list of packages.

Motivated by noticing that the `yum` symlink isn't always present.
2022-02-03 13:17:56 -05:00
Jonathan Lebon
2de6abfcd0
Merge pull request #2533 from lucab/ups/commit-cleanup-assertions 2022-02-01 13:57:00 -05:00
Luca BRUNO
e6e9f14985
lib/commit: clean up assertions
This aligns all the assertion in the module. In particular, it gets
rid of all `g_return_val_if_fail` instances which may fail without
properly setting GError to the caller.
2022-02-01 17:33:28 +00:00
Colin Walters
a10669dc4a
Merge pull request #2530 from smcv/update-libglnx-2525
Update libglnx submodule
2022-01-29 10:19:24 -05:00
Simon McVittie
0ebf9d9f64 Update submodule: libglnx
Resolves: https://gitlab.gnome.org/GNOME/libglnx/-/issues/3
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-01-28 14:53:28 +00:00
Colin Walters
2903ffac60
Merge pull request #2529 from smcv/static-delta-error-unwind
libotutil: Avoid infinite recursion during error unwinding
2022-01-28 09:22:27 -05:00
Simon McVittie
920f85cabc libotutil: Avoid infinite recursion during error unwinding
When we clean up from an error, for example copy_file_range() failing
while we generate a static delta (perhaps caused by
https://gitlab.gnome.org/GNOME/libglnx/-/issues/3 or by a
genuine write error), we might free a variant builder that has a
non-null parent. Previously, this caused infinite recursion and a stack
overflow, repeatedly freeing the same object, but Luca Bruno suggested
that the intention here appears to have been to free the parent object.

Partially resolves https://github.com/ostreedev/ostree/issues/2525
(the other bug reported in that issue needs to be resolved by updating
libglnx to a version where libglnx#3 has been fixed).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-01-28 11:08:00 +00:00
Luca Bruno
10ddf6e25f
Merge pull request #2524 from jlebon/pr/unlink-lock
lib/deploy: When deleting staged deployment, delete any lock
2022-01-26 08:36:45 +00:00
Jonathan Lebon
5bf57ec062 tests/kolainst: Avoid recursive symlinks
`kola` now follows symlinks when archiving an external test's `data/`
dir. So the recursive `data` symlink we have here breaks it.

Let's just move the shared files in its own directory and update the
symlinks.
2022-01-25 16:44:39 -05:00
Colin Walters
bcc7f62ed7
Merge pull request #2526 from lucab/ups/openat-load-xattrs
lib/repo: open file only if required
2022-01-25 05:59:58 -05:00
Luca BRUNO
b27792ade3
lib/repo: open file only if required
This tightens up the logic for opening a file while inspecting its
xattrs. The only codepath fetching xattrs from a FD is the one
handling 'bare' mode.
It also rearranges the else-assert flow, mostly for future-proofing.
2022-01-24 16:54:54 +00:00
Jonathan Lebon
baf838de22 ostree/deploy: Test finalization locking
Support for that file was added previously, but the testing lived in
rpm-ostree only. Let's add it here too.

In the process add a hidden `--lock-finalization` to `ostree admin
deploy` to make testing easier (though it could also be useful to update
managers driving OSTree via the CLI).
2022-01-21 13:48:35 -05:00
Jonathan Lebon
88dca03967 lib/deploy: When deleting staged deployment, delete any lock
Otherwise, any future staged deployment will also automatically be
locked even if not requested. Likely we should fold the locking into the
primary `staged-deployment` serialized GVariant instead.
2022-01-21 11:30:23 -05:00
Joseph Marrero Corchado
0713ad3259
Merge pull request #2523 from lucab/ups/ls-gcancellable-gerror
builtin: use GCancellable and GError everywhere
2022-01-21 08:30:00 -05:00
Luca BRUNO
3f491a60c3
builtin: use GCancellable and GError everywhere
This reworks `ostree ls` top-level logic so that cancellation
tokens and error details are plumbed through all codepaths.
It also gets rid of all previous goto jumps.
2022-01-21 12:26:32 +00:00
Luca Bruno
b9f6632b70
Merge pull request #2521 from cgwalters/syncfs-only-log
deploy: Also log to journal if we time out global sync()
2022-01-20 16:58:05 +00:00
Colin Walters
8c58195cc4 deploy: Also log to journal if we time out global sync()
We do implicitly have this data because we log timings via structured
metadata in a later journal entry, but it's quite common to lose
the structured metadata because a lot of tooling just grabs the default
syslog-compatible text from `journalctl`.

Let's be louder when we hit this case as a general rule too; I think
most people shipping ostree systems want to see if it's happening.
2022-01-20 10:52:04 -05:00
Colin Walters
51361f62af
Merge pull request #2520 from lucab/ups/builtin-commit-reject-empty-metadata
lib/commit: reject empty metadata keys
2022-01-20 09:04:34 -05:00
Luca BRUNO
da72c245f4
lib/commit: reject empty metadata keys
This adds one more check to the metadata validation logic in order
to reject empty metadata keys.
2022-01-20 10:54:30 +00:00
Luca BRUNO
6230b3eeab
lib/commit: always validate metadata
This tweaks commit logic in order to always validate metadata,
including on commits where the expected checksum is already known.
2022-01-19 14:10:24 +00:00
Colin Walters
a05b02fa9c
Merge pull request #2519 from cgwalters/syncfs-only
deploy: Add a 5s max timeout on global filesystem `sync()`
2022-01-18 12:39:32 -05:00
Colin Walters
cb73129483 deploy: Add a 5s max timeout on global filesystem sync()
https://bugzilla.redhat.com/show_bug.cgi?id=2003532

Basically there's a systemd bug where it's losing the `_netdev`
aspect of Ceph filesystem mounts.  This means the network is taken
down before Ceph is unmounted.  In turn, our invocation of `sync()`
blocks on Ceph, which won't succeed.

And this in turn manifests as a failure to transition to the new
deployment.

I initially did this patch to just rip out the global `sync()`.  I
am pretty sure we don't need it anymore.  We've been doing individual
`syncfs()` on `/sysroot` and `/boot` for a while now, and those
are the only filesystems we should be touching.  But *proving* that
is a whole other thing of course.

To be conservative, let's instead just add a timeout of 5s on
our invocation of `sync()`.  It doesn't return any information on
success/error anyways.

To allow testing without the `sync()` invocation, we also support
a new `OSTREE_SYSROOT_OPT_SKIP_SYNC=1` environment variable.  For
staged deployments, this needs to be injected via e.g. systemd unit
overrides into `ostree-finalize-staged.service`.

Implementing this is a bit hairy - we need to spawn a thread.  I
debated blocking in arecursive mainloop, but I think `g_cond_wait_until()`
is also fine here.
2022-01-18 09:19:20 -05:00
Colin Walters
0095f7c472
Merge pull request #2517 from dbnicholson/ubuntu-seccomp
github: Workaround glib/seccomp issue on Ubuntu impish
2022-01-13 09:50:19 -05:00
Dan Nicholson
de1870df8c github: Workaround glib/seccomp issue on Ubuntu impish
The ubuntu-latest VMs are currently based on 20.04 (focal). In focal,
libseccomp2 doesn't know about the close_range syscall[1], but
g_spawn_sync in impish tries to use close_range since it's defined in
glibc. That causes libseccomp2 to return EPERM as it does for any
unknown syscalls. g_spawn_sync carries on silently instead of falling
back to other means of setting CLOEXEC on open FDs. Eventually it causes
some tests to hang since once side of a pipe is never closed. Remove
this when libseccomp2 in focal is updated or glib in impish handles the
EPERM better.

1. https://bugs.launchpad.net/ubuntu/+source/libseccomp/+bug/1944436

Fixes: #2495
2022-01-12 21:59:23 -07:00
Jonathan Lebon
1af0150750
Merge pull request #2516 from cgwalters/define-ostree-booted 2022-01-12 13:39:59 -05:00
Colin Walters
0ff4bee743 sysroot: Add a public #define OSTREE_PATH_BOOTED
This is public API.  Motivated by
https://github.com/coreos/rpm-ostree/pull/3325/files#diff-56528694f6f3213d6fb88d872f77291412dceec263b57166519843b13eca9a4dR30
2022-01-12 12:47:11 -05:00
Colin Walters
8aeceb9b88
Merge pull request #2514 from lucab/ups/drop-setenv
libostree/sepolicy: get rid of a g_setenv() call
2022-01-12 06:51:14 -05:00
Joseph Marrero Corchado
6567d82525
Merge pull request #2515 from cgwalters/cliwrap-lib
main: Also support CLI extensions in `/usr/libexec/libostree/ext`
2022-01-11 21:01:20 -05:00
Colin Walters
998154f8ff main: Also support CLI extensions in /usr/libexec/libostree/ext
In fixing https://github.com/coreos/rpm-ostree/pull/3323
I felt that it was a bit ugly we're installing `/usr/bin/ostree-container`.

It's kind of an implementation detail.  We want users to use
`ostree container`.

Let's support values outside of $PATH too.

For example, this also ensures that TAB completion for `ost` expands
to `ostree ` with a space.
2022-01-11 20:13:33 -05:00
Luca BRUNO
840cd7ab2d
libostree/sepolicy: get rid of a g_setenv() call
This removes a 'g_setenv()' call, which could potentially be unsafe
in a multi-thread context.
The current libselinux codebase does not seem to check for
`LIBSELINUX_DISABLE_PCRE_PRECOMPILED`, so I think this has no effects
nowadays.
Additionally, I could not find any reference to it in libselinux
git history, so I'm not sure if it ever played any role at all.

My current understanding is that this is coming from version
incompatibilities between an older libselinux in the build environment
and a newer policy (with precompiled regexs) in the target.
But from the ML discussion I found, I think it eventually got
solved in a different way, possibly by avoiding the policy binary
caches.

Refs:
 * https://www.spinics.net/lists/selinux/msg14822.html
 * https://github.com/ostreedev/ostree/pull/2513#discussion_r781042884
2022-01-11 15:56:13 +00:00
Luca Bruno
7cc8481907
Merge pull request #2513 from lucab/ups/setenv-error
ostree: check g_setenv return value
2022-01-10 17:38:50 +00:00
Luca BRUNO
0bdba574d7
ostree: check g_setenv return value
This adds proper return-value checks on g_setenv calls.
It fixes a static analysis warning highlighted by Coverity.
2022-01-10 13:33:36 +00:00
Luca Bruno
92025018f6
Merge pull request #2512 from lucab/ups/variant-builder-error-memleak
libotutil: avoid leaking builder memory on error
2022-01-10 13:32:25 +00:00
Luca BRUNO
0b1a085692
libotutil: avoid leaking builder memory on error
This swaps the order of a couple of input sanity checks, in order
to fix a minor memory leak due to an early-return on the error
path.
Memory for the result is now allocated only after input has been
sanity-checked.
It fixes a static analysis warning highlighted by Coverity.
2022-01-10 09:30:11 +00:00
Luca Bruno
6cb097fb5e
Merge pull request #2509 from ostreedev/release-2022.1
Release 2022.1
2022-01-05 14:32:55 +00:00
Luca BRUNO
9d3ef89230
configure: post-release version bump 2022-01-05 10:03:59 +00:00
Luca BRUNO
6c903ab0b6
Release 2022.1 v2022.1 2022-01-05 10:03:03 +00:00
Dan Nicholson
8e3323fa2f
Merge pull request #2506 from lucab/ups/dependabot-config
github: add dependabot config
2022-01-04 06:17:08 -07:00
Luca BRUNO
2bfdcea2c5
github: add dependabot config
This adds a configuration file for dependabot, taking care of automatic
updates for all git submodules.
2022-01-04 10:34:30 +00:00
Luca Bruno
a3555f4d12
Merge pull request #2376 from smcv/fuse3
rofiles-fuse: Build using FUSE 3 if possible, falling back to FUSE 2
2022-01-04 10:27:14 +00:00
Simon McVittie
43859b58f6
rofiles-fuse: Build using FUSE 3 if possible, falling back to FUSE 2
This adds build-time configuration logic to automatically detect
and switch between libfuse 2.x and 3.x.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Luca BRUNO <luca.bruno@coreos.com>
2022-01-04 09:41:38 +00:00
Colin Walters
4d47733f98
Merge pull request #2505 from lucab/ups/bsdiff-error-throw
lib/static-delta: throw a proper error on bspatch failure
2022-01-03 16:57:52 -05:00
Colin Walters
371c2f12a6
Merge pull request #2504 from lucab/ups/bsdiff-CVE-2014-9862
bsdiff: bump submodule, pick up fix for CVE-2014-9862
2022-01-03 13:20:55 -05:00
Luca BRUNO
eae35b7f6e
lib/static-delta: throw a proper error on bspatch failure
This makes sure that a populated GError is returned when bsdiff
patching fails. The human-friendly label also helps in debugging.
2022-01-03 17:38:51 +00:00
Luca BRUNO
97399c166d
bsdiff: bump submodule, pick up fix for CVE-2014-9862
This updates the bsdiff submodule to latest upstream revision, in
order to pick up additional bound checks for CVE-2014-9862.

Update submodule: bsdiff
Ref:
 * https://www.x41-dsec.de/lab/advisories/x41-2020-006-bspatch/
2022-01-03 16:13:01 +00:00