From 4c2ccb1dad0209ae534b0a60c1aa7580122f1cf2 Mon Sep 17 00:00:00 2001 From: Anil Kulkarni Date: Sat, 21 Feb 2026 16:35:07 -0800 Subject: [PATCH] Fix 'run shell to inspect' failing with 'No such file or directory' Bug: After building a package, pressing T to inspect returns an error This is because it tries to launch a shell with the path, however the path was just the filename, and not the full path. The fix is to ensure that path_str is the full path, and extract the basename as needed for displaying Fixes #242 --- src/action_install.rs | 8 ++++++-- src/tar_check.rs | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/action_install.rs b/src/action_install.rs index c3ca797..58f06ac 100644 --- a/src/action_install.rs +++ b/src/action_install.rs @@ -218,8 +218,12 @@ pub fn check_tars_and_move(name: &str, rua_paths: &RuaPaths, archive_whitelist: dir_items .retain(|(_, name)| archive_whitelist.contains(&name[..name.len() - common_suffix_length])); trace!("Files filtered for tar checking: {:?}", &dir_items); - for (file, file_name) in dir_items.iter() { - tar_check::tar_check_unwrap(&file.path(), file_name); + for (file, _file_name) in dir_items.iter() { + let path = file.path(); + tar_check::tar_check_unwrap( + &path, + path.to_str().expect("Non-UTF8 characters in build path"), + ); } debug!("all package (tar) files checked, moving them"); let checked_tars_dir = rua_paths.checked_tars_dir(name); diff --git a/src/tar_check.rs b/src/tar_check.rs index ff4f113..469dd5a 100644 --- a/src/tar_check.rs +++ b/src/tar_check.rs @@ -107,9 +107,13 @@ fn tar_check_archive(mut archive: Archive, path_str: &str) { } let has_install = !install_file.is_empty(); + let display_name = Path::new(path_str) + .file_name() + .and_then(|p| p.to_str()) + .unwrap_or(path_str); loop { if suid_files.is_empty() { - eprintln!("Package {} has no SUID files.", path_str); + eprintln!("Package {} has no SUID files.", display_name); } eprint!("{}=list executable files, ", "[E]".bold()); eprint!("{}=list all files, ", "[L]".bold()); @@ -161,7 +165,10 @@ fn tar_check_archive(mut archive: Archive, path_str: &str) { eprintln!("{}", &install_file); } else if &string == "t" { let dir = PathBuf::from(path_str); - let dir = dir.parent().unwrap_or_else(|| Path::new(".")); + let dir = dir + .parent() + .filter(|p| !p.as_os_str().is_empty()) + .unwrap_or_else(|| Path::new(".")); eprintln!("Exit the shell with `logout` or Ctrl-D..."); terminal_util::run_env_command(dir, "SHELL", "bash", &[]); } else if &string == "o" {