Commit Graph
100 Commits
Author SHA1 Message Date
Colin Walters 23446a0218 Remove readdir-rand
This was only there to reproduce a bug we hit long ago
with bootloader file ordering.  We're extremely unlikely
to reintroduce such a bug, and it's not worth carrying around
this code.
2022-11-01 16:29:17 -04:00
Colin Walters ba94997e99 Merge pull request #2752 from smcv/copy-dirent
readdir-rand: Copy full size of struct dirent
2022-10-31 08:58:21 -04:00
Colin Walters 1258c371d6 Merge pull request #2742 from lucab/ups/rust-regenerate-2022.6
rust: regenerate bindings after latest release (2022.6)
2022-10-26 09:15:14 -04:00
Colin Walters 9672f88877 Merge pull request #2745 from lucab/ups/ci-bump-rust-linting
ci/rust: bump linting toolchain to latest stable (1.64)
2022-10-26 09:15:01 -04:00
Colin Walters aded044149 Merge pull request #2746 from lucab/ups/lib-repo-refs-error
lib/repo-refs: properly return an error value
2022-10-26 09:14:48 -04:00
Colin Walters 61d22e5db6 Merge pull request #2740 from lucab/ups/lib-sign-ed25519-assertions
lib/sign-ed25519: convert invariant checks to assertions
2022-10-26 06:33:04 -04:00
Colin Walters a19cc34883 Merge pull request #2663 from mstuehn/test-static-delta-file
lib/static-delta: document and check parameters format
2022-10-19 17:04:40 -04:00
Colin Walters b04dde8882 Merge pull request #2717 from mangelajo/support-whiteouts
Support overlayfs whiteouts on checkout
2022-09-28 08:35:24 -04:00
Colin Walters b83032d0d3 README.md: Link otto
Another project in the ostree/container space.
2022-09-28 08:30:18 -04:00
Colin Walters f442f02c15 Merge pull request #2718 from lucab/ups/repo-initialize-valid-bootloader
lib/repo: properly initialize boolean variable
2022-09-23 11:09:13 -04:00
Colin Walters 404fcc0206 Merge pull request #2716 from dbnicholson/max-metadata-size-doc
lib/pull: Fix max-metadata-size documentation
2022-09-18 15:04:54 -04:00
Colin Walters c6c3c5ae9f Merge pull request #2711 from lucab/ups/sign-assertions
lib/sign: convert invariant checks to assertions
2022-09-09 10:05:27 -04:00
Colin Walters 6873a2511b Merge pull request #2708 from nikita-dubrovskii/sh_to_c
s390x: drop shell code for `initrd` modification in SE case
2022-09-08 07:45:04 -04:00
Colin Walters 683e4eff08 finalize-staged: Don't listen to SIGTERM, just let kernel exit us
Followup from discussion in
https://github.com/ostreedev/ostree/pull/2544#discussion_r958840936

This is more efficient; no need to have the kernel context switch
us in at shutdown time just so we can turn around and call
`exit()`.
2022-08-30 17:50:03 -04:00
Colin Walters 6651b72a7a Merge pull request #2544 from dbnicholson/finalize-block
finalize-staged: Ensure /boot and /sysroot automounts don't expire
2022-08-30 15:12:32 -04:00
Colin Walters 06cd216f4e Merge pull request #2695 from HuijingHei/kargs-stage
Fix `ostree admin kargs edit-in-place` assertion when deployments are pending
2022-08-29 08:23:15 -04:00
Colin Walters 93a6d7bea2 Merge pull request #2701 from cgwalters/bind-list-commits
rust: Bind `ostree_repo_list_commits_starting_with`
2022-08-24 12:03:58 -04:00
Colin Walters b55054ec24 rust: Bind ostree_repo_list_commits_starting_with
I wanted to use this as a fallback for
https://github.com/ostreedev/ostree-rs-ext/pull/351/commits/30dee81c22ad5cb90e77198d3ddbcc25d388afb5
2022-08-24 09:44:34 -04:00
Colin Walters 21a8f39284 ci: Also drop seccomp on debian testing
I didn't deep dive into debugging this but I'm pretty sure it's
 https://gitlab.gnome.org/GNOME/glib/-/issues/2580
which is us having an older Docker in the middle here.
2022-08-22 17:00:09 -04:00
Colin Walters 629d2f5d7e rust: Update to latest git
In the future I may try to add CI that requires this to be
sync'd...
2022-08-22 15:11:51 -04:00
Colin Walters fb826346fe Merge pull request #2692 from GeorgesStavracas/gbsneto/transaction-leak
lib/commit: Unref repo on success
2022-08-22 14:25:07 -04:00
Colin Walters 1d478ced2e Merge pull request #2697 from tkfu/docs/add-related-projects
docs: Add aktualizr and TorizonCore to related projects
2022-08-19 10:53:56 -04:00
Colin WaltersandJonathan Lebon ad0354ac36 cli/rev-parse: Add --single option
In the current "ostree native container" flow, we're inserting
a commit object into the repo but with no refs.

We have hacks in a few places to find the commit digest via e.g.
`find repo/objects -name *.commit` but that's a horrible hack.
Add `ostree rev-parse --single` which will print the single commit,
and error out if there is not exactly one commit.

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
2022-08-18 11:08:17 -04:00
Colin Walters 090f312e40 cli/rev-parse: Port to new code style
Prep for future changes.
2022-08-16 17:11:30 -04:00
Colin Walters 9995f370d3 Merge pull request #2689 from jlebon/pr/ficlone-direct-payload
lib/commit: Directly use FICLONE for payload link
2022-08-15 18:33:55 -04:00
Colin Walters 4471c252a9 Merge pull request #2688 from LukasKalbertodt/main
Update to `libtest-mimic` 0.5.0
2022-08-13 14:02:07 -04:00
Colin Walters 0a908a180f Move FIFREEZE/FITHAW ioctl invocations into linuxfsutil.c
Should help avoid conflicts between glibc and linux headers.

Closes: https://github.com/ostreedev/ostree/issues/2685
2022-08-03 10:44:51 -04:00
Colin Walters edba4b33be Remove unused linux/fs.h includes
Prep for fixing conflicts introduced by newer glibc.
cc https://github.com/ostreedev/ostree/issues/2685
2022-08-03 10:37:40 -04:00
Colin Walters a83673f1a7 deny.toml: Add Unicode-DFS-2016
This is used by the unicode crate now and is definitely a compatible
FOSS license.
2022-08-01 14:43:31 -04:00
Colin Walters 459a4c2227 Merge pull request #2678 from cgwalters/release-2022-5
Release 2022 5
2022-07-22 16:11:20 -04:00
Colin Walters 55292e4007 rust-bindings: Fix cargo fmt 2022-07-22 15:20:05 -04:00
Colin Walters d7c25a2062 configure: post-release version bump 2022-07-22 15:20:05 -04:00
Colin Walters 15740d042c Release 2022.5 2022-07-22 15:08:25 -04:00
Colin Walters f50fe7008c Merge pull request from GHSA-gqf4-p3gv-g8vw
Fix sign ed25519 verify
2022-07-22 15:05:27 -04:00
Colin Walters 6200ec321f Merge pull request #2676 from render-se/debos-docs
add debos to readme distribution build tools
2022-07-15 14:24:25 -04:00
Colin Walters e0417957ea rust: Add a test case for ed25519
Specifically, I verified that *before* the previous patch to the
ed25519 C code, the last bit of code would fail with a SIGSEGV when
trying to read the empty signature.
2022-07-14 17:13:51 -04:00
Colin WaltersandDemi Marie Obenour 83e6357186 sign/ed25519: Verify signatures are minimum length
The ed25519 signature verification code does not
check that the signature is a minimum/correct length.
As a result, if the signature is too short, libsodium will end up
reading a few bytes out of bounds.

Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Co-authored-by: Demi Marie Obenour <demi@invisiblethingslab.com>

Closes: https://github.com/ostreedev/ostree/security/advisories/GHSA-gqf4-p3gv-g8vw
2022-07-14 17:13:51 -04:00
Colin Walters ed1146738b Merge pull request #2669 from HuijingHei/fix-kargs
Fix `ostree admin kargs edit-in-place` fails issue
2022-07-13 16:35:28 -04:00
Colin Walters a3749efb1a Merge pull request #2672 from cgwalters/initialize-sysroot-cleanups
sysroot: Have `ensure_writable` also always initialize
2022-07-13 16:35:17 -04:00
Colin Walters 035b290210 Merge pull request #2673 from cgwalters/assert-boot
sysroot: Add a few more assertions about `boot_fd`
2022-07-13 16:35:10 -04:00
Colin Walters 60853219d5 sysroot: Add a few more assertions about boot_fd
These places are all safe, but it would catch bugs in the future
more clearly to trip an assertion here.
2022-07-13 15:38:59 -04:00
Colin Walters 75aa7a22f6 sysroot: Have ensure_writable also always initialize
For historical reasons we have a fair bit of distinct sysroot
initialization going on.  A lot of code is calling *just* the new
`ensure_writable()` API, which does basically what you'd expect...
except if we're not using a mount namespace.

Which is the case in unit tests and legacy setups.
Change this API to also ensure the sysroot is fully initialized
even in those cases.  Specifically we'll have `self->sysroot_fd`.

For now, callers that need `/boot` also need to separately
call `_ensure_boot_fd()`.
2022-07-13 15:35:00 -04:00
Colin Walters 2c71655205 deploy: Ensure sysroot is initialized for kargs in place
Even without a mount namespace set up.
2022-07-13 15:32:05 -04:00
Colin Walters 7e7a3df99b Merge pull request #2671 from matthiasbeyer/readme-rust-bindings-fix
Fix link to rust bindings
2022-07-12 16:03:09 -04:00
Colin Walters 51ac63aa28 Merge pull request #2666 from saqibali-2k/pr/bls-append
ostree-repo: bls-append-except-default followup
2022-07-08 09:41:04 -04:00
Colin Walters d3762be9b3 deny: Sync with rpm-ostree
This extends the license set basically and ignores private repos
(which we don't have any yet).
2022-07-08 09:33:18 -04:00
Colin Walters c93fb71913 Merge pull request #2667 from cgwalters/deploy-require-repo
lib: Stop using old `ostree_sysroot_get_repo()` API
2022-07-06 17:13:23 -04:00
Colin Walters becc18936f lib: Stop using old ostree_sysroot_get_repo() API
It's falliable, and in one place we were actually ignoring
the error and leaving a `NULL` repo object which is just a trap
for people coming along later since it's rarely nullable.

Quite a while ago we switched to loading the repo at the same time
as the sysroot; convert callers in the library to use this infallible
accessor.

Prep for another patch which will use the repo object.
2022-07-06 07:47:57 -04:00
Colin Walters 0d911bf91f Merge pull request #2632 from saqibali-2k/pr/prune-commit-only
lib/prune: speed up pruning by retrieving only commits
2022-06-30 09:08:54 -04:00
Colin Walters e98988ba17 tests/inst: Port to cap-std
Part of an ongoing effort.
2022-06-24 16:23:05 -04:00
Colin Walters bba9724317 Merge pull request #2660 from cgwalters/fix-load-file-api
repo: Metadata return values from `load_file` are not nullable
2022-06-24 14:30:33 -04:00
Colin Walters 52d6f4e790 tests/staged-deploy.sh: Hack around cosa systemd unit check
https://github.com/coreos/coreos-assembler/pull/2921 broke this
test which is intentionally causing a systemd unit to fail.

As they say, necessity is the mother of invention.  They don't
say though that need always causes particularly *beautiful* things
to be invented...
2022-06-24 10:18:53 -04:00
Colin Walters be2075eef0 repo: Metadata return values from load_file are not nullable
The pattern this API uses in C is to allow the input parameters
pointer targets to be `NULL`, and it doesn't return values in that
case.

A further complexity here is that the API will still return `NULL`
for symbolic links.

But Rust can't express this pattern as is, so we were always
returning values but in `Option<T>` wrappers that the caller needed
to unwrap for the metadata.

(We really want an even more efficient API here that avoids the glib
 objects entirely, e.g. no reason not to pass directly back a type
 that lets Rust directly read from the fd for bare repos, but
 that can come later)
2022-06-23 17:43:42 -04:00
Colin Walters ee5b3c76c3 Merge pull request #2656 from cgwalters/bump-cap-std
rust: Bump semver to 0.15 && bump cap-std 0.25
2022-06-23 16:36:24 -04:00
Colin Walters 6fda7112c8 Merge pull request #2658 from jlebon/pr/pinger
tests/inst/destructive: stop disabling fedora-coreos-pinger
2022-06-23 16:35:49 -04:00
Colin Walters 63499747b9 Bump to cap-std 0.25 and io-lifetimes 0.7
Prep for bumping ostree-rs-ext, which will help bump rpm-ostree,
which will get it out of having two copies of rustix.
2022-06-23 14:59:03 -04:00
Colin Walters b87c8a8e23 rust: Bump semver to 0.15
Prep for some breaking changes.
2022-06-23 14:58:22 -04:00
Colin Walters 37d0ca41b6 Fix clippy lint in cap-std bits 2022-06-23 14:58:00 -04:00
Colin Walters 001839b35f ci/rust: Change MSRV to cargo check
No reason to codegen just to throw it away.  We could test here too,
but eh.
2022-06-23 14:45:16 -04:00
Colin Walters ed98a7904c ci/rust: Enable cap-std-apis in default build, add a no-feature build
Our CI was missing coverage of `cap-std-apis`.
2022-06-23 14:45:11 -04:00
Colin Walters 578a0c2507 Merge pull request #2639 from HuijingHei/admin-kargs-edit-in-place
RFE: Add a hidden option to `ostree admin kargs edit-in-place` to update all existing deployments in place
2022-06-23 12:16:03 -04:00
Colin Walters b04c436bb9 Merge pull request #2651 from cgwalters/misc-declare-and-initialize-2
cli: Port to C99 style (3)
2022-06-21 16:44:12 -04:00
Colin Walters a1de42ecad Merge pull request #2654 from jlebon/pr/drop-packit
Drop `.packit.yaml`
2022-06-21 16:00:32 -04:00
Colin Walters 635a0df124 Merge pull request #2652 from smcv/not-always-xattrs
test-basic-c: Don't assert that extended attributes are available
2022-06-20 16:38:29 -04:00
Colin Walters 9bdf3861ad cli/refs: Port to C99 style
General background cleanup.
2022-06-15 09:36:54 -04:00
Colin Walters 2f1c9a727e cli/remote-list: Port to C99 style
General background cleanup.
2022-06-15 09:35:03 -04:00
Colin Walters a0ae2f9156 cli/gpg-sign: Port to C99 style
General background cleanup.
2022-06-15 09:33:46 -04:00
Colin Walters 43b712951d cli/diff: Port to C99 style
General background cleanup.
2022-06-14 10:04:04 -04:00
Colin Walters f8403f46dc cli/config: Port to C99 style
General background cleanup.
2022-06-14 10:03:58 -04:00
Colin Walters 4e356d0e8f cli/unlock: Port to C99 style
General background cleanup.
2022-06-14 09:53:11 -04:00
Colin Walters 588b07e554 cli/undeploy: Port to C99 style
General background cleanup.
2022-06-14 09:51:41 -04:00
Colin Walters 46e1db392d cli/os-init: Port to C99 style
General background cleanup; motivated by a recent PR which
was using pre-C99 code as a base.
2022-06-14 09:50:07 -04:00
Colin Walters e65c8e72c8 Merge pull request #2643 from cgwalters/rust-2021
rust: Switch to 2021 edition, bump MSRV, a few `format!` updates
2022-06-13 09:10:36 -04:00
Colin Walters eee0eea58b rust-bindings: Wire up tests/
Because the source is in a subdirectory, we lose out on cargo target
autodiscovery.

I noticed this when I edited one of the tests in a way that
should have failed, but didn't...
2022-06-12 14:34:02 -04:00
Colin Walters 436ff11a00 fsck: Use load_variant_if_exists
This cleans up error handling here.
2022-06-12 10:58:29 -04:00
Colin Walters bd030a96f2 fsck: Move most commit processing into helper function
The inner loop was way too long; split out most of the heavy
lifting around backrefs and tombstones into a helper function.
2022-06-12 10:57:27 -04:00
Colin Walters 2fe0ea7395 fsck: De-indent loop
Could have done this in the previous change, but wanted to avoid
excessive diff noise.
2022-06-12 10:48:39 -04:00
Colin Walters e6ad897850 Merge pull request #2644 from cgwalters/list-commit-objects
fsck: Don't load all object names into memory
2022-06-11 08:09:35 -04:00
Colin Walters 6981633f9c fsck: Don't load all object names into memory
We recently discovered `list_objects()` is inefficient with memory.
The more efficient `list_objects_set()` API isn't yet public, but
this fsck code actually just skips over non-commit objects, and
we already have an API to list just those.
2022-06-09 21:01:03 -04:00
Colin Walters a13d812368 repo: Document non-obvious way to list all commits
I was going to add an API for this and then realized the empty
string does it.
2022-06-09 18:34:51 -04:00
Colin Walters 93e3784b66 rust: Use inline format! variables in a few places
Since our MSRV now supports it.
2022-06-09 17:51:07 -04:00
Colin Walters 76071a2b11 ci: Bump MSRV
To match what's in ostree-rs-ext.
2022-06-09 17:49:18 -04:00
Colin Walters 99c122d219 rust: Switch to 2021 edition
No real changes.

```
$ cargo fix --edition
note: Switching to Edition 2021 will enable the use of the version 2 feature resolver in Cargo.
This may cause some dependencies to be built with fewer features enabled than previously.
More information about the resolver changes may be found at https://doc.rust-lang.org/nightly/edition-guide/rust-2021/default-cargo-resolver.html
When building the following dependencies, the given features will no longer be used:

  libc v0.2.126 removed features: extra_traits

The following differences only apply when building with dev-dependencies:

  getrandom v0.2.6 removed features: std
```

which looks OK to me.
2022-06-09 15:55:41 -04:00
Colin Walters d7802c27dd rust-bindings: Update cargo package list
When we did the merger, it turns out cargo by default is basically
going to include all of stuff in the git repository root directory
which is "libostree".  We just want the stuff in `rust-bindings/`.

I initially tried adding `include = "rust-bindings/"` but
according to
https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields
specifying `include` means that `exclude` is
ignored, which is kind of annoying.  Further, doing so *also*
turns off the cargo automatic rules for handling e.g. `gitignore`.

So for now I went with the approach of adding everything from the C
library stuff into `exclude/`.
2022-06-09 15:50:17 -04:00
Colin Walters 61dd54f940 rust-bindings: use correct README.md
I noticed at https://crates.io/crates/ostree/0.14.0
that the `README.md` was wrong...
2022-06-09 14:55:25 -04:00
Colin Walters dc13645299 rust-bindings: Fix repository reference
Since the repo merge.
2022-06-09 14:53:06 -04:00
Colin Walters 2688d7d261 tests/inst: Bump the version of ostree-ext
In the interest of cross-testing and keeping things up to date.

Hmm, I think we need to set up dependabot here.
2022-06-09 14:52:04 -04:00
Colin Walters 145d91d1c9 lib: Fix symbol versioning inheritance
I messed this up; the last release should inherit from the previous
release (N-1) and not the previous to that (N-2).

I think (hope) this isn't an ABI break...

Just noticed this when I was going to add a new symbol.
2022-06-08 16:44:51 -04:00
Colin Walters fffb111633 prune: Also use object set API in ostree_repo_prune_from_reachable()
I missed the second prune path when working on
https://github.com/ostreedev/ostree/pull/2635
2022-06-08 16:22:26 -04:00
Colin Walters 616d0cf7c2 Merge pull request #2636 from cgwalters/update-git-libostree-git-rust
ci: Add a flow that does a git libostree + git rust-bindings
2022-06-08 13:16:11 -04:00
Colin Walters 5341a13b33 ci: Add a flow that does a git libostree + git rust-bindings
In https://github.com/ostreedev/ostree/pull/2633 I realized
that our CI only builds git of libostree or git of rust-bindings,
not git of both.  And we definitely want to test the latter too,
so e.g. the Rust tests *also* become tests for changes to the C code.
2022-06-08 10:33:46 -04:00
Colin Walters a71915e436 repo: Further optimize ostree_repo_list_objects_set()
In a prior change we discovered that for bad historical reasons
libostree was returning a mapping "object type+checksum" => "metadata"
but the "metadata" was redundant and pointless.

Optimize the prune API to use a (currently internal) object listing
API which returns a set, not a map.  This allows `GHashTable` to
avoid allocating a separate array for the values, neatly cutting
memory usage in half (from ~13MB to ~6MB) on my test case of a
dry-run prune of a FCOS build.
2022-06-08 10:18:55 -04:00
Colin Walters 4806d84f56 rust: Bump semver, add feature for current release
There were some changes to the sys API for introspection fixes.
And add a feature for the current release, which is something
I'll add to the checklist for releases.
2022-06-08 09:37:57 -04:00
Colin Walters c2baa6d10b repo: Optimize memory use of ostree_repo_list_objects()
I was looking at https://github.com/ostreedev/ostree/pull/2632
and confused at the usage of
`GVariant *value = g_variant_new ("(b@as)", TRUE, g_variant_new_strv (NULL, 0));`
which looked strange - why the empty strv?

It turns out that this is a historical legacy of the time when
ostree had pack files.  And nothing actually cares about the values
of these variants; we should have an API that returns a proper set,
and not a hash.

But...since all of these things have exactly the same value, instead
of allocating lots of redundant copies on the heap, just have
them all hold a refcount on a shared value.

This cuts the heap usage from 20MB to 13MB on a test FCOS repository
build.
2022-06-07 20:35:37 -04:00
Colin Walters 664c413299 configure: post-release version bump 2022-06-06 11:06:44 -04:00
Colin Walters 5fa364d399 Release 2022.4 2022-06-06 11:04:44 -04:00
Colin Walters fa3b6c9872 rust-bindings: Update to latest git 2022-06-03 10:13:36 -04:00
Colin Walters 70c8499a38 rust-bindings: Use OSTree-1.0.gir from our own builddir
Now that the projects are unified.
2022-06-03 09:57:12 -04:00
Colin Walters 21901c2d36 rust-bindings: Delete committed gir files
These seem to have been accidentally committed to git; they should
not be here.  The Gir should be derived from source code.
2022-06-03 09:51:50 -04:00
Colin Walters 3e645ad950 Drop OSTREE_BUILT_FEATURES from introspection
It inherently depends on the individual build, and can't
really be an official stable API for introspection users.
I've noticed the value of this flip flop when doing local builds.

I'm fairly certain no one is trying to use it from a higher level
language.

It'd probably make sense to even drop from the official C API,
but I'm trying to be conservative with that.
2022-06-02 19:44:40 -04:00