From 932ba6b4f30431327e78166ab64d86bf204ec237 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 11 Jan 2021 15:47:57 -0800 Subject: [PATCH] need DirExt::hard_link_nofollow to implement path_link properly --- crates/wasi-c2/TEST_FAILURES | 3 ++- crates/wasi-c2/src/dir.rs | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/wasi-c2/TEST_FAILURES b/crates/wasi-c2/TEST_FAILURES index d751a5f421..2772e69933 100644 --- a/crates/wasi-c2/TEST_FAILURES +++ b/crates/wasi-c2/TEST_FAILURES @@ -15,7 +15,8 @@ wasi_tests::path_filestat - fdstat.fs_flags is not populated correctly - APPEND | SYNC aren't present because File::get_fdflags isnt implemented correctly wasi_tests::path_link - - symlink following behavior not yet implemented + - need DirExt::hard_link_nofollow + wasi_tests::path_rename_trailing_slashes - unclear, trailing slash behavior is wrong wasi_tests::path_symlink_trailing_slashes diff --git a/crates/wasi-c2/src/dir.rs b/crates/wasi-c2/src/dir.rs index 72971b0e68..343d8ab6f1 100644 --- a/crates/wasi-c2/src/dir.rs +++ b/crates/wasi-c2/src/dir.rs @@ -405,7 +405,17 @@ impl WasiDir for cap_std::fs::Dir { .as_any() .downcast_ref::() .ok_or(Error::NotCapable)?; - self.hard_link(Path::new(src_path), target_dir, Path::new(target_path))?; + let src_path = Path::new(src_path); + let target_path = Path::new(target_path); + if symlink_follow { + self.hard_link(src_path, target_dir, target_path)?; + } else { + todo!() + /* + use cap_fs_ext::DirExt; + self.hard_link_nofollow(src_path, target_dir, target_path)?; + */ + } Ok(()) } fn set_times(