Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package krunvm for openSUSE:Factory checked 
in at 2026-03-11 20:52:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/krunvm (Old)
 and      /work/SRC/openSUSE:Factory/.krunvm.new.8177 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "krunvm"

Wed Mar 11 20:52:08 2026 rev:11 rq:1338246 version:0.2.6+git59f3673

Changes:
--------
--- /work/SRC/openSUSE:Factory/krunvm/krunvm.changes    2025-09-19 
15:33:46.188265630 +0200
+++ /work/SRC/openSUSE:Factory/.krunvm.new.8177/krunvm.changes  2026-03-11 
20:52:40.551406492 +0100
@@ -1,0 +2,20 @@
+Tue Mar 10 14:06:11 UTC 2026 - Dario Faggioli <[email protected]>
+
+- Spec file cleanup (use cargo macros)
+- Install manpages and other doc files
+- Update to version v0.2.6
+  * start/macos: extend mount script to chdir workdir
+  * ci: check code quality on Linux too
+  * Use 'if let' to avoid unwrap
+  * Fix compile errors and warnings on Linux
+  * build: use Error::other to make clippy happy
+  * ci: update ci and focus on macOS
+
+- Update to version v0.2.5
+  * Fix re-exec of binary
+  * refactor: cargo fmt.
+  * refactor: removing the dead code krun_set_mapped_volumes
+  * feat: use krun_add_virtiofs to fix mapped volumes on macos.
+  * Re-execute itself with DYLD_LIBRARY_PATH
+
+-------------------------------------------------------------------

Old:
----
  krunvm-0.2.4+git3cdfe0f.obscpio

New:
----
  krunvm-0.2.6+git59f3673.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ krunvm.spec ++++++
--- /var/tmp/diff_new_pack.3ITRO1/_old  2026-03-11 20:52:41.223434216 +0100
+++ /var/tmp/diff_new_pack.3ITRO1/_new  2026-03-11 20:52:41.227434381 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package krunvm
 #
-# Copyright (c) 2025 SUSE LLC and contributors
+# Copyright (c) 2026 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           krunvm
-Version:        0.2.4+git3cdfe0f
+Version:        0.2.6+git59f3673
 Release:        0
 Summary:        Manage lightweight VMs created from OCI images
 License:        Apache-2.0
@@ -37,17 +37,23 @@
 Manage lightweight VMs created from OCI images
 
 %files
+%license LICENSE
 %doc README.md
+%doc CODE-OF-CONDUCT.md
+%doc SECURITY.md
+%{_mandir}/man1/krunvm*.1*
 %{_bindir}/krunvm
 
 %prep
-%setup -qa1
+%autosetup -p1 -a 1
 
 %build
-export RUSTFLAGS="%{build_rustflags}"
-%make_build
+%{cargo_build}
 
 %install
-export RUSTFLAGS="%{build_rustflags}"
-%make_install PREFIX=%{_prefix}
+%{cargo_install}
+
+# We need to deal with the manpages manually
+install -d -m 0755 %{buildroot}%{_mandir}/man1
+find target/release/build/krunvm-*/out -name "*.1" -exec install -m 0644 {} 
%{buildroot}%{_mandir}/man1/ \;
 

++++++ _service ++++++
--- /var/tmp/diff_new_pack.3ITRO1/_old  2026-03-11 20:52:41.267436032 +0100
+++ /var/tmp/diff_new_pack.3ITRO1/_new  2026-03-11 20:52:41.271436197 +0100
@@ -1,7 +1,7 @@
 <services>
   <service name="obs_scm" mode="manual">
     <param name="scm">git</param>
-    <param name="revision">refs/tags/v0.2.4</param>
+    <param name="revision">refs/tags/v0.2.6</param>
     <param name="url">https://github.com/containers/krunvm.git</param>
     <param name="versionformat">@PARENT_TAG@+git%h</param>
     <param name="changesgenerate">enable</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.3ITRO1/_old  2026-03-11 20:52:41.299437352 +0100
+++ /var/tmp/diff_new_pack.3ITRO1/_new  2026-03-11 20:52:41.303437517 +0100
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/containers/krunvm.git</param>
-              <param 
name="changesrevision">3cdfe0f27998fb905ad043d490c29d0caae66031</param></service></servicedata>
+              <param 
name="changesrevision">59f3673a42625a8cd09c8f34f040a32b74c84452</param></service></servicedata>
 (No newline at EOF)
 

++++++ krunvm-0.2.4+git3cdfe0f.obscpio -> krunvm-0.2.6+git59f3673.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/krunvm-0.2.4+git3cdfe0f/.github/actions/setup-build-env/action.yml 
new/krunvm-0.2.6+git59f3673/.github/actions/setup-build-env/action.yml
--- old/krunvm-0.2.4+git3cdfe0f/.github/actions/setup-build-env/action.yml      
1970-01-01 01:00:00.000000000 +0100
+++ new/krunvm-0.2.6+git59f3673/.github/actions/setup-build-env/action.yml      
2026-02-09 12:18:59.000000000 +0100
@@ -0,0 +1,48 @@
+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 \
+          asciidoctor \
+          libvirglrenderer-dev \
+          libepoxy-dev \
+          libdrm-dev \
+          libpipewire-0.3-dev \
+          clang-format \
+          libclang-dev
+        curl -OL 
https://github.com/containers/libkrun/archive/refs/tags/v1.17.0.tar.gz
+        tar xf v1.17.0.tar.gz
+        cd libkrun-1.17.0
+        make
+        sudo make PREFIX=/usr install
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/krunvm-0.2.4+git3cdfe0f/.github/workflows/code_quality.yml 
new/krunvm-0.2.6+git59f3673/.github/workflows/code_quality.yml
--- old/krunvm-0.2.4+git3cdfe0f/.github/workflows/code_quality.yml      
2025-07-31 10:34:10.000000000 +0200
+++ new/krunvm-0.2.6+git59f3673/.github/workflows/code_quality.yml      
2026-02-09 12:18:59.000000000 +0100
@@ -1,42 +1,39 @@
-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)
+  code-quality-linux-x86_64:
+    name: krunvm (Linux x86_64)
     runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        rust:
-          - stable
-        target:
-          - x86_64-unknown-linux-gnu
     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
+      - uses: actions/checkout@v4
 
-      - name: Clippy x86_64-unknown-linux-gnu (all features)
-        run: cargo clippy --all-features --target x86_64-unknown-linux-gnu 
+      - name: Setup build environment
+        uses: ./.github/actions/setup-build-env
 
-      - name: Clippy aarch64-unknown-linux-gnu (all features)
-        run: cargo clippy --all-features --target aarch64-unknown-linux-gnu 
+      - name: Clippy (default)
+        run: cargo clippy --locked -- -D warnings
 
-      - name: Clippy aarch64-apple-darwin (all features)
-        run: cargo clippy --all-features --target aarch64-apple-darwin 
+  code-quality-linux-aarch64:
+    name: krunvm (Linux aarch64)
+    runs-on: ubuntu-24.04-arm
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Setup build environment
+        uses: ./.github/actions/setup-build-env
+
+      - name: Clippy (default)
+        run: cargo clippy --locked -- -D warnings
+
+  code-quality-macos:
+    name: krunvm (macOS aarch64)
+    runs-on: macos-latest
+    steps:
+      - uses: actions/checkout@v4
+      
+      - name: Setup build environment
+        uses: ./.github/actions/setup-build-env
+      
+      - name: Clippy
+        run: cargo clippy --locked -- -D warnings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/Cargo.lock 
new/krunvm-0.2.6+git59f3673/Cargo.lock
--- old/krunvm-0.2.4+git3cdfe0f/Cargo.lock      2025-07-31 10:34:10.000000000 
+0200
+++ new/krunvm-0.2.6+git59f3673/Cargo.lock      2026-02-09 12:18:59.000000000 
+0100
@@ -217,7 +217,7 @@
 
 [[package]]
 name = "krunvm"
-version = "0.2.4"
+version = "0.2.6"
 dependencies = [
  "clap",
  "confy",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/Cargo.toml 
new/krunvm-0.2.6+git59f3673/Cargo.toml
--- old/krunvm-0.2.4+git3cdfe0f/Cargo.toml      2025-07-31 10:34:10.000000000 
+0200
+++ new/krunvm-0.2.6+git59f3673/Cargo.toml      2026-02-09 12:18:59.000000000 
+0100
@@ -1,6 +1,6 @@
 [package]
 name = "krunvm"
-version = "0.2.4"
+version = "0.2.6"
 authors = ["Sergio Lopez <[email protected]>"]
 description = "Create microVMs from OCI images"
 repository = "https://github.com/containers/krunvm";
@@ -15,4 +15,4 @@
 serde = "1.0.120"
 serde_derive = "1.0.120"
 text_io = "0.1.8"
-nix = {version = "0.27.1", features = ["socket", "fs"]}
+nix = {version = "0.27.1", features = ["socket", "fs", "process"]}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/build.rs 
new/krunvm-0.2.6+git59f3673/build.rs
--- old/krunvm-0.2.4+git3cdfe0f/build.rs        2025-07-31 10:34:10.000000000 
+0200
+++ new/krunvm-0.2.6+git59f3673/build.rs        2026-02-09 12:18:59.000000000 
+0100
@@ -54,7 +54,7 @@
         .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(())
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/src/bindings.rs 
new/krunvm-0.2.6+git59f3673/src/bindings.rs
--- old/krunvm-0.2.4+git3cdfe0f/src/bindings.rs 2025-07-31 10:34:10.000000000 
+0200
+++ new/krunvm-0.2.6+git59f3673/src/bindings.rs 2026-02-09 12:18:59.000000000 
+0100
@@ -10,9 +10,9 @@
     pub fn krun_free_ctx(ctx: u32) -> i32;
     pub fn krun_set_vm_config(ctx: u32, num_vcpus: u8, ram_mib: u32) -> i32;
     pub fn krun_set_root(ctx: u32, root_path: *const c_char) -> i32;
-    pub fn krun_set_mapped_volumes(ctx: u32, mapped_volumes: *const *const 
c_char) -> i32;
     pub fn krun_set_port_map(ctx: u32, port_map: *const *const c_char) -> i32;
     pub fn krun_set_workdir(ctx: u32, workdir_path: *const c_char) -> i32;
+    pub fn krun_add_virtiofs(ctx: u32, tag: *const c_char, path: *const 
c_char) -> i32;
     pub fn krun_set_exec(
         ctx: u32,
         exec_path: *const c_char,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/src/commands/start.rs 
new/krunvm-0.2.6+git59f3673/src/commands/start.rs
--- old/krunvm-0.2.4+git3cdfe0f/src/commands/start.rs   2025-07-31 
10:34:10.000000000 +0200
+++ new/krunvm-0.2.6+git59f3673/src/commands/start.rs   2026-02-09 
12:18:59.000000000 +0100
@@ -4,9 +4,15 @@
 use clap::Args;
 use libc::c_char;
 use std::ffi::CString;
+#[cfg(target_os = "macos")]
+use std::fs;
 use std::fs::File;
+#[cfg(target_os = "macos")]
+use std::io::Write;
 #[cfg(target_os = "linux")]
 use std::io::{Error, ErrorKind};
+#[cfg(target_os = "macos")]
+use std::os::unix::fs::PermissionsExt;
 use std::os::unix::io::AsRawFd;
 #[cfg(target_os = "macos")]
 use std::path::Path;
@@ -62,10 +68,8 @@
             Vec::new()
         };
 
-        let env_pairs: Vec<CString> = if self.envs.is_some() {
-            self.envs
-                .unwrap()
-                .into_iter()
+        let env_pairs: Vec<CString> = if let Some(envs) = self.envs {
+            envs.into_iter()
                 .map(|val| CString::new(val).unwrap())
                 .collect()
         } else {
@@ -111,31 +115,26 @@
 }
 
 #[cfg(target_os = "macos")]
-fn map_volumes(ctx: u32, vmcfg: &VmConfig, rootfs: &str) {
-    if vmcfg.mapped_volumes.is_empty() {
-        return;
-    }
-    let mut volumes = Vec::new();
-    for (host_path, guest_path) in vmcfg.mapped_volumes.iter() {
+fn map_volumes(ctx: u32, vmcfg: &VmConfig, rootfs: &str) -> Vec<(String, 
String)> {
+    let mut mounts = Vec::new();
+    for (idx, (host_path, guest_path)) in 
vmcfg.mapped_volumes.iter().enumerate() {
         let full_guest = format!("{}{}", &rootfs, guest_path);
         let full_guest_path = Path::new(&full_guest);
         if !full_guest_path.exists() {
             std::fs::create_dir(full_guest_path)
                 .expect("Couldn't create guest_path for mapped volume");
         }
-        let map = format!("{}:{}", host_path, guest_path);
-        volumes.push(CString::new(map).unwrap());
-    }
-    let mut vols: Vec<*const i8> = Vec::new();
-    for vol in volumes.iter() {
-        vols.push(vol.as_ptr());
-    }
-    vols.push(std::ptr::null());
-    let ret = unsafe { bindings::krun_set_mapped_volumes(ctx, vols.as_ptr()) };
-    if ret < 0 {
-        println!("Error setting VM mapped volumes");
-        std::process::exit(-1);
+        let tag = format!("krunvm{}", idx);
+        let c_tag = CString::new(tag.as_str()).unwrap();
+        let c_host = CString::new(host_path.as_str()).unwrap();
+        let ret = unsafe { bindings::krun_add_virtiofs(ctx, c_tag.as_ptr(), 
c_host.as_ptr()) };
+        if ret < 0 {
+            println!("Error setting VM mapped volume {}", guest_path);
+            std::process::exit(-1);
+        }
+        mounts.push((tag, guest_path.to_string()));
     }
+    mounts
 }
 
 unsafe fn exec_vm(
@@ -162,7 +161,12 @@
         std::process::exit(-1);
     }
 
+    #[cfg(target_os = "linux")]
     map_volumes(ctx, vmcfg, rootfs);
+    #[cfg(target_os = "macos")]
+    let virtiofs_mounts = map_volumes(ctx, vmcfg, rootfs);
+    #[cfg(target_os = "macos")]
+    let mount_wrapper = build_mount_wrapper(rootfs, cmd, &vmcfg.workdir, 
&args, &virtiofs_mounts);
 
     let mut ports = Vec::new();
     for (host_port, guest_port) in vmcfg.mapped_ports.iter() {
@@ -201,24 +205,60 @@
     }
     env.push(std::ptr::null());
 
-    if let Some(cmd) = cmd {
-        let mut argv: Vec<*const c_char> = Vec::new();
-        for a in args.iter() {
-            argv.push(a.as_ptr());
-        }
-        argv.push(std::ptr::null());
+    #[cfg(target_os = "macos")]
+    {
+        if let Some((helper_path, helper_args)) = mount_wrapper {
+            let mut argv: Vec<*const c_char> = helper_args.iter().map(|a| 
a.as_ptr()).collect();
+            argv.push(std::ptr::null());
+            let ret =
+                bindings::krun_set_exec(ctx, helper_path.as_ptr(), 
argv.as_ptr(), env.as_ptr());
+            if ret < 0 {
+                println!("Error setting VM config");
+                std::process::exit(-1);
+            }
+        } else if let Some(cmd) = cmd {
+            let mut argv: Vec<*const c_char> = Vec::new();
+            for a in args.iter() {
+                argv.push(a.as_ptr());
+            }
+            argv.push(std::ptr::null());
 
-        let c_cmd = CString::new(cmd).unwrap();
-        let ret = bindings::krun_set_exec(ctx, c_cmd.as_ptr(), argv.as_ptr(), 
env.as_ptr());
-        if ret < 0 {
-            println!("Error setting VM config");
-            std::process::exit(-1);
+            let c_cmd = CString::new(cmd).unwrap();
+            let ret = bindings::krun_set_exec(ctx, c_cmd.as_ptr(), 
argv.as_ptr(), env.as_ptr());
+            if ret < 0 {
+                println!("Error setting VM config");
+                std::process::exit(-1);
+            }
+        } else {
+            let ret = bindings::krun_set_env(ctx, env.as_ptr());
+            if ret < 0 {
+                println!("Error setting VM environment variables");
+                std::process::exit(-1);
+            }
         }
-    } else {
-        let ret = bindings::krun_set_env(ctx, env.as_ptr());
-        if ret < 0 {
-            println!("Error setting VM environment variables");
-            std::process::exit(-1);
+    }
+
+    #[cfg(not(target_os = "macos"))]
+    {
+        if let Some(cmd) = cmd {
+            let mut argv: Vec<*const c_char> = Vec::new();
+            for a in args.iter() {
+                argv.push(a.as_ptr());
+            }
+            argv.push(std::ptr::null());
+
+            let c_cmd = CString::new(cmd).unwrap();
+            let ret = bindings::krun_set_exec(ctx, c_cmd.as_ptr(), 
argv.as_ptr(), env.as_ptr());
+            if ret < 0 {
+                println!("Error setting VM config");
+                std::process::exit(-1);
+            }
+        } else {
+            let ret = bindings::krun_set_env(ctx, env.as_ptr());
+            if ret < 0 {
+                println!("Error setting VM environment variables");
+                std::process::exit(-1);
+            }
         }
     }
 
@@ -229,6 +269,58 @@
     }
 }
 
+#[cfg(target_os = "macos")]
+fn build_mount_wrapper(
+    rootfs: &str,
+    cmd: Option<&str>,
+    workdir: &str,
+    args: &[CString],
+    mounts: &[(String, String)],
+) -> Option<(CString, Vec<CString>)> {
+    if mounts.is_empty() {
+        return None;
+    }
+
+    let helper_path = write_mount_script(rootfs, workdir, mounts);
+
+    let mut exec_args: Vec<CString> = Vec::new();
+    let command = cmd.unwrap_or("/bin/sh");
+    exec_args.push(CString::new(command).unwrap());
+    exec_args.extend(args.iter().cloned());
+
+    let helper_cstr = CString::new(helper_path).unwrap();
+    Some((helper_cstr, exec_args))
+}
+
+#[cfg(target_os = "macos")]
+fn write_mount_script(rootfs: &str, workdir: &str, mounts: &[(String, 
String)]) -> String {
+    let host_path = format!("{}/.krunvm-mount.sh", rootfs);
+    let guest_path = "/.krunvm-mount.sh".to_string();
+
+    let mut file = File::create(&host_path).unwrap_or_else(|err| {
+        println!("Error creating mount helper script: {}", err);
+        std::process::exit(-1);
+    });
+
+    writeln!(file, "#!/bin/sh").unwrap();
+    writeln!(file, "set -e").unwrap();
+    for (tag, guest_path) in mounts {
+        writeln!(file, "mount -t virtiofs {} {}", tag, guest_path).unwrap();
+    }
+    if !workdir.is_empty() {
+        writeln!(file, "cd {}", workdir).unwrap();
+    }
+    writeln!(file, "exec \"$@\"").unwrap();
+
+    let perms = fs::Permissions::from_mode(0o755);
+    if let Err(err) = fs::set_permissions(&host_path, perms) {
+        println!("Error setting mount helper permissions: {}", err);
+        std::process::exit(-1);
+    }
+
+    guest_path
+}
+
 fn set_rlimits() {
     let mut limit = libc::rlimit {
         rlim_cur: 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/krunvm-0.2.4+git3cdfe0f/src/main.rs 
new/krunvm-0.2.6+git59f3673/src/main.rs
--- old/krunvm-0.2.4+git3cdfe0f/src/main.rs     2025-07-31 10:34:10.000000000 
+0200
+++ new/krunvm-0.2.6+git59f3673/src/main.rs     2026-02-09 12:18:59.000000000 
+0100
@@ -3,14 +3,22 @@
 
 use std::collections::HashMap;
 #[cfg(target_os = "macos")]
+use std::env;
+#[cfg(target_os = "macos")]
+use std::ffi::CString;
+#[cfg(target_os = "macos")]
 use std::fs::File;
 #[cfg(target_os = "macos")]
-use std::io::{self, Read, Write};
+use std::io::{self, Error, ErrorKind, Read, Write};
+#[cfg(target_os = "macos")]
+use std::os::unix::ffi::OsStringExt;
 
 use crate::commands::{
     ChangeVmCmd, ConfigCmd, CreateCmd, DeleteCmd, InspectCmd, ListCmd, 
StartCmd,
 };
 use clap::{Parser, Subcommand};
+#[cfg(target_os = "macos")]
+use nix::unistd::execve;
 use serde_derive::{Deserialize, Serialize};
 #[cfg(target_os = "macos")]
 use text_io::read;
@@ -169,7 +177,65 @@
     Config(ConfigCmd),
 }
 
+#[cfg(target_os = "macos")]
+fn get_brew_prefix() -> Option<String> {
+    let output = std::process::Command::new("brew")
+        .arg("--prefix")
+        .stderr(std::process::Stdio::inherit())
+        .output()
+        .ok()?;
+
+    let exit_code = output.status.code().unwrap_or(-1);
+    if exit_code != 0 {
+        return None;
+    }
+
+    Some(std::str::from_utf8(&output.stdout).ok()?.trim().to_string())
+}
+
+#[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<CString> = env::args_os()
+        .map(|arg| CString::new(arg.into_vec()).unwrap())
+        .collect();
+
+    let mut envs: Vec<CString> = env::vars_os()
+        .map(|(key, value)| {
+            CString::new(format!(
+                "{}={}",
+                key.into_string().unwrap(),
+                value.into_string().unwrap()
+            ))
+            .unwrap()
+        })
+        .collect();
+    let brew_prefix = get_brew_prefix().ok_or(ErrorKind::NotFound)?;
+    envs.push(CString::new(format!(
+        "DYLD_LIBRARY_PATH={brew_prefix}/lib"
+    ))?);
+
+    // Use execve to replace the current process. This function only returns
+    // if an error occurs.
+    match execve(&exec_cstr, &args, &envs) {
+        Ok(_) => Ok(()),
+        Err(e) => {
+            eprintln!("Error re-executing krunvm: {}", e);
+            std::process::exit(-1);
+        }
+    }
+}
+
 fn main() {
+    #[cfg(target_os = "macos")]
+    {
+        if env::var("DYLD_LIBRARY_PATH").is_err() {
+            _ = reexec();
+        }
+    }
+
     let mut cfg: KrunvmConfig = confy::load(APP_NAME).unwrap();
     let cli_args = Cli::parse();
 

++++++ krunvm.obsinfo ++++++
--- /var/tmp/diff_new_pack.3ITRO1/_old  2026-03-11 20:52:41.443443293 +0100
+++ /var/tmp/diff_new_pack.3ITRO1/_new  2026-03-11 20:52:41.447443458 +0100
@@ -1,5 +1,5 @@
 name: krunvm
-version: 0.2.4+git3cdfe0f
-mtime: 1753950850
-commit: 3cdfe0f27998fb905ad043d490c29d0caae66031
+version: 0.2.6+git59f3673
+mtime: 1770635939
+commit: 59f3673a42625a8cd09c8f34f040a32b74c84452
 

++++++ vendor.tar.zst ++++++
/work/SRC/openSUSE:Factory/krunvm/vendor.tar.zst 
/work/SRC/openSUSE:Factory/.krunvm.new.8177/vendor.tar.zst differ: char 7, line 
1

Reply via email to