Migrate all crates from edition 2021 to 2024. This includes
updating Cargo.toml files and fixing code compatibility issues.
The MSRV is bumped to 1.85.0 to support edition 2024.
Note: global_init() requires #[allow(unsafe_code)] for
std::env::set_var which is now unsafe in edition 2024.
This is safe because the function is called early in main()
before any threads are spawned.
Closes: #1414
Signed-off-by: Daniele Guarascio <guarascio.daniele@gmail.com>
This fixes bootc's use of the Discoverable Partition Specification (DPS)
to properly support systemd-gpt-auto-generator. Previously, bootc was
incorrectly setting filesystem UUIDs to the DPS partition type UUID value,
which caused UUID collisions and prevented proper DPS functionality.
It's still a TODO on our side to support systemd-repart in this flow.
Note we go back to using random filesystem UUIDs with this, but
per above we should likely reinitialize them on boot via repart.
Note we remove root= parameter from kernel cmdline for composefs sealed images,
allowing systemd-gpt-auto-generator to auto-discover the root partition
and we test this.
Fixes: #1771
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
This fleshes out what we had with a more rigorous
binding to the spec.
As part of this though, the ESP constant we had here was uppercase,
but the spec version uses lowercase. Add APIs to find a partition
by type, comparing case insensitively.
Assisted-by: Claude Code
Signed-off-by: Colin Walters <walters@verbum.org>
Without the "internals" prefix, bootc fails to spawn the
loopback-cleanup-helper because the helper is only available
under the `bootc internals` subcommand.
This patch updates the spawned command to include "internals" before
the helper name so it runs as intended.
Signed-off-by: Sam Dasilva <samuelramos852@gmail.com>
Split `dependencies` into three sections:
- Internal deps (crates in the same workspace)
- Workspace deps
- Deps only used by that sub-crate
Also make everything alphabetical.
Assisted-by: Claude Code
Signed-off-by: Colin Walters <walters@verbum.org>
Prep for fixing https://github.com/bootc-dev/bootc/issues/1434
Basically in the selinux path we copy our binary to a tempfile,
which breaks `/proc/self/exe`.
Fix this by setting an environment variable when we do that re-exec
and ensuring that *everything* references an internal API (now
moved to utils/ so it can be shared) that looks for the env
var first.
There really isn't any kind of single default way to run a subprocess,
that's why it's tricky. Sometimes one wants to have them be async,
sometimes synchronous. Sometimes one wants to capture stdout,
other times not etc.
The `run()` name implies it's a default but it can't really be
because some use cases we really do want to directly copy
stderr instead of capturing it.
It happens that *most* cases here inside bootc we're fine
to only show stderr on error I think; I only changed the editor
case to use the new `run_inherited()`.
But in contrast many use cases in e.g.
https://github.com/coreos/rpm-ostree/pull/5439
wanted `run_inherited()`.
Unit tests: Assisted-by: Claude Code
Signed-off-by: Colin Walters <walters@verbum.org>
- Add robust binary path resolution with multiple fallback strategies
- Use /proc/self/exe, argv[0], common paths, and PATH search
- Add graceful fallback when cleanup helper can't be spawned
- Improve error handling and logging
- Add comprehensive tests for binary finding logic
This fixes the 'Failed to spawn loopback cleanup helper' error that
was causing issues in packaged distributions where the binary path
was not easily discoverable.
Add fork+exec based cleanup helper to prevent loopback device leaks when
bootc install --via-loopback is interrupted by signals like SIGINT.
- Add loopback-cleanup-helper CLI subcommand
- Implement run_loopback_cleanup_helper() with PR_SET_PDEATHSIG
- Update LoopbackDevice to spawn cleanup helper process
- Add tests for spawn mechanism
Add fork+exec based cleanup helper to prevent loopback device leaks when
bootc install --via-loopback is interrupted by signals like SIGINT.
- Add loopback-cleanup-helper CLI subcommand
- Implement run_loopback_cleanup_helper() with PR_SET_PDEATHSIG
- Update LoopbackDevice to spawn cleanup helper process
- Add tests for spawn mechanism