Repository: wasmerio/wasmer (language: rust)

Issue:
Fix issue when running clang without -save-temps
Running clang without `save-temps` causes the linker to fail.


Discussion / hints:

Fix patch:
diff --git a/lib/wasix/src/syscalls/wasi/fd_filestat_get.rs b/lib/wasix/src/syscalls/wasi/fd_filestat_get.rs
index 709b6c8037f..6d65e53dc4d 100644
--- a/lib/wasix/src/syscalls/wasi/fd_filestat_get.rs
+++ b/lib/wasix/src/syscalls/wasi/fd_filestat_get.rs
@@ -10,7 +10,7 @@ use crate::types::wasi::Snapshot0Filestat;
 /// Output:
 /// - `Filestat *buf`
 ///     Where the metadata from `fd` will be written
-#[instrument(level = "trace", skip_all, fields(%fd), ret)]
+#[instrument(level = "trace", skip_all, fields(%fd, size = field::Empty, mtime = field::Empty), ret)]
 pub fn fd_filestat_get<M: MemorySize>(
     mut ctx: FunctionEnvMut<'_, WasiEnv>,
     fd: WasiFd,
@@ -18,6 +18,10 @@ pub fn fd_filestat_get<M: MemorySize>(
 ) -> Errno {
     let stat = wasi_try!(fd_filestat_get_internal(&mut ctx, fd));
 
+    // These two values have proved to be helpful in multiple investigations
+    Span::current().record("size", stat.st_size);
+    Span::current().record("mtime", stat.st_mtim);
+
     let env = ctx.data();
     let (memory, _) = unsafe { env.get_memory_and_wasi_state(&ctx, 0) };
     let buf = buf.deref(&memory);
diff --git a/lib/wasix/src/syscalls/wasi/path_rename.rs b/lib/wasix/src/syscalls/wasi/path_rename.rs
index 37ab9145f42..c334d6ff250 100644
--- a/lib/wasix/src/syscalls/wasi/path_rename.rs
+++ b/lib/wasix/src/syscalls/wasi/path_rename.rs
@@ -201,6 +201,8 @@ pub fn path_rename_internal(
         }
     }
 
+    let source_size = source_entry.stat.read().unwrap().st_size;
+
     if need_create {
         let mut guard = target_parent_inode.write();
         if let Kind::Dir { entries, .. } = guard.deref_mut() {
@@ -212,5 +214,12 @@ pub fn path_rename_internal(
         }
     }
 
+    // The target entry is created, one way or the other
+    let target_inode =
+        wasi_try_ok!(state
+            .fs
+            .get_inode_at_path(inodes, target_fd, target_path, true));
+    target_inode.stat.write().unwrap().st_size = source_size;
+
     Ok(Errno::Success)
 }


Test patch: