ls returns "error: ENOENT"
xtoto1 opened this issue · comments
Hmm. I am not able to reproduce it in Qemu. Can you please apply the following diff and try to run the command again and paste the image of what the output after applying this diff.
diff --git a/userland/aero_shell/src/main.rs b/userland/aero_shell/src/main.rs
index 1fdad80cb..80b134b57 100644
--- a/userland/aero_shell/src/main.rs
+++ b/userland/aero_shell/src/main.rs
@@ -149,9 +149,10 @@ fn main() -> Result<(), AeroSyscallError> {
let mut buffer = [0u8; 256];
let len = sys_read(0, &mut buffer)?;
- let mut command_iter = unsafe { core::str::from_utf8_unchecked(&mut buffer) }.trim()
- [0..len]
- .split_whitespace();
+ let ins = &unsafe { core::str::from_utf8_unchecked(&mut buffer) }.trim()[0..len];^M
+ let mut command_iter = ins.split_whitespace();^M
+^M
+ println!("{:?}", ins);^M
let command = command_iter.next();
To apply the diff:
- Copy the diff into a file (call it
b.diff
) - Run
git apply b.diff
Hmm. So it looks like the NUL
characters are occurring after you have pressed enter. Can you try out printing the StdinBuffer
and TtyState
on each key press? Quite weird I am not able to reproduce it. Are you using any special flags or smth?
diff --git a/src/aero_kernel/src/drivers/tty.rs b/src/aero_kernel/src/drivers/tty.rs
index b94d0a794..d7ea3db77 100644
--- a/src/aero_kernel/src/drivers/tty.rs
+++ b/src/aero_kernel/src/drivers/tty.rs
@@ -358,7 +358,25 @@ impl KeyboardListener for Tty {
}
_ => {}
- }
+ };
+
+ let stdin = self.stdin.lock_irq();
+ log::debug!(
+ "lshift={}, rshift={}, lctrl={}, rctrl={}, lalt={}, altgr={}, caps={}",
+ state.lshift,
+ state.rshift,
+ state.lctrl,
+ state.rctrl,
+ state.lalt,
+ state.altgr,
+ state.caps,
+ );
+ log::debug!(
+ "back_buffer={:?}, front_buffer={:?}, cursor={:?}",
+ stdin.back_buffer,
+ stdin.front_buffer,
+ stdin.cursor
+ );
}
}
Yep can you paste the serial logs in the host terminal here. The prints here are used to debug the actual problem not solve it. It will give more info to the issue.
i piped cargo aero run
into log.txt
and this is the output:
log.txt
i used the commands clear
and ls
in order, then shut down
That helped to debug and reproduce the issue! Now it should be fixed by 706421f :^) Turns out that I was not able to reproduce at first since I was not at the latest HEAD
😁. Thanks for reporting the bug!