8000 fix(minvmd): look in installed paths for data files & gvproxy by twitchyliquid64 · Pull Request #652 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions crates/minvmd/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ pub enum VmError {
8000 /// A required environment variable was unset or empty.
MissingEnv { var: &'static str },

/// A required image could not be located: the override env var was unset or
/// empty, and no file exists at the default install location. `var` names
/// the override; `default` is the path that was checked.
MissingImage { var: &'static str, default: PathBuf },

/// An I/O error outside the libkrun FFI boundary (e.g. creating or
/// checking the socket directory, R3.2).
Io { source: io::Error },
Expand Down Expand Up @@ -83,6 +88,13 @@ impl fmt::Display for VmError {
Self::MissingEnv { var } => {
write!(f, "required environment variable {var} is unset or empty")
}
Self::MissingImage { var, default } => {
write!(
f,
"{var} is unset and no file exists at the default location {}",
default.display()
)
Comment on lines +91 to +96
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include empty overrides in the MissingImage diagnostic.

resolve_or_default() treats empty values as unset, but this message only says “unset”, so MINVMD_*="" reports a misleading cause.

Proposed fix
-                    "{var} is unset and no file exists at the default location {}",
+                    "{var} is unset or empty and no file exists at the default location {}",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
9763
Self::MissingImage { var, default } => {
write!(
f,
"{var} is unset and no file exists at the default location {}",
default.display()
)
Self::MissingImage { var, default } => {
write!(
f,
"{var} is unset or empty and no file exists at the default location {}",
default.display()
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/minvmd/src/error.rs` around lines 91 - 96, The MissingImage diagnostic
in the Error display path only reports the variable as “unset”, but
resolve_or_default() also treats empty overrides the same way. Update the
formatting for Error::MissingImage so the message clearly mentions empty values
alongside unset ones, keeping the wording consistent with resolve_or_default()
and the existing display implementation in error.rs.

}
Self::Io { source } => {
write!(f, "I/O error: {source}")
}
Expand All @@ -108,6 +120,7 @@ impl std::error::Error for VmError {
| Self::NulInString { .. }
| Self::StartEnterReturnedUnexpectedly { .. }
| Self::MissingEnv { .. }
| Self::MissingImage { .. }
| Self::Configuration { .. }
| Self::InvalidEgressSubnet { .. } => None,
Self::Io { source } => Some(source),
Expand Down
Loading
Loading
0