From ef2d8e354a91ef30e34e2ddb61381131a989591c Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 1 Nov 2026 15:52:39 +0100 Subject: bins: read user args from argv[1..]; fix date year digit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit exec::spawn passes C-style argv with argv[0] = the command name, but ls, cat, mkdir, touch and rm treated argv[0] as their first user argument. Every path they were given resolved to the literal command name ("ls", "mkdir", ...), so they failed silently: `mkdir .../sub` never created the directory, `cat` printed nothing. date formatted its last year digit as `y as u8 % 10`, which truncates before the modulo (2026 -> 234 -> '4'), printing "2024". Only visible now that the system image actually stages /bin — before, /bin was empty and every command fell back to a built-in. --- bins/date/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bins/date/src/main.rs') diff --git a/bins/date/src/main.rs b/bins/date/src/main.rs index 880833e..68e70d3 100644 --- a/bins/date/src/main.rs +++ b/bins/date/src/main.rs @@ -22,7 +22,7 @@ pub extern "C" fn efi_main(exports: &'static rsapi::Exports, _argc: usize, _argv let mut buf = [0u8; 19]; let y = t.year; buf[0] = b'0' + (y / 1000) as u8; buf[1] = b'0' + (y / 100) as u8 % 10; - buf[2] = b'0' + (y / 10) as u8 % 10; buf[3] = b'0' + y as u8 % 10; + buf[2] = b'0' + (y / 10) as u8 % 10; buf[3] = b'0' + (y % 10) as u8; buf[4] = b'-'; let m = dig(t.month); buf[5] = m[0]; buf[6] = m[1]; buf[7] = b'-'; -- cgit v1.2.3