podstorage: Add early check for missing podman binary - #2386
podstorage: Add early check for missing podman binary#2386HarshwardhanPatil07 wants to merge 1 commit into
Conversation
When podman is not installed, CStorage::create() fails with "No such file or directory (os error 2)" from the underlying Command::new() call, which users misinterpret as a missing file or directory on disk. Add an early have_executable() check that bails with a clear message naming the missing binary, following the same pattern used by ukify.rs. Closes: bootc-dev#2284 Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
|
Perhaps |
|
Yes @cgwalters, Thank you! i will add it |
| fn check_runtime_deps(root: &Dir, _config: &LintExecutionConfig) -> LintResult { | ||
| let mut bins: Vec<&str> = vec![bootc_utils::podman_bin(), bootc_utils::skopeo_bin()]; | ||
| bins.dedup(); | ||
| const BIN_DIRS: &[&str] = &["usr/bin", "usr/sbin", "bin", "sbin"]; |
There was a problem hiding this comment.
We have other code in this repo to search for executables, I don't think we need to reimplement $PATH lookups.
Hmm, another way to do this would be to have something like storage::check_dependencies() and centralize things there?
That would also ensure we work with that experimental override variable...
| check_runtime_deps, | ||
| ); | ||
| fn check_runtime_deps(root: &Dir, _config: &LintExecutionConfig) -> LintResult { | ||
| let mut bins: Vec<&str> = vec![bootc_utils::podman_bin(), bootc_utils::skopeo_bin()]; |
There was a problem hiding this comment.
A while ago I tried to have this list be included in Cargo.toml
|
But this all said sorry I would have probably said we could just merge the first commit right now, and do the lint changes as a separate followup PR. The first commit is clearly safe and correct. |
|
@cgwalters Thanks! I will remove the second commit and continue in followup pr. Thank you! |
388a24f to
6d27399
Compare
When podman is not installed, "No such file or directory (os error 2)" is shown, which users misinterpret as a missing file or directory on disk.
Before fix:
error: Upgrading: No such file or directory (os error 2)
After fix:
error: Upgrading: Creating imgstorage: nonexistent_podman executable not found in PATH; it is required for container image storage operations
Steps to reproduce:
Closes: #2284