From d37ed24ca1ea0641b1e36bcbc3a25f882beee418 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Fri, 9 Jan 2026 16:48:25 +0100 Subject: [PATCH 1/4] Fix re-exec of binary In 8ad63194, we introduced the ability to re-exec the binary itself to put DYLD_LIBRARY_PATH in the environment. That worked fine only when running the binary with a path. Fix it to ensure it works also when the binary is located through PATH. Signed-off-by: Sergio Lopez --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d6f336d..d3e0237 100644 --- a/src/main.rs +++ b/src/main.rs @@ -191,6 +191,9 @@ fn get_brew_prefix() -> Option { #[cfg(target_os = "macos")] fn reexec() -> Result<(), Error> { + let exec_path = env::current_exe().map_err(|_| ErrorKind::NotFound)?; + let exec_cstr = CString::new(exec_path.to_str().ok_or(ErrorKind::InvalidFilename)?)?; + let args: Vec = env::args_os() .map(|arg| CString::new(arg.into_vec()).unwrap()) .collect(); @@ -212,7 +215,7 @@ fn reexec() -> Result<(), Error> { // Use execve to replace the current process. This function only returns // if an error occurs. - match execve(&args[0], &args, &envs) { + match execve(&exec_cstr, &args, &envs) { Ok(_) => Ok(()), Err(e) => { eprintln!("Error re-executing krunvm: {}", e); From 26e7c5c6ce7513664d8d18e5d80b206e23ff9383 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Fri, 9 Jan 2026 16:51:10 +0100 Subject: [PATCH 2/4] Bump version to 0.2.5 Set up the stage for a new relase. Signed-off-by: Sergio Lopez --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f66028d..aed7fb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,7 +217,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "krunvm" -version = "0.2.4" +version = "0.2.5" dependencies = [ "clap", "confy", diff --git a/Cargo.toml b/Cargo.toml index 80f19a2..c10a4ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "krunvm" -version = "0.2.4" +version = "0.2.5" authors = ["Sergio Lopez "] description = "Create microVMs from OCI images" repository = "https://github.com/containers/krunvm" From 8db0f16a1e50072dbc9dc303060790ab254963a1 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Fri, 9 Jan 2026 22:38:44 +0100 Subject: [PATCH 3/4] ci: update ci and focus on macOS Signed-off-by: Sergio Lopez --- .github/actions/setup-build-env/action.yml | 42 ++++++++++++++++++ .github/workflows/code_quality.yml | 51 +++++----------------- 2 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 .github/actions/setup-build-env/action.yml diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml new file mode 100644 index 0000000..1077fce --- /dev/null +++ b/.github/actions/setup-build-env/action.yml @@ -0,0 +1,42 @@ +name: 'Setup Build Environment' +description: 'Common setup for Rust builds with all required packages (Linux & macOS)' +runs: + using: 'composite' + steps: + - name: Install Rust toolchain + shell: bash + run: | + rustup update stable + rustup default stable + rustup component add rustfmt clippy + + - name: Cache Cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Set up Homebrew (macOS) + if: runner.os == 'macOS' + uses: Homebrew/actions/setup-homebrew@master + + - name: Install packages (macOS) + if: runner.os == 'macOS' + shell: bash + run: brew tap slp/krun && brew install asciidoctor libkrun clang-format llvm + + - name: Install packages (Linux) + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y \ + libvirglrenderer-dev \ + libepoxy-dev \ + libdrm-dev \ + libpipewire-0.3-dev \ + clang-format \ + libclang-dev diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 80f6ad1..3956dd0 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -1,42 +1,15 @@ -name: Code Quality (rustfmt and clippy) -on: [pull_request, create] +name: Code Quality +on: [pull_request] jobs: - build: - if: github.event_name == 'pull_request' - name: Code Quality (clippy, rustfmt) - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - target: - - x86_64-unknown-linux-gnu + code-quality-macos: + name: krunvm (macOS aarch64) + runs-on: macos-latest steps: - - name: Code checkout - uses: actions/checkout@v2 - - name: Install Rust toolchain (${{ matrix.rust }}) - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true - components: rustfmt, clippy - - - name: Install asciidoctor - run: sudo apt-get install -y asciidoctor - - - name: Install additional Rust rust targets - run: rustup target add aarch64-unknown-linux-gnu aarch64-apple-darwin - - - name: Formatting (rustfmt) - run: cargo fmt -- --check - - - name: Clippy x86_64-unknown-linux-gnu (all features) - run: cargo clippy --all-features --target x86_64-unknown-linux-gnu - - - name: Clippy aarch64-unknown-linux-gnu (all features) - run: cargo clippy --all-features --target aarch64-unknown-linux-gnu - - - name: Clippy aarch64-apple-darwin (all features) - run: cargo clippy --all-features --target aarch64-apple-darwin + - uses: actions/checkout@v4 + + - name: Setup build environment + uses: ./.github/actions/setup-build-env + + - name: Clippy + run: cargo clippy --locked -- -D warnings From c06bd656657ea16b44f16f1661fe40cc4097f5b1 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Fri, 9 Jan 2026 22:48:34 +0100 Subject: [PATCH 4/4] build: use Error::other to make clippy happy Signed-off-by: Sergio Lopez --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index d7a571a..e46457a 100644 --- a/build.rs +++ b/build.rs @@ -54,7 +54,7 @@ fn generate_man_page>(outdir: P, command: &str) -> io::Result<()> .wait()?; if !result.success() { let msg = format!("'asciidoctor' failed with exit code {:?}", result.code()); - return Err(io::Error::new(io::ErrorKind::Other, msg)); + return Err(io::Error::other(msg)); } Ok(()) }