diff --git a/src/platform/redox/exec.rs b/src/platform/redox/exec.rs index 513e0ba979..e717b28625 100644 --- a/src/platform/redox/exec.rs +++ b/src/platform/redox/exec.rs @@ -77,13 +77,25 @@ pub fn execve( arg_env: ArgEnv, interp_override: Option, ) -> Result { + let dbg = |m: &str| { + let _ = syscall::write(2, m.as_bytes()); + }; + dbg("EXECVE-DIAG: enter\n"); // NOTE: We must omit O_CLOEXEC and close manually, otherwise it will be closed before we // have even read it! let (mut image_file, stat, arg0) = match exec { Executable::AtPath(path) => { + { + let mut b = alloc::string::String::from("EXECVE-DIAG: opening exe '"); + b.push_str(core::str::from_utf8(path.to_bytes()).unwrap_or("")); + b.push_str("'\n"); + dbg(&b); + } let Ok(src_fd) = File::open(path, O_RDONLY as c_int) else { + dbg("EXECVE-DIAG: exe File::open FAILED -> ENOENT\n"); return Err(Error::new(ENOENT)); }; + dbg("EXECVE-DIAG: exe opened ok\n"); let mut src_stat = Stat::default(); redox_rt::sys::fstat(*src_fd as usize, &mut src_stat)?; @@ -166,8 +178,18 @@ pub fn execve( let mut args: Vec<&[u8]> = Vec::with_capacity(len); if let Some(interpreter) = &interpreter_path { + { + let mut b = alloc::string::String::from("EXECVE-DIAG: needs interp '"); + b.push_str(core::str::from_utf8(interpreter.as_bytes()).unwrap_or("")); + b.push_str("'\n"); + dbg(&b); + } image_file = File::open(CStr::borrow(&interpreter), O_RDONLY as c_int) - .map_err(|_| Error::new(ENOENT))?; + .map_err(|_| { + dbg("EXECVE-DIAG: interp File::open FAILED -> ENOENT\n"); + Error::new(ENOENT) + })?; + dbg("EXECVE-DIAG: interp opened ok\n"); // Push interpreter to arguments args.push(interpreter.as_bytes());